in

Starting game design and game writing

Over the last couple of months I’ve attended a number of events which have allowed me to show many young people how to ‘make’ their own game. This quick demo has used the Platform Starter Kit which is included in the XNA Games Studio.

image

The Platform Starter Kit is as its name suggests a ‘Super Mario Bros’ © style platform game.  It is very easy to change and add more levels to the game and with a tool like Paint.Net (a free paint program the understands transparency) you can also alter the various graphical elements of the game. For example, my son has great fun redesigning the platform bricks, the backgrounds and even the main player! Once you have altered the graphics you just save them and recompile the game – when you then run the game you have YOUR game graphics. If you edited and changed all the graphics used by the Platform Starter Kit you’d have your very own platform game!

So let me show you how you can go about doing this.

First of all, you need the tools installed on your machine. See the 'How To’ article titled ‘Build a computer game in one hour’ for what to download and how to set up the XNA Game Studio.

Once this is all setup, you can start up Visual Studio C# 2008 Express (we’ll call this VS or C# (that’s C Sharp) for short).

image

From Vista’s All Programs menu it’ll look like this.

 

Once started you need to make a new project:

image

Select File –> New –> Project from the C# menu.

This will give you a new window to choose the style of project from.

 

 

 

 

 

We want the Platform Starter Kit

image

You can change the name and solution name text  - maybe call it MyFirstGame.

C# will then take a moment to build the platform starter kit project. Depending on how powerful your computer is this may take a few seconds to a minute or two, so just sit patiently until the status bar at the bottom of the C# windows says is has created the project successfully.

image The starter kit actually makes three projects. One for Windows, one for the Xbox 360 and one for the Microsoft Zune (think Microsoft’s iPod alternative).To run the game as it is, just press F5 but make sure the Windows version of the game is set up as the starting game. You’ll be able to see the Xbox and Zune projects because they are called Xbox and Zune! But the Windows version of the game will just be the name you gave the game. My name was Platformer5

image

as you can see here. So what you need to do is make sure this is the game C# will try to run first.

image

Do this by right-clicking on the name (Platformer5 for me) and selecting the ‘Set as Startup Project’ option.

 

 

Once you have done this (the project name is then BOLD) you can just press the F5 key to start the game!

Go on have a go now, if you are following along. There are only three levels in the current game. The objective is to get your man to collect all the gems and avoid all the monsters. So make your way to the exit once you have all the gems on each level.

When you have completed all the levels the game starts again at the first level.

If you have played Super Mario Bros© you’ll know it has 8 worlds with 5 levels per world. Giving the game 40 levels in total.

We can add levels to our game very easily. Let’s do that now.

image

In the Solution Explorer on the right of your C# screen you’ll see a list of all the things that are in the game. Once of the things is called HighResolutionContent(Content). This is where all the graphics and sounds are for the game. If you open this folder by clicking on its name you’ll see more folders named after their contents. For example, Backgrounds includes all the background images used in the game.

There is also a folder called Levels. If you open this folder, you’ll find three text files. These files tell the computer how to draw each level in the game. If you open the first level by double clicking on 0.txt you’ll see the contents of the file in the editor, like this:

image

Let me explain what you are seeing. First of all the ‘.’ (full stop) is a blank. The computer doesn’t draw anything when it finds one of these. If it finds a ‘G’ it will draw a Gem. If it finds a ‘#’ (hash) it will draw a solid platform. The 1 marks the starting point for the player character on each level and the ‘X’ marks the exit point for the level. Some additional symbols are: ‘-‘ (hyphen) is a soft platform – one the player character can climb through. There are also four monsters in the Platform Start Kit. These are represented by A, B, C or D. So if you replace a ‘.’ on the line between the 1 and the X in the 0.txt file with A, B, C or D you’ll have a monster running around there when the game starts!

