I am making a strategy game like Age of Empires. It's a pretty big project and I need a clear game structure.
I have defined a Game_Object
class with variables such as:
Hit Points
Speed
Damage
Range_Attack
...and a few functions to move the game object, load the game object to the screen, check collisions, etc.
Inheriting from this Game_Object
class are:
Building_Object
(It is buildings in the game to train soldier and villager)Dynamic_Object
(It is dynamic objects such as villager, soldier, elephant, bird
I have defined a Civil
class, it is a class about the country. It contains:
- a
std::vector<Game_Object*> GameObject
containing game objects - variables to store the number of resources
- a few variables about technology
- functions to check the amount of army units, villagers, houses
- a few functions to check collisions, update the game objects, move game objects
I have defined a Civil_Computer
class, which inherits from my Civil
class. It has a few functions to control the nation of the computer opponent.
I also have defined a Manager
class, to load the map to the screen, load image, manage game objects, etc. It has std::vector<Civil*>
containing the nations of AI and human players, a few function to initialize the game window, check winning, load game object to the screen, etc.
Finally, I have a header file to define many functions such as Move_Object
, Check_Alive
, etc.
Can someone suggest to me a clearer structure?
Building_Object
andDynamic_Object
classes is discouraged nowadays, because how will you make an caravan object that can move and create villagers? (Age of Mythology ran into this problem with its "mirror towers", which are actually dynamic objects whose speed is set to 0, and some custom levels give them a non-zero speed, leading to silly results) – user253751 Dec 02 '19 at 12:16