DoubleDeez / MDFramework

A multiplayer C# game framework for Godot 3.4 Mono.
https://discord.gg/UH49eHK
MIT License
77 stars 13 forks source link

Extend Config System to Support Hierarchy #72

Closed DoubleDeez closed 3 years ago

DoubleDeez commented 3 years ago

Right now the config files are part of the framework which makes it weird for someone to alter them as part of their game. To make this better, we should check for non-MD variants of the config files and use the config from those files instead, if available. To also make things easier to maintain, I think the Debug config should be used by default, but then is overridden by the Export config, so that users aren't required to duplicate data in both.

DoubleDeez commented 3 years ago

Just realized the merged solution doesn't support hierarchy, it only supports a single config file. All config files should be loaded and each individual settings should be checked for in the config files in order of precedence.

Beider commented 3 years ago

Alright I misunderstood this, will fix this

Beider commented 3 years ago

Alright I fixed this, I commited this on a new feature branch where I am going to also introduce recursive MDReplicatedMembers. I will push this fix along with that one. For now you can check it out here,

https://github.com/Beider/MDFramework/blob/feature/recurisvemdreplicated/MDHelpers/MDConfiguration.cs#L90

I made it so we load all configuration into an internal dicitonary for lookup, I also made the loading method public so it means you can call LoadConfiguration("somefile.ini") yourself from your code and it will be loaded into the same dicitonary. By default the load order is,

Now in theory you can load another configuration again after this and change features in the framework during runtime that way, assuming the feature isn't buffered (which it is in some cases for faster lookup).

DoubleDeez commented 3 years ago

I think we should probably make CustomMDConfigDebug.ini only apply if in debug and CustomMDConfigExport.ini otherwise. I realized it might be confusing for users if the "Debug" settings are applied for their exported builds

Beider commented 3 years ago

Alright I fixed this on the branch.