This is part of a walkthrough series on creating a game (Bizzy Bees) in XNA
Step 1: Setting the stage (projects and assets)
Step 2: Drawing the scene
Step 3: Adding flowers
Step 4: Making things move
Step 5: Adding some bees to the mix
Step 6: User interaction
Step 7: Rounding it up
A few issues in the game – left for you to fix
If you try to play the game a few times you may notice a couple of things
1. When the game starts, there may not always be a matching flower and bee
2. If you manage to empty a column, you may run into an issue where you are either blocked because there are no matching flowers and bees or it may crash
In the real game I have added a lot of logic around adding matching flowers when we start and when columns are empty but the logic for this was a bit too cumbersome to add to the walkthrough without making it completely incomprehensible in short articles.
How about a menu system?
Very few games start you off already in the game, but it makes it a bit easier to demo As of mango you can mix XNA and Silverlight to do menus for example but for Bizzy Bees I started off with a code sample from the App Hub called Game State Management http://create.msdn.com/en-US/education/catalog/sample/game_state_management which let’s you create different types of screens for menus, gameplay, highscores and pausing. It also includes functionality for handling tombstoning which is pretty nice.
One thing worth mentioning here is that when you use the back button in a game it is ok to bring up a pause screen and typically when you come back to a game you would also bring up a pause screen before you continue, so it’s a little bit different than Silverlight apps in that regard.
Sound and SoundEffects
I’m one of those people who turn off the sound in all games immediately as I start the game, but I realize that a game feels pretty flat and incomplete if there isn’t at least an option to have game sound. I find http://www.soundjay.com/ to be a pretty good source for random sounds, and a lot of the gametype sounds are extremely easy to create with a tool like Audacity and common household objects
If you want to use Sound in a game you create either a SoundEffect object or a SoundEffectInstance object, drop your audio file in then content project, load it with the content pipeline Content.Load<SoundEffect>(“TheNameOfTheSoundEffect”)() just like with textures.
The difference between a SoundEffect and a SoundEffectInstance is that a SoundEffect is fire and forget, i.e. you call Play on it, and then when it is done playing it stops. With a SoundEffectInstance you can loop, move back and forward, pause etc. so it depends a little what you need it for, i.e. just for a sound effect or for background noise. You can have 16 sounds playing simultaneously, but I really wouldnt recommend it unless you want to drive the player crazy
Levels, achievements, instructions and PowerUps
In Bizzy Bees there is a marathon mode which is basically what we have been coding up here, and then there is a story mode where you follow a path through the seasons. The story gets progressively harder, as more and more flowers and different powerups are introduced and the speed and the goal increases.
In order to make this easy to configure as I was testing out the levels, and also to be able to add new levels I created a level system using XML.
<LevelInfo xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”>
<LevelGroup ColorB=”245″ ColorG=”245″ ColorR=”245″ PosY=”93″ PosX=”36″ GroupName=”Winter” Major=”1″>
<Level HasQueen=”false” InitialVelocity=”0.5″ NumColumns=”3″ Minor=”1″>
<LevelFlower Color=”Red” IsNew=”true”/>
<LevelFlower Color=”Blue” IsNew=”true”/>
<LevelFlower Color=”Pink” IsNew=”true”/>
<Goal NumFlowers=”10″ IsTimed=”false”/>
Using this I can automatically generate the levels and also automatically generate the instruction screens that appear before each level with the goal, new powerups and new flowers. I liked this way of generating levels because it let me quickly test out new powerups etc. without having to play the game from start to finish each time.
I spent a long time testing out levels and different powerups on various people in my vecinity, mostly because as I was developing the game I was testing it so much and got so “good” at it that I had a hard time looking at it with a beginners eyes. Still I think that the levels aren’t perfect but at least they are better than they would have been without the user testing
For achievements, since I am not connected to XBOX live I decided to take the Star/Medal approach and let the user get a silver or a gold medal depending on how many lives they have left when they reach the goal. I like the achievements even if they are this simple because at least for me, it makes me play the game more times just to get that gold medal or extra star.
I also spent a bit of time calibrating it so that each round or attempt at marathon mode would be long enough to be interesting but short enough to be one of those games that kids can sit in the back of the car and take turns with.
Anyhow, I am far from a pro game developer but thought I’d share some of my thoughts and ideas on the subject… I would love to hear yours.
Hope you’ve had fun making the game… If you have written some of your own games, feel free to add them in the comments. Would be fun to try them out.
Have a good one