If I told you that you could create your own fun video game in less than an hour, would you believe me? I’d be skeptical, too, but in this short tutorial I’m going to show you how to create a fun little treasure hunting game where the player will need to collect a treasure while hiding from a bad guy who shoots missiles. I’m going to do all this using Microsoft’s Kodu Game Lab (kodugamelab.com), a free application for Windows that will have you programming your own video games — no previous programming skills required!
What I’m hoping you’ll take away from this tutorial is an understanding of how to use the basic tools in Kodu Game Lab. Yes, there are more advanced tools, but if you can follow along in this tutorial and walk away with a grasp of how the Kodu user interface works and how to add basic game components... well, you’re on your way to creating even more advanced games that you can share with your friends and family.
This is a simple tutorial — when you finish creating this game, you’ll have only used about 5% of all of Kodu’s available tools. Just think about the kinds of games you’ll be able to program once you dig deeper into Kodu! At the end of this tutorial, I’ll offer you some suggestions on how this simple game can be improved or upgraded, but keep in mind that this will require you to dive in and explore Kodu Game Lab to discover all the tricks and tools it offers.
After you’ve downloaded and installed Kodu Game Lab, double-click the Kodu icon on your desktop (or launch Kodu Game Lab from the Applications menu.) Once Kodu Game Lab opens, you’ll see a screen like the one in Figure 1.
Figure 1 Kodu Game Lab
Use your mouse and click on New World. The Kodu Game Lab user interface will open and you will see a single block of green terrain in the center of the screen in addition to the tools running along the bottom edge of the screen as shown in Figure 2.
Figure 2 A bit of empty terrain and the tools
I won’t be able to go over every tool in this tutorial, so for now I’m just going to tell you exactly what to click and where to create this game. You’re going to start by adding the character that the player of the game will control. To do this, click on the Object Tool icon — it looks like a small robot head and is the icon to the right of the Move Camera icon (that looks like a hand). Click it once to select it and then click on any empty part of the green terrain. A pie menu will appear like the one in Figure 3.
Figure 3 A pie menu offers you programming options
As you move your mouse pointer around the pie menu, slices will be selected and colored yellow. The yellow pie slice indicates the slice that you will select when you left-click the mouse. Select the Kodu pie slice (seen in Figure 3) and a single Kodu character will be placed on the terrain as shown in Figure 4.
Figure 4 Kodu will be controlled by the player
In this game, Kodu (controlled by the player) is going to have to hunt for Coins while avoiding a dangerous Saucer that will be floating around. Both Kodu and the Saucer will have a health bar that floats over their heads — if a player’s health bar is reduced to zero, the game is over and the player loses. But if the player collects enough Coins, it will enable Kodu’s own weapons to turn and allow the player to fire back!
Take a look at Figure 4 and you may notice that the bit of terrain that Kodu is currently occupying just isn’t all that large. We need to give Kodu (and the Saucer) more space to roam around and hide. Right now, there are no obstacles for Kodu to hide behind — no trees, rocks, or buildings, for example. Before we add these obstacles, let’s add more terrain so Kodu and Saucer will have more room to roam.
To do this, you’re going to want to zoom out a bit so you can see a bit more of the world you’re going to create. To do this, use the scroll button on top of your mouse or you can use the PageUp and PageDown buttons on your keyboard. Zoom out until the bit of terrain is about the size shown in Figure 5.
Figure 5 Zoom out to add more terrain
Once you’re zoomed out, click on the Ground Brush (shown selected in Figure 5 – it looks like a paintbrush). After selecting the Ground Brush, move your mouse pointer near the single block of green terrain and you’ll see a white square appear like the one in Figure 6.
Figure 6 Time to start painting more terrain
Click and hold the left mouse button and drag the white square around. This will allow you to add more terrain. Figure 7 shows that I’ve enlarged the playing field quite a bit — try to keep your terrain as close to mine as possible, but it doesn’t have to be exact.
Figure 7 The terrain has been expanded
Use the scroll wheel (or PageUp/PageDown buttons) to zoom in on Kodu’s position. You can click on the Move Camera tool (the hand icon) to move the terrain around if you like; click and hold the left mouse button and drag to move the terrain left, right, up and down. Click and hold both the left and right mouse buttons at the same time to rotate the terrain. (Experiment with this until you get the hang of rotating and moving the terrain around.)
It’s time to add the bad guy. Once again, click on the Object Tool and click somewhere on the empty terrain. A pie menu will appear, but this time I want you to select the Saucer object. You may not notice it — that’s because it’s in another pie menu that is accessed by clicking on the pie slice shown in Figure 8.
Figure 8 Some pie menus open up additional pie menus
Click on the pie slice shown in Figure 8 and a new pie menu appears like the one in Figure 9. Click on the Saucer.
Figure 9 Choose the Saucer pie slice
The Saucer will now share the terrain with Kodu. In a moment, you’re going to program the Saucer to fire missiles at Kodu, but first you’re going to need to give the player a fighting chance by adding in some objects that Kodu can hide behind. Select the Object Tool again and click and drag on Kodu and Saucer to move them out of the way. Move them to opposite sides of the terrain as shown in Figure 10.
Figure 10 Separate Kodu and Saucer
There are lots of things you can place for Kodu to hide behind, but let me now tell you the name of this game — Skyscraper Panic! I could have called it Hide and Saucer Seek or maybe Forest Fight 1 (because obviously there will be a sequel — Forest Fight 2). I chose this name because I’m going to add some buildings and streets for Kodu to wander while he looks for Coins. Saucer will also be randomly wandering these streets — if Saucer sees Kodu, it will fire a missile! If too many missiles hit Kodu, it’s game over!
How do I add buildings and streets? Glad you asked. Let’s add the streets first. Start by selecting the Ground Brush again (looks like a paintbrush) and click on the set of four colored blocks just above and to the left of the Ground Brush. (Look back to Figure 5 to see this set of four colored blocks.) When you click on the colored blocks, it will open up a set of colored blocks for you to browse and select from… click on a gray as shown in Figure 11 that will be used for city streets.
Figure 11 Choose a color for the city streets
Now, before you go clicking on the terrain to add squares of gray, let me show you an easy way to make long lines on the terrain that will represent streets. Once again, click on the Ground Brush tool, but this time click on the small blue shapes that appear above and to the right of the Ground Brush icon. (You can see these back in Figure 5.)
When you click on the small blue shapes, another set of options appears. These are used to select the shape of the brush – the starting shape is the Square Brush, but you can use the scroll button or the Left/Right arrow buttons on your keyboard to choose another option such as the Round Brush. I want you to select the third one called Linear Square Brush as shown in Figure 12.
Figure 12 Brush shapes can be selected
After clicking on the Linear Square Brush, perform one more action. Move the mouse pointer over the terrain and you’ll see the glowing square that indicates where a gray-colored bit of terrain will be added if you click the left mouse button. But don’t click there yet! You need to reduce the size of the square to make the city streets not so large. Tap the Left arrow key on your keyboard until the glowing square is just a little larger than the Kodu character. Figure 13 shows the glowing small square in the center of the terrain.
Figure 13 Shrink the square before adding streets
Streets will go in straight lines, and you can create these by moving the glowing square to the start of one end of the street and left-clicking once... and then dragging your mouse pointer to the other end of the street and left-clicking again. Do this correctly and you can place a straight gray line as shown in Figure 14. (I’ve rotated my terrain so I’m looking straight down on it from above — this helps make sure the streets are running North/South and East/West.)
Figure 14 A single street is created
I’ll use the Ground Brush tool to create more streets. When done, I’ll end up with a nice grid of streets as shown in Figure 15.
Figure 15 All the city streets are now drawn
Now it’s time to create the skyscrapers that make up this section of the city. To do this, I’ll once again be using the Ground Brush, but this time only to change the color of the spaces/holes inside the streets. I’m going to show you how to create one skyscraper and I’ll leave it to you to create the remaining skyscrapers. (In Figure 15, you can see that I’ve got 17 diamond-shaped holes that are surrounded on all sides by city streets. Your game may have more or less depending on how you drew your streets.)
Use the Ground Brush to choose a color (the way we did back in Figure 11). After selecting a color, click on the Ground Brush icon again, click on the blue shapes in the upper-right corner, and instead of selecting the Linear Square Brush, choose the last option shown in Figure 16 – Magic Brush.
Figure 16 Magic Brush is the tool needed to color the skyscrapers
After clicking on the Magic Brush, move your mouse pointer over any green area that is surrounded by city streets. You’ll notice that the area will glow. Left click once and that small area of green will change to the color you selected for the skyscraper. Figure 17 shows that I’ve painted a single diamond-shaped patch of terrain red.
Figure 17 One skyscraper will be red in color
Select a unique color for the remaining patches of terrain (but leave the ring around the city green). Figure 18 shows that I’ve now got a nice mix of colors for each of my skyscrapers.
Figure 18 All the skyscrapers now have an assigned color
Now it’s time to raise them up. Rotate and zoom in on your terrain so you’re looking at it from a slight angle as shown in Figure 19.
Figure 19 Zoom in and rotate so you can see the shapes more clearly
Now you’re going to use a different tool – the Up/Down tool that is to the right of the Ground Brush tool. Click on it and you’ll see a similar set of blue shapes just above and to the right of the Up/Down icon as shown in Figure 20.
Figure 20 Choose the Up/Down tool to raise and lower terrain
Click on the blue set of shapes and select the Magic Brush again (it’s the last option). After selecting Magic Brush, move your mouse pointer over one of the colors you selected for a skyscraper. That color will begin to glow. Left-click a few times and you’ll see that the color begins to grow upwards while retaining its shape. Figure 21 shows one of my buildings now is actually three dimensional!
Figure 21 One of the buildings actually looks like a building now
Perform this same operation on all remaining colored squares, but vary the height of each building. Figure 22 shows that I’ve now got a nice little city of colorful skyscrapers.
Figure 22 A city full of skyscrapers