Академический Документы
Профессиональный Документы
Культура Документы
Kodu is a videogame building environment. This very simple interface hides a huge amount of complex code,
allowing us to focus on concepts of design and mechanics rather than syntax and debugging. That said,
because of how much this program does for you it isnt as flexible as something like XNA, Unity or
UnrealEditor that some of you may be familiar with.
The first concept that Kodu assists us with is generating a 3D world. All the levels you will create for this
course will begin as a 3D world simply by loading a blank world in the program. The next step is to add some
terrain, whether it is an island or a pinball tablethe word terrain is used to describe the surface on which
your game occurs. The objects you can add into your world are assets built into Kodu, so no you cannot
import a model made in another editor and animate it here. You can always make a 2D game by fixing the
camera to one side, and only allow the character(s) to move in 2 dimensions.
The core of Kodu is the programming. Dont be alarmed by this word, this is programming unlike anything
youve seen, and probably will see again. Kodu relies on a rule-based behaviours system that is accessed via
the same graphical interface as the rest of the environment. Fundamental behaviours are stored in individual
tiles, using plain English, that you can chain together based on a When Do clause structure. There is no
typing, and youll be hard-pressed to actually cause the program to crash (it might not do what you want, and
it might go into a loop, but I havent ever made it crash.)
So work your way through this booklet, keeping in mind that there may be more here than you can get
through in one week. Feel free to experiment as well, this environment is designed to be a rapid prototyping
model, so you can try things very quickly and see if they work.
This manual was originally written for use on an XBox 360, not a PC with keyboard and mouse controls. So,
occasionally there may be references to pressing a button on the controller that obviously doesnt make sense
when using a computer. Most of the controls are fairly intuitive, though there will be a few that arent
Windows standard. You should be able to figure out most of the controls yourself after reading through this
manual, but if you still have trouble, speak to your practical instructor.
Were going to load a level from the local hard drive. Use the
mouse, click load world.
World list
Left/right arrows on
keyboard or screen
to scroll
Current Game
Details for
Current Game
The load screen shows eight games at a time. Details for each game are below the current game tile.
You can show all the available worlds, or selected categories by using the large buttons near the top of the
screen.
PC Note: you can scroll through this menu either by using the left or right arrow keys, or clicking the green
triangles on either side of the screen. Most screens in Kodu follow this convention of keyboard option and on-
screen buttons. To launch the game, click the world once, then click Play on the pop-out menu.
SORTING THE WORLD LIST
Lets look at a very basic world so that we can learn how to move around and activate different modes.
3. Open any world. You open the world by left clicking on it and selecting Play.
When you open a level, it is in play mode. How it looks and how you move around will depend on the game.
However, the following is pretty standard across all games:
The cursor in the PC version is simply your normal Windows mouse cursor, not the white circle.
When Editing you can move around using the move camera
command. In the move camera command you can zoom and
change the camera angle as above, plus move the camera by left
click and drag or use the WASD keys as in most 3D games. When
using any of the other editing commands you can temporarily access the move camera command by holding
down the space bar and then using any of the above camera operations.
When you first launch a world, you are in Play Mode. When you want to edit the world, you need to first press
ESC on the keyboard to switch to edit mode (also in the edit mode is the way back to the main menu).
Open the world we used on the previous lesson: Empty Stadium v01. The world will open in play mode. Not
that there is anything to do.
Selected Tool
The tool palette at the bottom of the screen lets you choose a new tool. Simply click which tool you would like
to use. The icon for tool you have selected will remain larger than the other tools in the palette.
With the object tool active, you can move it around the world with the mouse. Select the Object tool, and
notice how you can now highlight objects in your world with the mouse cursor (well, you could if there were
any there, so lets add one).
With the object tool still active, left click somewhere in your game
world. (Careful where you left click thats where the object will
appear). The object radial menu will appear
.Navigate this radial menu with the mouse. Note that a section
with a dark pointed outer edge has more objects nested inside.
Select the apple in the upper-right area of the menu by left clicking
it to add an apple to the scene. Hit escape to close the radial menu
If you place your cursor on the apple, the apple will be surrounded
by a yellow glow. If you move your cursor away it will stop glowing.
Some of the items in the Add Object Menu - such as the tree - will
open smaller menus.
ADD A CHARACTER TO THE WORLD
Kodu provides interactive help for all the characters and objects. If youre not sure what a character does
does, or
you want to see examples of a how you can use it, you can open the Help to read about the character and pick
from a library of examples featuring that character.
Whenever the Add Menu is open (below,) you can press Y on the keyboard to get help on the currently
selected character. PC Note:: sometimes pressing the
the corresponding letter (A, B, X, Y) on the keyboard will
activate the XBox-controller
controller equivalent.
NOTE: if you have a lower-end graphics card, you will not see the
glow effect on the character - but the cursor will still change color.
Return to the main menu and dont save any changes. Now re-open Empty Stadium v01. You may use any
other level for this lesson, but it will be easiest if the level you use doesnt have any other characters in it.
Keep the object tool active for the next steps. The object
tool serves to edit programs as well as adding and removing objects.
To enter the program editor, right click on your Kodu robot. Click Program from the menu that appears.
Here we see the program editor showing an empty program or, more precisely, a program consisting of one
rule, which does nothing.
I mentioned that this program contains one rule. A rule tells the bot what to do and when to do it.
On the PC, the pencil cursor still appears to show you which rule you are
currently editing, dont worry about it too much.
To edit a rule simply click the + next to the clause you wish to edit and you
should see the Verb Menu (below right.) This menu shows different things
this bot can do.
Choose the move verb, and insert it into your program by clicking. Your
program should now look like the picture on the bottom right.
The verb menu lets you specify what the bot is going to do when this rule
activates. Since we havent said when the rule should activate, it will be
active all the time.
To run your program, press ESC on the keyboard twice (ESC often
substitutes for the Back convention that indicates on the XBox); this
will close the programming UI, return to the tool menu, and then return
to play mode. You should see your Kodu move in a straight line.
DECIDING WHEN TO DO SOMETHING
This lesson builds on the previous one. If you havent done it, please
do it now.
Activate the Object tool from the palette. Left click the gameworld
to bring up the Character Add radial menu.
Your scene should have one Kodu,, and his program should look like this. (Reminder: to see a characters
ch
program, use the Object tool, right click on the character, and select Program. This program says move no
matter what. We want to change it to say when you see anything, move.
This shows you things that the bot can react to: he can react to things he
sees, hears, or touches, controller input and so on.
Wed like to change our program so that Kodu only moves when
he sees something green. To do this, we will add to the When part
of the rule. Open the program editor and put the pencil just after
See tile. (see right)
Click the + that follows See in the rule. Since you already have a see sensor in your program, opening the
menu after this sensor gives you options for modifying the see operation. You dont usually have to think
about this; as you build a program, the menus will change
to show the right options automatically.
MORE EXAMPLES
If you see a green Kodu, move away from it. The rule assumes that you move away from the thing you saw.
Other modifiers include a target aspect, ie. causing damage to itself or the thing it bumps into.
Try surrounding your poor initial Kodu with green Kodus and see what happens. Note that Kodus vision is not
360o and he doesnt move forever with the program youve given him.
The program editor provides help for all the programming tiles. Whenever
you are looking at a tile in a tile selector menu, you can press (Y on the
keyboard) to get help on that specific tile. The help system will also show
you help for the other tiles inn your program. You can also find related
examples related to your program that you can easily insert into your
program.
Making hills and valleys is fun, easy, and allows you to set up
interesting game mechanics. The shape of the ground affects
character behavior: hills block vision, and some characters cant
climb steep hills.
You will see a flashing area on your terrain. Its purple in the
picture at right but the color depends on the terrain. This is
your brush; it shows which part of the ground the tool will
affect. Most of the tools that affect terrain work like this.
You can change the size of the brush by pressing the Right
and Left arrow keys. (Notice the control tool tips on the left
side of the screen.) You can change the brush shape by
clicking on the blue images near the tool icon in the tool list.
You can also move the brush while you are raising or
lowering the ground. Try holding the right or left click while
moving the mouse cursor - with practice you can paint
mountain ranges and hills.
Clicking on the small icons just above and left of the ground brush lets you choose terrain colour, the blue ones
again control the brush shape
For this lesson, please open the Empty World v01 world.
Now that you have chosen a new material, create some more terrain using this material
The terrain you created above was flat you may want something a bit more three dimensional. You can use
the Up/Down tool weve already seen or you can get some more dramatic effects from the Roughen tool.
The Roughen tool randomly changes the height of the terrain under the brush. It has two variants: spiky
creates truly random, spiky effects, and hilly creates a more rounded, softer look.
Press the start button to bring up the Tool Menu select the Roughen
tool. You will see a flashing area on your terrain. This is your brush; this
shows which part of the ground the tool will affect.
Use the left mouse button to spike the terrain and the right
mouse button to make the terrain hilly. While you could do this
with the up/down tool and a very small brush, this tool makes it
easier to add visual detail over a large area.
If an area gets to spiky, you can smooth the terrain under the
brush by pressing the middle mouse button.
You can choose more brushes in the same way as the other
terrain brushes.
Try using the rough/curvy tool to create different visual effects: Create an ocean with a jagged bottom and a
smooth beach (see below for adding water). Make a world with a flat area, a smooth hilly area, and spiky
mountains. Create a mountainous terrain with a narrow path going through it - perhaps by using the
rough/curvy tool together with the flatten tool. Create a world with a mountain and a ramp that lets a
character move from the bottom all the way up to the peak of the mountain.
You will often find that you need a flat arena in which your gameplay can happen. The flattening tool makes
it easy to level an area to a consistent height.
Press the start button to bring up the Tool Menu select the Create
Flat Areas and Ramps tool. You will see a flashing area on your
terrain. This is your brush; this shows which part of the ground the
tool will affect. This brush behaves like the other terrain brushes
discussed earlier.
When you paint with the flattening tool, it looks at the height
where you start painting and then raises (or lowers) everything
the brush touches to that same height. If you start at a
mountain peak and drag the brush across the terrain, you will
create a flat area at the height of that peak. If you start in a
deep valley, the brush will lower ground to that level.
Move the cursor to the location where you would like to start
flattening. Left-click to start flattening and hold it down while
you move the mouse to paint a flat area. Notice that ground is
When you add water to a world, it is as though you are pouring the
water onto the ground at a particular point; the water will pool in
low-lying areas to form lakes and streams.
There are different types of water. To change the type you are creating, click the coloured blocks above the
Water Tool icon. This type will apply to any new water that you create. To change existing water to use this
type, move the cursor over that water and press the middle mouse button (click the wheel) to set the type of
that water.
So far youve been tinkering with the tools that make up Kodu Game Lab. The next few pages are a step-by-
step instruction in creating a basic, working videogame. A good way to learn about a new development
environment is to attempt to clone an existing game that you are very familiar with. So we have chosen Space
Invaders as our model to clone in the Kodu environment. If you havent played Space Invaders for a while, go
to this link and play for a few minutes to remind yourself of all the various mechanics involved:
http://www.freespaceinvaders.org/
GETTING STARTED
Even with a game as simple as Space Invaders, and in an environment as intuitive as Kodu, there are
fundamental steps of planning to be done before you start touching any of the tools. Planning saves you a lot
of wasted time later on, and focuses your project so you can be sure you are done when you think you are
done. With this project, we already have a template game to work from, so the planning stage is easierthe
biggest reason to clone a game is to shorten your initial design time, and let you get into the development as
quickly as possible!
The process we will use throughout this course is fairly informal, but is most like the Rapid Prototyping Model.
A prototype is a simple version built quickly to get to the play-testing stage as soon as possible. The process
begins with some initial planning where we define our project goals and requirements. Our basic goal here is
to create a reasonable copy of Space Invaders. Our requirements will be a checklist of mechanics, aesthetics
and gameplay experience. The Analysis and Design stage breaks the larger ideas down into specific objects,
characters, mechanics and level designs. Implementation is the point when you dive into Kodu and start
building. As soon as you can, press Play and test the mechanic youre trying to implement, and let the
information you discover during play-testing influence the next round of design decisions and requirements.
It is useful to take your game design apart, and build as many self-contained objects and mechanics
individually, and test them as you gorather than trying to build the whole game, and only then hit Play.
Well find some opprotunities for isolated testing as we go.
How big is large? Determine your proportions by placing your players ship on the empty field, and then use
terrain painter tool to create a large square field beneath your ship.
Next, reduce the size of your brush slightly, while keeping it centred on your bi
bigg square. Change the material
type to whatever youd like the floor of your arena to look like, and paint another square, so you have two
concentric squares, or one square with a
different coloured border.
This will cause the saucer to respond to the keyboard motion commands. Limiting the movement to
East/West will cause it to only be able to move horizontally, if yyou
ou have oriented the camera so that North is
up the screen.
We also want our saucer to be able to shoot, so Ill use the Space Bar for that. Youll find Space Bar in the Misc
sub-category of the keyboard.
Lets test these two mechanics and make any aadjustments as necessary. Itss important to position your saucer
well so that it is free to move in the arena. Try driving your saucer back and forth and shooting some blips.
Kodu is such a fast programming environment that it is increasingly important to know what you want before
you try to build it, or youll be caught in a never ending loop of fiddling. It sounds so easy to just
just jump in and
start buildingand
and it is, but its also very easy to get lost playing with how the character shoots, and end up
wasting time that should be spent on giving it something to shoot at, for example. Its also good practice to
get into because not all environments are as quick to implement and test as Kodu, and if you are spending
time implementing features that are not in your requirements brief, youll waste far, far more time in those
projects.
CREATING ENEMIES
Lets create some enemies. In the original Space Invaders, the screen is fully
fully-populated
populated by a grid of aliens
descending in a nice orderly fashion. I am going to change this up a little bit by populating the screen onon-the-
fly with enemies that will move along a path towards the play
player,
er, instead of in one big block. The effect should
be a bit more dynamic game than the original. The game may also resemble Centipede a bit more than Space
Invaders as a result.
First, pick an object from the Objects Tool; Im going to use a Wisp for th
this
is one because they look pretty cool
when you make them glow. Add the object to the scene.
Right-click
click to change some of the Settings of the
wisp. Firstly, lets lower its health from 50 to 10 or
15 (remember the default value of your saucers blip
bullets
llets is 5 damage). Secondly, enable Creatable in
the settings list.
So now we have some code that will create a wisp for us. Test it out.
Not very interesting, because the wisps dont do anything! Lets fix that.
Firstly lets change the height of those wisps to match your saucer. Now lets give them their marching orders.
You can make more turns or fewer, but the last one needs
to run right over your saucer.
The path should be invisible when you press play, but if its
not, check your world settings for Path Debugging and turn
it off.
Now
ow lets teach that Wisp to walk along the path. Its as simple as:
Now, the stick is spitting them out at regular intervals. I think this is pretty
pretty boring. So lets add the following
to change it up a little. In the stickss program add:
This will cause the stick to wait 1 second, then 0, 1 or 2 seconds more before shooting enemies. Play with the
timing until you get something you like. You can even set up a second line of wisp creation with a different
timer to make it more chaotic.
At this point you should be able to play your game. We havent implemented any scoring or failure
mechanics though, so lets do that now.
Firstly, lets add some value to shooting those wisps, by adding this rule to the wisp class. Youll find the
scoring variables in the Game menu category.
Now what happens if the player messes up and gets hit by an enemy? That ends the game of course! So add
this to the wisp as well.
The wisps are still missing something: their own missiles. Add this rule:
Weve told the wisp to shoot the secondary weapon, the slow moving missile. Our board is level, so Ive used
the level command, that way when it hits the back wall it will explode rather than try to follow the altitude of
the land, if you choose cruise the missile can make its way over hilly landscapes.
Be sure to configure the timing to create enough of a challenge, but not so much that the game is too hard.
har
Also, check the wisps settings to see how much damage each missile does. Do you want the player to be able
to survive more than one shot, or is it one
one-hit-kills? We also need to add a game-over
over rule to the saucer when
its hit by a missile.
Now, if you play for long enough, eventually one of your wisps is going to shoot another one. That will
probably cause one wisp to destroy the othergiving
other giving the player free points! Lets change that with this line of
kode:
So, whenever the shot hits a wisp, thee damage will be zero.
zero There might be better ways to do this, especially if
you want to introduce different enemies. This is a good time to do some testing.
So now we have a scoreboard, but the game will go on forever! Lets create an end condition. Attach this line
to your player/character (in mine, the saucer).
Finally, go back to the requirements list and check to see whats missing.
OTHER FEATURES
Shields! Of course, the original cover system! Lets add a shield to hide behind. First think about the
properties of the
e shields in the original: they will absorb enemy fire, but eventually get holes drilled in them.
The player can also punch holes through them with his own shots, so they arent invincible. Kodu wont let us
make holes in objects, but we can approximate the deterioration of the shields using health.
So lets pick an appropriate object to act as a shield, how about a rock? They could be asteroids! Place a rock
in your scene, and adjust its size to 2 or 3 so its big enough to be useful. Then check its maximum
aximum health. This
is where game balancing comes in, and where game documentation is important. How much health do your
rocks have? How much damage does a wisps missile do? How much health does the rock have compared to
the players saucer? These things
hings all need to be balanced to make sense so that the rock can take a few hits
before it blows up, but the players saucer cant. So perhaps if the missiles have a damage of 50, and the
players saucer is also 50 (so 1 shot destroys it), the rocks shoul
should
d have 200 health, meaning theyll only last 4
shots. It really pays to have this stuff written down so you can check it all at once. Weve only got 3 game
elements here, what if we add 3 more enemy types with more than one kind of shooting capability?
Whatever you decide as your balance, place two or three rocks in your arena that your player can hide behind.
I suggest placing them in between the last 2 passes of the wisps so the enemies dont run into them and get
confused.
Something weve hardly touched on is the look of this game. So far the level is pretty ugly. Lets play with a
couple world settings to change that!
Firstly lets set up the camera so we know what the player will be seeing each time. Click on the World
Settings at the end of the Tool menu,
and scroll to Camera. Choose Fixed
camera, then click the X icon to set your
Pro Tip: Saving in Kodu is a little
cameras position. This is the
different to your average document
perspective Im using:
editor. There is a built-in in version
Now back in the World Settings
ettings Menu, incrementation option so you can
play with the Sky and Lighting settings quickly sort through v00, v01, v02 of
until you find something atmospheric. the same project. Take a close look at
Im going for the sci-fi
fi space aesthetic so the save screen by pressing Home on
Ive chosen some fairly dark settings. the keyboard, or clicking the house on
That will make the glowing of my the Tool palette.
objects stand out more, but I should probably add some lights to make things a bit more visible.
RESULTS
At this point you should have a working version of a Space Invaders-like game. There are a lot of things that
could be added to it, of course, but many of the basics of gameplay and the functions of Kodu have been
covered here. Feel free to experiment with this design and learn more.
ASSIGNMENT NOTES
We have referred to this design as being worth a Credit, but that isnt entirely true. To get a credit with this
design, youll need to add at least one more enemy type to increase the difficulty at some point in the game.
You would also want to spend some time on the aesthetics, as indicated above. Even then, this would only be
a low credit. To get higher marks, wed like to see something other than a straight clone of a primitive game.
Add something innovative, or polish it until it really shines. It also assumes that the accompanying
documentation with this game is of a very high standard. You cant make a great game and provide terrible
documentation for this course. Both are important parts of the process.