openrw
openrw copied to clipboard
Make engine able to read internal values from external config files
Actually, there is a ton of hardcoded values that may vary from different games.
In the long term, we may have to modify the engine to get it modulable enough for other games to fit (ie: GTA VC, GTA SA...)
Good example:
animations.sprint = engine->data->animations["sprint_civi"];
could be:
animations.sprint = engine->data->animations[gameConfig.animations.sprint]; //Where gameConfig is a class and animations is a map with the values, aka the name of the anim.
I know this may be a bad example, for multiple reasons, but I think the idea has been described good enough.
I've done some work on this in a branch. I've stuck to precompiler defines for now because otherwise some things get really nasty.
The lookup table approach you are proposing wouldn't work in a lot of places.
I've also talked to dan and we concluded something with templates and clean if
checks should be ideal for runtime configuration.
We should not change any of our code to accommodate behaviour like this yet. Precompiler defines are easiest for now and allow us to get-things-done. Refactoring later on should still be easy enough.
In the worst case possible we'd compile multiple times with different configuration and select code paths at runtime.