Friday, April 21, 2006

Revisiting the SpaceRocks! plan

A while back, I posted a project plan for my clone of the asteroid destroying game. In case you didn't notice, I changed the name from RockCrusher to SpaceRocks!. I'm going to review the plan here, and show my current progress.

I will reproduce the entire plan, and show the time I spent on each part. Some of this stuff happened months ago, though, so it's all just an estimation. Actual times will be in square brackets ([]).

Nominal Project Plan

  • 1 hour: Get Managed DirectX to display a black screen [.5 hours]
  • 2-3 hours: Design the class framework for the game [1 hour]
  • 2 hours: Develop classes for the player ship and the asteroids[1 hour]
  • 1 hour: Display the ship on the screen[3 hours] This task turned out to be frustrating. I missed two critical lines of code, and didn't tell DirectX that I was about to start drawing sprites. This caused Invalid Call errors when I rendered, and I couldn't tell what was causing the error. However, once I got the sprite problem worked out, I got asteroids on screen for free.
  • 1 hour: Display some asteroids (included in time above)
  • 3-4 hours: Design the physics simulation system [0 hours] I decided to strip the gravity from the game, as well as friction. I may add friction back in, but for now the only forces in the game are velocities and accelerations. The ship is the only object that feels any accelerations, the rest move at constant velocity.
  • 1 hour: Apply the physics engine to the ship[0 hours] Removed when I pulled out the above entry.
  • 1 hour: Apply physics to asteroids [0 hours] Removed when I pulled out the above entry.
  • 2 hours: Handle player input for the ship(DirectInput) [1 hour] This was a lot easier than I thought it would be. Currently, the game only supports keyboard control. I'd like to add mouse and joystick in the future.
  • 3 hours: Make the ship wrap when hitting the edge of the screen [1 hour] Once I got around to it, this was trivial. The code works for all game objects, including ships, bullets, and asteroids
  • 1 hour: Make asteroids wrap when on the edge of the screenCompleted above
  • 2 hours: Add a bullet class [1 hour] Since the bullet class inherits from the game object class, most of the code was trivial. The artwork is still subpar for the bullet, though.
  • 1 hour: Get ship firing bullets [2 hours] This took a little while to get right. There are still some tweaks to be made to bullet offset and velocity.
  • 2 hours: Make bullets his asteroids [2 hours] Since most of my objects are easily approximated with spheres, collision detection is incredibly simple. This collision detection handles bullet to asteroid collisions, and asteroid to ship collisions.
  • 1 hour: Make asteroids explode when their damage threshold is reached [.5 hours] The code to kill the asteroid was pretty easy. The harder part was splitting it, which I did at the same time. The time for splitting is further down the plan, though.
That's already 28 hours of work. [There were 13 hours to get to this point in the game's development. I was way ahead of schedule, in development time. I thought that the actual elapsed time would be shorter, but I got discouraged a couple of times, and took some time off to get away from it. Now, the code is flowing.]

At this point, I should have a playable game, v0.5

For the next version, 1.0:
  • 2 hours: Add scoring [1 hour]
  • 2-3 hours: Add sound effects [v1-1 hour][v2-2 hours] In progress, with about an hour to go
  • 2-4 hours: Add levels [2 hours] during this time, I also worked on the code base a bit, cleaning things up, and tweaking the constants
  • 1-2 hours: Make the asteroids break into smaller asteroids when you blow them up(this should be a random choice) [2 hours] This was tricky. I created a couple of events in the code to handle this, and that caused some problems, because the events were firing at funny times during the game cycle. In hindsight, I should have just taken care of this as part of the updating phase of each frame, instead of using events
  • 4-5 hours: Add alien spaceships that can shoot back once you reach a certain level
  • 2-3 hours: Give the aliens some AI
  • 1-2 hours: Track a high score board [2 hours] I wrote a class in my game engine that can track high scores, as well as persist the scores. There is a helper class that represents a score. This class should be useful for all games, and is fully code-covered (I used TDD writing it)
  • 2-5 hours: Implement a particle system, and provide particle-based thrust effects during player maneuvers I removed this feature. I just can't get it to work. I think there must be some incompatibility between rendering with sprites, and adding in PointSprite rendering. [6 hours] I finally got this feature to work. I'm pretty pleased with the final results.
  • ? hours: Improve artwork
  • 10 hours: Finish UI work (high score board, menus, help, etc)
That's another 19 hours, for a total of 37 estimated hours.
So far, we are in really good shape for time. I'm about 15 hours ahead of schedule, and could, with only a little embarassment, publish the game to friends and family now. There's a lot of polish still to be added, but the basic gameplay is complete.

Where do we go from here?
The next step is to iron out the bugs remaining in v2 of the sound control classes. I'm trying to add support for multiple instances of the same sound playing at the same time. This is a little tricky in DirectSound. I can handle multiple sounds, as long as they are from different .wav files. If you fire twice in succession, though, you only hear the first shot sound.

After that, I should be able to breeze through most of the items left for v1 of the game, and then I will be publishing it. Once I get the sound fixed, I will post an alpha version of the game, so you guys can check it out and let me know what you think.

[Edit: fixed a couple of places I was missing strikeouts.]
[Edit: I'm going to keep this entry up-to-date, so I marked off the sound time]
[Edit: added particle system and thrust effect feature]
[Edit: added task for UI work]


Jason Olson said...

That sounds like fun Cullen. Can't wait to see it in action :). Keep us posted :).

ZMan said...

When its finished drop me an email and I'll make you famous (well as famous as a managed directx developer can be) on