In my game, I have an enumeration (about 200 entries) with different GameEntityType s.
When the game is saved, only the GameEntityType array is written to the save file.
To restore the game world and display various information about GameEntityTypes I need to have a list of a few more additional details (constant values). This means that each GameEntityType has other values ββassociated with it. These values ββare available very often in each frame. My goal is to have an easy way to get all the additional information from the GameEntityTypeID (enumeration). For example, when I read 0x1 from the save file, I can just access the name and all the other information that is implied with a number / listing from an array like this: "Constants.TextureList [ GameEntityType ]", will return the string "Stone_Texture.DDS"
An example of additional / related information of the first listing entry:
Types: string , string, Flag-Enum: "Visual-Classification" , bool , bool Values: "StoneBlock" , "Stone_Texture.DDS" , 0x0102 , false , true
My first approach to this is to create a static GameEntityTypeInfo class, which for each additional type of information was a member like the following:
public static const string [] = {"StoneBlock", ... [more entrys] };
Of course, this is a terrible decision, because I cannot just add GameEntityType wherever I want, without updating all the other lists. I also have to separate the logical units in data type units (which is a problem! Because when I decide that I no longer need a specific EntityType, I need to go through more than 6 lists!)
Then I tried to solve this problem by creating a structure from these datasets and adding them to a static array. But creating a list with additional information, while the constructor (while the game starts) still does not seem to be the best solution.
Question: How to create fast (search by name / classification each frame will be used at least 5000 times) and easy access (preferably with indexers) to these constant values?
A search like this would be the best "Constants.TextureList [ GameEntityType ]"