So go on, add some more platforms (# or –) and some more gems (G) and maybe a monster or two (A,B,C or D). Just make sure that the length of each line is the same. The computer is expecting to have lines 20 characters long. If you have a line to short or to long you’ll get an error. If this happens – don’t panic! First check the level files you’ve edited to to make sure the lines are all the right length. Then run the game again.

Also, all the letters (G,A,B,C,D,X)  need to be CAPTIAL letters and you can only have one X and one 1 in each level.  This is my modified level 0:

image image

 

 

 

 

 

 

 

 

 

 

 

 

 

 

That was easy wasn’t it?

Now, the next thing you might like to do is add more levels to the game. You can do this easily too.

In the Solution Explorer, select one of the level files (0.txt, 1.txt, 2.txt) and then right-click and copy it. Now right-click on the ‘Levels’ folder and select Paste. You should then have a new .txt file created called something like Copy of 2.txt depending on what file you copied.

image

What you need to do now is rename this file to the next level number. For example, I need the level file to be called 3.txt. If I added more they would have to be 4, 5 and 6 etc as I added them. It is important to number them consecutively as the game depends on this to get the level order right :-)

 

 

So my Level folder now contains these:

image 

 

 

 

The next step is a bit techie but easy enough. We need to tell the C# compiler what to do with these new level files when it is building the game. We do this by selecting each new level file in turn and changing the Build Action to None. It will be Compile by default, but as the txt files don’t need compiling we change the build action to None.

image

 

 

 

 

 

 

Now you can open your new level file and edit it to make up a completely new level for the game. Just remember each line needs to be 20 characters long and all letters need to be CAPITAL letters. Once you have finished editing your new level files you can press F5 again to run your game and try out your new levels.

If  you want to be like Super Mario Bros © you need to make 40 level files!

Once you have fiddled a bit with the levels you probably will want to change some of the graphics. You’ll find the various graphic files in folders in the project. These folders will also be on your disk drive, so the thing to do is find the project directory from within your Documents folder on your hard disk. Typically this is Documents –> Visual Studio 2008 –> Projects –> <your project name> –> <your project name> –> HighResolutionContent

Replace <your project name> with the name of your project. This is required twice assuming you named the project and the solution the same thing!

Once inside the HighResolutionContent folder you’ll find all the content folders containing various graphics. Stepping into the Sprites folder will take you to the place where the monster and player graphics are stored. If you step into the Player folder you’ll see a animation file for each player state – celebrate, die, idle, jump and run. If you open one of these files in Paint.Net (or your favourite graphics program) you can change each animation frame so your character looks or does something different. Remember when you used to make ‘flip book’ animations by drawing a stick person on the corner of several pages and then flicking through then quickly to see the stick person move? Well this is what the computer is kind of doing. It moves through each frame in the image file one at a time to make the character appear as if it is moving.

Jump

So if you want to change the character you have to edit each one of these frames in the image file and then save the image.

The other graphic files you might like to edit include those in the Tiles folder. These are the tiles used to draw the platforms. So changing these will see the platforms drawn in the game change. The A suffixed tiles are the hard tiles, the B suffixed tiles are the soft tiles.

There are also the backgrounds to each level. These are draw in three parts. The sky, middle ground and fore ground. This is so in the future you can make the game scroll and move each of these layers at a different speed to make it look the player is moving ( the foreground moves faster than the sky you see – watch the next time you are in a car).

By changing these background images you’ll change the settings of each level. So you could make this a game on an alien planet in space just by changing the images for the backgrounds and the sprites!

As long as you save your edited files back to the place you found them and keep their name the same C# will use them when it builds the game for you (when you press F5). If you want to go back to the originals images you can just create a new platform starter kit project using a different name and take the image files from there :-)

 

Have fun making your version of the Platform starter kit!

» Trackbacks & Pingbacks

    No trackbacks yet.
Trackback url for this post:
http://wotudo.net/blogs/how2/trackback.ashx?PostID=427

