This is a project for the game design and development class that I had in June. Students had to implement a 3d version of a classic game, using Gamebryo and Maya. Here me and James chose to do Asteroids. James did all the art, I did all the programming. We had a 3d model of the player’s ship, a model for the asteroids that was scaled according to the size of the asteroids, a big and a small enemy ship, a model for the missiles, and two different kinds of billboards. One for the stars, which gave a 3d feel to the environment, and one for the explosions.
When we got very close to the deadline, the game was playable but it didn’t have any sound or explosions. The explosions were something that we knew we should implement if we wanted a better game, so we were looking for ways to do that. We definitely didn’t have enough time to learn Gamebryo’s particle system, so we decided to use billboards. Basically an explosion is a quad that always faces the camera, and grows big and small very quickly. The quad’s texture has fire drawn on it, so the final effect looks like an explosion.
On the other hand, Gamebryo was supposed to come with Miles Audio System, so we thought that we could use that for sound. Nevertheless, our version of Gamebryo did not have this audio system so we all supposed that we would not implement sound, because the game was due the next day anyway… However, our professor told us to implement sound using FMOD, and everybody panicked because people had still not implemented basic features in their games and now they had to do sound as well. I also heard that a group was writing code for six hours, trying to implement the sound system using Miles Audio, and after these six hours they hit compile… Of course they found out that all this time they spent was lost without reason… I don’t understand how people can write code for hours and then try to compile their projects… I feel that code should be written in small units that can be easily tested, before going for the whole application. Anyway…
I was worried about the sound system too, but it turned out to be fairly straightforward. I think I finished it in 2 hours or something, and it worked pretty well. It’s true that sound really changes the feel of a game. If you are an amateur game programmer DO NOT NEGLECT SOUND! It totally changes things. Now we had missiles firing all over the place, aliens squealing, loud explosions…
While working on this project, I started using some ideas I had more systematically. First of all I started using the singleton pattern. However I only use it for managers. The sound manager, the game manager, etc. We shouldn’t overuse it. Also I understood inheritance better. The game is fully based on inheritance. There is a GameObject, and everything you see in the game inherits from GameObject. That was a very flexible system that is extremely extensible. This way I can add a new feature in the game in very little time – I just need to write an update function, a draw function, and a collision response function and we’re set. And this makes sense… You need to specify what the object is going to do in the game, how is it going to look like and what its behaviour is going to be when it collides with something. That’s the way we did explosions too. We just added a new GameObject and told it to grow and shrink in 2 seconds… Easy.