The following is specific to my problem, but I believe the principles can be applied to any game.
I am currently working on a 3D game which will have many different types of spaceships. The physics and behavior of the spaceships are controlled by a base 'Ship' class. This base class in turn derives from a 'Drawable Object' class which handles the transformations and drawing of the ship.
I want the spaceships to have a set of stats such as
- Max speed
- Cargo capacity
- Weapon power
that can be passed into the physics and behavior functions.
However, during gameplay new spaceships will be able to be bought/upgraded, but i want to be able to pre-define a (possibly large) list of setups that will be available to the player.
What is the best way to store the available stat setups?
Should I be using a large JSON/XML file or similar to store the stats which is loaded at runtime? Or might I just as well hard-code the stats into the constructors of a set of derived classes?
The actual physics attributes (location, velocity etc) and its stats of a particular spaceship are being saved to file when the game is actually played.
I have researched about entity-component-system architecture, but I haven't found much about how to define these entity stats.
Any advice on improving my entity architecture would be much appreciated - this is one of my first attempts at hobby game development.