» Comments

  1. How do you Change the music

    Jimmy — July 18, 2009 10:42 PM
  2. Thank's

    K.1.G. — July 30, 2009 2:17 PM
  3. Thanks!

    cheap uggs  sale hot on

    http://www.cosycentral.com/

    Cheap UGG Boots — October 28, 2009 11:26 AM
  4. got to meet the hottie with the million dollar body

    they say its over budget but you'd pay her just to touch it come on

    needs to hit the big screen and shoot a little love scene    

    <a href="http://www.baidu.com">baidu</a>

    [url=http://www.sina.com]sina[/url]

    baidu — October 30, 2009 9:16 AM
  5. got to meet the hottie with the million dollar body

    they say its over budget but you'd pay her just to touch it come on

    needs to hit the big screen and shoot a little love scene    

    <a href="http://www.baidu.com">baidu</a>

    [url=http://www.sina.com]sina[/url]

    baidu — October 30, 2009 9:18 AM
  6. Thanks!

    cheap uggs on sale

    http://www.cosycentral.com

    cheap puma shoes on sale

    http://www.pumaforever.com

    UGG Classic Boots — November 3, 2009 2:22 AM
  7. ugg shoes, no clothes are a perfect match. <a href="[url=http://www.elegantugg.com]ugg[/url]">uggs outlet</a> you will find that change   a person's outside the United States is very simple. <a href="[url=http://www.elegantugg.com]ugg[/url]">ugg dakota</a> shoes on this   website I feel very good in terms of price, style, all are preferable. Who are   interested can go and see.

    http://www.elegantugg.com/

  8. ugg shoes, no clothes are a perfect match. <a href="[url=http://www.elegantugg.com]ugg[/url]">uggs outlet</a> you will find that change   a person's outside the United States is very simple. <a href="[url=http://www.elegantugg.com]ugg[/url]">ugg dakota</a> shoes on this   website I feel very good in terms of price, style, all are preferable. Who are   interested can go and see.

    http://www.elegantugg.com/

  9. Great!

    Polices — November 22, 2009 10:16 AM
  10. if you want to buy here is some good Website

    for another you can see this any more:

    ugg boots — January 11, 2010 7:47 AM
  11. The sale of fake Gucci shoes is now a common event. But, the online shopping platform adds a fresh layer of deception. Individuals buying the fashionable shoes do not understand that the products they are buying are fake.

    discount gucci shoes — January 19, 2010 2:40 PM
  12. bellbestugg.com.Top quality, Competitive price, Fast shipping, Combined order, Drop shipping available, Best and Timely Service, 100% Satisfaction, Big discount for big order. From Internationa-acschina. Note: The logo we using is International Australia boots from Dhgate ID acschina.

    www.bellbestugg.com

    Top quality 100% Satisfaction guaranteed.

    Highest quality genuine Made from Top quality Australia Twin-faced Merino sheepskin.

    It come with origanal box care card and booklet

    <a href="www.bellbestugg.com/">ugg suppliers</a>,

    <a href="www.bellbestugg.com/">woman ugg boots</a>

    <a href="www.bellbestugg.com/">UGG 30th Anniversary</a>

    <a href="www.bellbestugg.com/">UGG Sienna Miller</a>

    <a href="www.bellbestugg.com/">UGG Handbags</a>

    ugg boots — January 23, 2010 9:41 AM
  13. I was impressed by the use of it .

    ugg boots sale — January 25, 2010 6:20 AM
  14. thank  you for sharing ,

    uggs sale — January 25, 2010 6:29 AM
  15. Damn all those "comertials" are annoying..

    AReader — January 28, 2010 9:12 PM
  16. GOOD

    chi hair straightener — February 25, 2010 7:30 AM
  17. http://www.nbajs.com NBA Jerseys

    NBA Jerseys — February 26, 2010 7:13 AM
  18. The designs of nike store are very scientific so that it is very useful for sports. On the other hand, it is also very comfortable to wear them in the daily life.

    nike shoes — February 27, 2010 1:25 AM
  19. Damn all those "comertials" are annoying..

    cheap jerseys — March 1, 2010 1:33 AM
  20. The designs of nike store are very scientific so that it is very useful for sports. On the other hand, it is also very comfortable to wear them in the daily life.

    cheap jerseys — March 1, 2010 1:34 AM
  21. Flat Iron - Shop Online For <strong><a href="http://www.sweetv.com">GHD</a></strong><a">http://www.sweetv.com">GHD</a></strong><a href="http://www.sweetv.com"> Stylers</a>,<strong>ghd</strong> factory direct of the cheap <strong><a href="http://www.sweetv.com">ghd</a></strong><a href="www.sweetv.com/GHD-Purple-Gift-sweetv-195.html"> hair <strong>straighteners</strong></a><strong></strong> and <strong><a href="http://www.sweetv.com">ghd straighteners</a></strong>.<a title="GHD Styling Set" href="www.sweetv.com/GHD-Styling-Set-sweetv-204.html" alt="GHD Styling Set">GHD Styling Set</a> <a title="GHD Dark Styler" href="www.sweetv.com/GHD-Dark-Styler-sweetv-202.html" alt="GHD Dark Styler">GHD Dark Styler</a> <a title="GHD Gold Styler" href="www.sweetv.com/GHD-Gold-Styler-sweetv-201.html" alt="GHD Gold Styler">GHD Gold Styler</a> <a title="GHD Kiss Styler " href="www.sweetv.com/GHD-Kiss-Styler--sweetv-200.html" alt="GHD Kiss Styler ">GHD Kiss Styler </a><a title="GHD Luxury Gift Set " href="www.sweetv.com/GHD-Luxury-Gift-Set--sweetv-199.html" alt="GHD Luxury Gift Set ">GHD Luxury Gift Set </a><a title="GHD Pink Styler" href="www.sweetv.com/GHD-Pink-Styler-sweetv-198.html" alt="GHD Pink Styler">GHD Pink Styler</a></p>

    yangjingjing — March 6, 2010 3:42 AM
  22. Flat Iron - Shop Online For <strong><a href="http://www.sweetv.com">GHD</a></strong><a">http://www.sweetv.com">GHD</a></strong><a href="http://www.sweetv.com"> Stylers</a>,<strong>ghd</strong> factory direct of the cheap <strong><a href="http://www.sweetv.com">ghd</a></strong><a href="www.sweetv.com/GHD-Purple-Gift-sweetv-195.html"> hair <strong>straighteners</strong></a><strong></strong> and <strong><a href="http://www.sweetv.com">ghd straighteners</a></strong>.<a title="GHD Styling Set" href="www.sweetv.com/GHD-Styling-Set-sweetv-204.html" alt="GHD Styling Set">GHD Styling Set</a> <a title="GHD Dark Styler" href="www.sweetv.com/GHD-Dark-Styler-sweetv-202.html" alt="GHD Dark Styler">GHD Dark Styler</a> <a title="GHD Gold Styler" href="www.sweetv.com/GHD-Gold-Styler-sweetv-201.html" alt="GHD Gold Styler">GHD Gold Styler</a> <a title="GHD Kiss Styler " href="www.sweetv.com/GHD-Kiss-Styler--sweetv-200.html" alt="GHD Kiss Styler ">GHD Kiss Styler </a><a title="GHD Luxury Gift Set " href="www.sweetv.com/GHD-Luxury-Gift-Set--sweetv-199.html" alt="GHD Luxury Gift Set ">GHD Luxury Gift Set </a><a title="GHD Pink Styler"

    yangjingjing — March 6, 2010 3:42 AM
  23. <a href="http://www.baidu.com">百度</a>

    [url=http://www.sina.com]sina[/url]

    百度 — March 10, 2010 1:06 AM
  24. <a href="http://www.baidu.com">百度</a>

    [url=http://www.sina.com]sina[/url]

    百度 — March 10, 2010 1:57 AM
  25. thank you

    mbt shoes sale — March 10, 2010 1:59 AM
  26. thank you

    mbt shoes sale — March 10, 2010 2:00 AM

» Leave a Comment

(required) 
(optional)
(required) 

Submit