A life changing class that I recently took at DePaul University was the Architecture of Computer Games. The goal of this class was to learn and apply some very important software engineering practices. The use of game development as a tool to learn applied software engineering is very rewarding since game development projects tend to be big, challenging and have many performance and resource restrictions.
The target of this class was not to build the Space Invaders game using XNA, but rather, to build a complete and efficient game system that wraps and abstracts XNA completely, and is fully general purpose that it can be used to build any other game. Building Space Invaders was just to test this big game system.
Each student was required to work individually on his own project and submit a working recreation of the Space Invaders game and its source code that implements all of the software engineering, game architecture, and data structures principles discussed in class. Each student was also required to submit a full design document of his project that contains UML diagrams, justifications for design decisions, and code samples. Along with that a recorded video demo in which he demos his game was also required to be submitted. Here’s the video that I submitted:
Building my final project, I achieved the following:
- Learning and understanding XNA.
- All version control was done with Perforce.
- Building an Input Manager that wraps all needed XNA calls, and can handle user input from keyboard and game pad.
- It can record user input history up to a certain length.
- It can handle combos (multiple key presses in succession that correspond to a certain reaction).
- Building a Texture Manager that loads textures in a flyweight manner, and uses reference counting of textures.
- Building s Sprite Manager that can manage sprites of different types. Each sprite can be either static or animated from multiple textures or a sprite sheet.
- Building a Timer to handle all timed events in the game including animations.
- Building a generic 2D Game Object that move, animate, and collide with other objects.
- Building a Collision Manager that can efficiently detect collision of objects without having to walk all the objects on the scene graph. The collision detection doesn’t use any of the provided XNA calls, but instead it was implemented using bounding collision boxes that can be drawn in debug mode as a visual clue. Each object can have as many collision boxes as required to make the collision as accurate and efficient as possible.
- Building a Sound System that encapsulates and abstract all XNA and XACT and that can do everything programmatically.
Each student was required to use as many design patterns as he can. I used the following design patterns:
- The Singleton.
- The Flyweight.
- The Factory Method.
- The Observer.
- The Composite.
- The Visitor.
- The Iterator.
- The State.
Each student was required to create any data structures he needs. No C# Collections were allowed to be used. I implemented the following templated and iterable data structures:
- A Circular Queue.
- A Sequential Symbol Table.
- A Hashed Symbol Table.
- A Doubly Linked List.
- A Fast-Delete Doubly Linked List.
It was definitely a very rewarding class that helped me understand a lot about software design and architecture.