Hey guys,

Lately I have been doing a substantial amount of work on an RTS game which I simply call "wargame."

2 years ago before I went to Italy I had a large amount of the project done, and I was quite happy with my progress. When I returned from Italy a few months ago, I took a look at my code, and I was kind of disgusted by it in many aspects.

I had done quite a bit of code commenting, so after 2 years I was able to come back and understand my code with ease, so that was not the problem. The main problem I was having were some memory leaks that I had not resolved 2 years earlier, and I had let myself become a little sloppy in my coding in some respects.

Taking all that into account, I decided to start anew, but I did not want to lose all of my previous work. Therefore I am coding everything from scratch, but I am using the old project almost as a template for the new project (minus all the grevious mistakes I made in memory management and sloppyness 2 years ago).

Anyways, this game project is not meant to be graphically amazing in any respects. I am using simple 2D SDL (no OpenGL). So the graphics are not extremely difficult. I just finished the large part of the graphical subsystem, in fact.

Now I am turning myself to work on other things in the project. I was having some questions about the design in particular, that I wanted to run by you guys.

Question 1: A game clock

I have been contemplating the idea of a universal game clock. Almost like the CPU clock which synchronizes the timing of events happening inside of the CPU, I was thinking about making a class that interfaces with the system clock, and this class would synchronize all events that happen in the game.

In past gaming projects that I have done, I have done all my synchronization based on the frame rate. The graphical frame rate was basically the clock on when things happened. Such and such thing would happen 10 frames after the other thing happened, etc.

I decided this probably isn't a good idea...even if I used a technique to give an upper bound to the frame rate.

What kind of things do you guys implement in your own game projects concerning this subject?

Question 2: The entity heirarchy

I was designing a lot of the class layout: how each class is related to other classes in the project. The latest thing I was working on is the entity heirarchy. This is my current plan:

Base Class: ENTITY

class ANIMATE_ENTITY derives from ENTITY
class INANIMATE_ENTITY derives from ENTITY

class RESOURCE derives from INANIMATE_ENTITY
class EDIFICE derives from INANIMATE_ENTITY

the list of things that would derive from ANIMATE_ENTITY has not yet been created.

What do you guys think of that particular structure? Or more in particular, how have you structured entities in your own projects?