I have three ways of providing the army classes with a way to read the master database. When an army gets a unit, it copies the unit's info out of the database. I have several other classes, basically armies, that contain a number of units. It's meant to be a read-only reference for use by the game systems. I am also not extending or modifying any of the classes stored in the HashMap. This database gets built once, when the program starts, and doesn't change. When the game spawns a new unit, it copies the unit out of the database, using the unit's name to locate it in the HashMap. The database is just a class containing a HashMap that stores a couple of dozen class instances containing individual unit types' stats. I have a java game I'm writing where I need a master database of unit archetypes.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |