Hey fellow programmers,

So, you have this game in your head since the 90s. You played it twice on an Amiga and was never able to win...

Many moons pass and you finally decide you're gonna do the game yourself. You've been thinking about it for so long you think you can remember all the stuff that needs to be done.

You've been a programmer of other stuff for so long that you feel confident you can pull this off. But, since you never programmed a game, just read a lot about the basics of getting one off the ground, you go really slow and over think A LOT!!

You finally bite the bullet and have all the classes you think you'll need all laid out in code. You structure the code to be your future programmer self friendly and, also, over think it A LOT...

AND you get stuck on a basic thing... How to manage resources, ARGHHH!!!

Well it's a bit more than that but this is the first hurdle that's beginning to eat out my resolve.

Ok, let's talk a bit about the game. It's not a game that most gamers are on to. It's all I like about Simulators and RTS. BUT, without all the things I hate, like the swift need to go to battle...

The whole game is on a solar system. I'm modeling it around our solar system, since the original game was also modeled around it. And besides, I'm doing this for the future self fun. I can't really waste time inventing names for planets and shit... And besides, naming things has always been our kryptonite...

You start on the third planet from the Sun, that's Earth... You have some resource gathering machines to start and they begin gathering them immediately.
You also have a limited tech library. This library will be "enbiggen" by both an R&D/University kind of building and from timed "random" archaeological finds.

The first thing you wanna build is a ship that allows you to build an orbital station. This orbital station will then allow you to build scouting ships, long range mining ships that will gather rare minerals from the asteroid belt, and finally ships that will make other orbital stations on planets that you previously scouted.

The original game's objective was to beat the Martians with a bigger amount of battle drones. You would have to manage resources and build drone ships fast enough before you triggered the Martian attack. You would be quite oblivious of that objective right until you triggered that attack because every scouting ship or other kind of ship would be completely lost without any clue of what happened.

Ok, onwards... I've done all my classes with the least inheritance possible since that would not be advised.

I have a Timed base class that is the father of all things that needs time to build.

I have a Game class that I'm thinking will have most of it's mechanics. Unless I see that it's unmanageable or you guys send me elsewhere.

I then have a Planet (singular) class that will contain the resource numbers. I also have a Planets (plural) class that is a basic wrap around a FPObjectList with a custom Enumerator. It manages the many planets.
This Planet (singular) class has a member for the resources, the buildings and the machines.

I have a Resource and Resources set of classes with, also, a custom Enumerator (I prefer the "for x in y" kind for cycle ). This manages groups of resources.

I have a Research and Researches class, ditto as above. This will be the container for the tech library. Yes it's quite basic and probably needs a bit more thought!

I have a Building and Buildings class, as above. The Building class is extended to make the more specific buildings like Storage or plural, Factory or plural and R&D/University.

Lastly I have a Vessel and Vessels class, as above. The Vessel class is extended to make the more specific classes that I've mentioned above: Scout Ships, Long Range Mining, Orbital Station, Orbital Builder, Cargo Ships.
I'm still stuck on how I'll attach the vessels to the other things. Like the orbital station to the planet and the cargo ships to the orbital stations upon docking and all that... But that'll have to be after the bloody resource management predicament I'm in, is resolved.

In terms of GUI, well, that's an after thought. My real pleasure is to manage the whole thing. Make plans with the small resource count or just wait and then go on a splurge. I'm doing it as detached from GUI as I can, since I'm also planning a server side.

ATM I'm just gonna use good old Buttons, Edits, Drop-Downs, Grids and all the basic widgets from a windowed system. If I see any interest in having a proper game engine with 2D or 3D stuff, that will be another post requesting more guidance

I know I should be thinking of a way to avoid race conditions/data loss and all that between the game class and the GUI. One thing at a time. I wanna focus on game mechanics first, then I'll figure out how to peek and mod the data inside the game environment safely.

First Question: Apart from the contained classes on those lists have a pointer to the planet class how should they "know" about each other?
Second Question: Should I implement a messaging system? If so, could you direct me to a good one that can be thread safe? I know that this answers Q1 but I'm stuck. The over thinking again...
Third Question: What's a good model for game time. I'm a bit stuck on this model, since I'm thinking about "pause", so storing TDateTime with system time will not work.
Four Question: This is where I'm stuck, so I'll ask: Can you guys give me links, docs, and other stuff on the most basic resource management algorithms, so I can figure it out?

Sorry for such a lengthy post and I appreciate and thank you from the bottom of my heart if you could get me unstuck!!

Cheers,
Gus