Dream Build Play 2009
I managed to make the deadline for entering the Dream Build Play 2009 competition. The results are expected to be announced by the end of the month. Based on the quality of entries this year I’m not holding out a huge amount of hope of actually winning. Regardless, it was a great experience and I learned quite a bit in the process.
As part of the contest submission we wrote up a game description including play instructions and some comments on the technical design, as well as a video trailer. The video is below, and the documentation I submitted follows. Many of the other entries have posted videos in the Dream Build Play 2009 YouTube group. And you can see all of the contest entries in the Dream Build Play Gallery.
I still have a few more things to do on the game before I put it up for sale on the XBox, but I’m going to take a bit of a break before continuing on. I should have more time to update this blog as well. Thanks for reading – hope you enjoy the video.
The overriding premise of the game is to keep asteroids from hitting your planet, and alien ships from shooting it. Your planet will be damaged as it’s hit, and when the damage reaches the planet center the game is over.Â You’re competing for high score, with the top ten high scores are tracked locally.
You command a satellite that constantly orbits the planet.Â Pressing A fires your selected primary weapon from the satellite towards the red target indicator that you move with the left thumbstick to aim your shots.Â You have to be careful to time your shots so the planet isn’t in between the satellite and the target.Â Your main weapon is the Laser Canon and has infinite shots available.Â The Plasma Canon is more powerful and the shots move faster.Â The Rail Gun is an instantaneous kill, and will destroy anything in its path, including taking out a large portion of your planet if it’s in the way.Â You will receive large cumulative bonuses for killing multiple enemies with a single Rail Gun shot.Â Each primary weapon has a different charge rate which limits how often you can fire.Â As mentioned, the Laser Canon has infinite shots, but all other weapons require ammunition.
Pressing Y fires your selected secondary weapon.Â These weapons fire from the surface of the planet.Â Missiles will automatically target the asteroid or enemy ship closest to the red target – it takes a second or two for the missile to lock on.Â Nuclear Missiles will target the actual red target location, so you can fire them at a point in space and use the large blast radius to take out multiple targets.Â The BG4143 will destroy everything on the screen by sending out a shockwave with an ever increasing radius.
Alien ships will drop a powerup after destruction.Â You grab the powerup by moving the target close by and using X to activate the planetary tractor beam.Â The beam will slowly pull the powerup to the planet, after which it will be used or automatically added to your inventory.Â Powerups can add energy to your shields or primary weapon, add maximum shield/weapon energy, and increase shield/weapon charge rate. Powerups will also make ammunition available for the various secondary weapons.
You cycle your primary weapon by pressing the Right trigger, and cycle the secondary weapon using the Left trigger.Â The right shoulder button will generate a new background at any time, and the left shoulder button displays your current weapon inventory during game play.
Shields work on their own with no intervention.Â They will protect your planet for awhile but have a slow charge rate which can be increased by powerups.Â Once the shield power is used up asteroids or enemy fire will damage your planet.Â However the shield will continue to recharge as long as nothing is hitting it.
There are 32 asteroids in each wave, and 0 to 3 enemy ships.Â There are also bonus asteroids and comets that will move by your planet quickly.Â These can be difficult to hit, but you’ll receive a bonus score for destroying them.Â They will never hit your planet, but they do come in close enough to hit the satellite and destroy it.Â The asteroids and ships start out fairly slowly, but they speed up over time until they’re moving quite rapidly.
Development and Design
A limited version of Guardian was originally created for the iPhone, but I wasn’t happy developing on that platform so I made the decision to port it to XNA and XBox and add much of the functionality I had originally planned for the iPhone.
Most of the game uses basic 2D technology: Sprite sheets, particle systems, state machines, and the like.Â Collision detection is mostly accomplished through point-in-circle tests.Â However the planetary collision detection uses pixel tests since the planet is eaten away throughout the game.
Some of the more interesting technicalities are described in the following sections.
The background nebulae are generated using a pixel shader which uses fractal brownian motion and other procedural techniques to build a random cloud and star texture.Â Each time you see a new background it was generated in real time.Â The backgrounds can actually be animated at 60fps to get some very nice moving nebula effects, but combining it with the rest of the game dropped me down to 30fps.Â At some point I plan to optimize it some more.
It is also interesting to note that the backgrounds are generated entirely on the GPU and exist entirely in video memory.
The planets are also procedurally generated, and are actually 3D.Â The basic spherical structure is a cube, and a mapping function is used to move each vertex out to the sphere’s radius, and then the noise functions are used to add the height value.Â A second sphere is used for the ocean areas.Â Each time the game is started you get a new planet.Â In future versions I plan to allow regenerating the planet, as well as having different texture sets to allow for non-Earth type planets.
Generating the planet in 3D allowed me to show the planet rotating in the menu areas, with a seamless transition to the game play area by simply moving the camera out to the proper location using the SmoothStep function.Â The planet displayed during game play is still 3D, and can actually be rotated, but it looks kind of strange since the craters don’t move with it.
The craters are created by drawing one of several random crater sprites into a mask texture each time damage is done to the planet.Â The mask texture holds the cumulative result of each crater application.Â Before drawing the planet the mask is used to set the stencil buffer, then the planet is drawn with the craters masked out.