Ball Race – Day 2

After finishing up the level parser with some minor tweaks and writing some unit tests which immediately highlighted several mistakes I then fixed, I began with the geometry building code.

The level file format is really easy and anyone should be able to create his own mazes. For example, this simple text file will be enough to have my game make a nice, textured 3D maze board of it:

###############
#O            #
# + +-+-+-+-+ #
# |    O      #
# + +-+-+ + +-#
# |       |   #
# +-+-+ + + + #
#     | | | |O#
#-+-+ + + + + #
#       | | | #
# + +-+-+ + + #
#F|       |   #
# + +-+-+ +-+ #
#        O|S  #
###############

After taking an in-depth look at the XNA model classes, I decided to build a special MazeModel class that would construct a model from a maze provided to it in its constructor.

That took most of day 2. While writing the mesh generation code, I noticed that my original idea with equally sized tiles and walls that only used a fraction of the tile they were on didn’t work out. But because I had already made the decision to limit the tiles walls can be on, it was not a drastic change to use alternating tile sizes.

Ball Race – Day 1

It took me some time to figure out how to organize my code so it fits in with the XNA framework design. Because the game is so small, I did this by building some dummy classes and that I renamed and moved around in the project tree until I had reached an adequate design.

Maybe some people would have used an UML prototyping tool, but I am used to thinking in terms of design and code, so, just like a good chess player, I can see when a design will work out or when it will blow up.

Then I identified the hardest, probably most demotivating task at hand. If you can, I think it’s always good to start there because this is likely the point where you would "postpone" working on the project for the rest of eternity.

The hardest part in this project seemed to be the dynamic construction of the level’s 3D model out of a simple text file that defines the maze using pure ascii characters. You have to create a bullet-proof parser and then somehow build a contiguous vertex array for all the walls, floor plates and holes in pure code.

So day 1 ended with me writing a parser for the textual level file format I have layed out before.

First (Free) XNA Game

Today, I started development on my first XNA game. It will be a rather simple game, the real-world version of which I once played in my childhood. This should allow me to get up to speed with the state of the art in 3D accelerated rendering again.

Because I have a job that requires me to sit in front of a PC for more than 9 hours a day, my interest in development at home is fading a bit. I hope this game will rekindle my interest for game development!

Back to the game, what I decided on is a simple game of balance where you have to carefully tilt the game board to maneuver a little ball around obstacles to the finish:

Schematic of a maze with traps in it

Because this is such a simple game, I will release it for free and in full, that means with all notes and its source code!