projectFieldWarning
projectFieldWarning copied to clipboard
Optimize json #include handling
Good first issue because no Unity-specific programming is involved.
Our unit config files allow a c-style #include directive, which lets us break them up into small reusable pieces. Example:
{
#include "DefaultMobility",
#include "DefaultHeloArmor",
"LabelIcon": "D",
"CategoryKey": "HEL",
"Name": "AH64D Apache",
"Price": 20,
}
ConfigReader.cs has some custom code which replaces the #include lines with the content of the corresponding json files (e.g. DefaultMobility.json). This code does a lot of string operations of what will be hundreds of files, and is part of our startup loading work.
There are optimization opportunities:
- Smarter iteration over the files (currently if a file is included from two places, we will scan it twice instead of just once)
- Baking the results - for example, once the includes have been replaced everywhere, save the 'assembled' json files in a generated folder and use them for future launches. If the user changes the unit config, they will need to delete the generated folder.