Original Post
I'm rethinking the implementation of my configuration system and I thought I'd fish for opinions and ideas. I haven't found much on gamedev.net about such systems, probably because their generally pretty simple. If you could give a general overview of how you manage your game-settings or cvars under the hood, it'd be very helpful. I've opted to use an explicit set of typed variables rather than something looser like a map of strings. The variables are global in the cfg namespace. Currently, each variable is wrapped in a transparent class which automatically updates the hardcopy of the config whenever the variable is changed via the assignment operator. In my refactoring, I'm aiming to support multiple layered "sources" of config data, including the registry, .ini files, and /etc/conf files. I'm considering switching to an explicit Update function which would commit the entire set of variables to hardcopy when called. Contrast this to the current system where every variable assignment causes a hardcopy update. Here lies the problem. Although the registry can easily perform incremental updates, files cannot. The entire file must be rewritten with even the slightest change. If you're changing many variables, the full commit Update function is more efficient (at least with the file system). If you're changing a single variable, the incremental assignment operator is more efficient (at least with the registry). If I'm supporting both of these hardcopy sources through the same interface, I need to favour one over the other. Which would you use?