Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize json #include handling #171

Open
pvutov opened this issue Feb 8, 2021 · 0 comments
Open

Optimize json #include handling #171

pvutov opened this issue Feb 8, 2021 · 0 comments
Labels
good first issue Good for newcomers

Comments

@pvutov
Copy link
Collaborator

pvutov commented Feb 8, 2021

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.
@pvutov pvutov added the good first issue Good for newcomers label Feb 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant