Gillius's Programming

I recently emailed back a response to someone asking about the class hierarchy in Itana. Here is most of that message that I thought might be useful for others. If you would like to know more about something, ask, and I'll try to expand this document if I'm not too busy.

 

Entity is the base class for all game objects and has information shared by all objects, which mainly consists of taking up some space on the map. Collisions are detected with this class

Effect is the base class for all non-game (ie cosmetic) objects, so they are aren't in the collision detection. Various subclasses of Entity represent the various effects like explosions and such.

Entity has subclasses that extend to something more than just having position. MovingEntity objects have a velocity in addition to position, and OrbitingEntities (like Base and Asteroid) orbit the planet. All MovingEntities know how to "move themselves" and are affected by gravity from the planet.

Ship entities are a subclass of MovingEntities, and add the concept of control input, like from a keyboard or from the network, or from an AI (if computer opponents were added). Most of the ship code is here -- the subclasses of Ship like AlsettiShip only contain the few differences between the ships, mainly their special abilities and firing options.

The bullets and things that are shot are also MovingEntities, and since they are also an Entity they are collision detected with Ships and OrbitingEntities and such.

There are other stand-alone support units in GNE such as Game which controls the flow of the game and conducts the logic. The Video class abstracts the graphical interface from Allegro and keeps track of the dirty rectangles. The Sound class does a similar task for audio, and the Prefs class holds user options (mainly the current control set).

There are many classes dealing with the networking, but I won't get into those since I'm going to replace the networking component which is somewhat flawed, with GNE, the Game Networking Engine. I am working on GNE right now.