Hi,
I'm finishing a small game prototype with c++,
now still considering about game data for character attributes, levels/stages info, and saving game progress.
Currently for character attributes (like health, damage, size(width & height), weapon, shieldpower.. etc),
i put it directly harcoded in character class. Example:
class Foe1
{
public:
Foe1();
void Moving();
void Attack();
private:
int Size_W = 50;
int Size_H = 80;
int Max_Health = 200;
int Max_ShieldPower = 100;
int DamagePower = 50;
string WeaponType = "TypeA05";
}
also with Foe2, Foe3... have same attributes, but with different value.
For levels/stages info, i put into separate files (in xml),
so everytime to begin new level i will load the level attribute/info from my level01_data.xml, level02_data.xml... file.
My question:
** Is this ok to put all those harcoded attribute at class?
..or should i put the attribute value in separate data file, then load it when everytime creating a Foe instance?
** To save data in separate file, for char.attributes or game progress,
i'm considering to save those into encrypted files or using (maybe)a light-weight database tools.
Which method is probably better? (considering the balance of "runtime loading process" and "data management issue" )
This far my program run ok and smooth,
but somehow i feel my codes are bit crowded
To do modification at next month or 2 months again, i'm affraid to fix certain things may not simple.
Any opinions & suggestion are welcome, thank you..