PunchablePlushie/godot-game-settings

Adding settings post-release

Closed this issue · 6 comments

Hello! First, thanks for making this plugin, it's amazing! Is it still under development / maintained, or is it abandoned?

To my main question: how does this work when you add settings post-release? For example:

  • Release v1.0 version of the game with "full_screen" setting
  • Release v1.1 version of the game with a new "window_scale" setting

My understanding is that the settings get copied over from the settings JSON file on first run; so if a user runs v1.0 of my game, they will have full_screen in their settings JSON. But when they run v1.1, what happens? Does GGS automatically merge the two JSON files, or add the new settings automatically? If not, is there some additional work needed, or something I can do on my side?

Hi there! Thank you and the 2.x version is not under development anymore. I'm currently working on the 3.0 version which is a complete overhaul of the plugin and should bring a much better experience for the user.

I haven't tested the plugin with the "adding settings post-release" kind of scenario myself (to be honest, it didn't even occur to me) so I'm not 100% sure if adding settings post-release will break the settings or not.
If I remember the code correctly, GGS 2.x checks the user directory for a save file and if it exists, then it'll load settings from it. If not, then it'll load the default values from the JSON file saved in GGS directory.
So if I'm not mistaken, adding new settings post-release is probably going to break the game if a settings data file already exists in the user directory (GGS won't check the updated settings with the new properties anymore and because the save file in the user's directory is old, it probably doesn't have the entries for the new settings which will crash the game when GGS tries to apply the settings).
One way to fix that is to add a version property and save that property to the JSON file in the user directory. Now every time GGS tries to apply the settings, it'll compare the game version with that version property and if they're not equal, then it'll just ignore that file and will load the default values. That's probably going to reset all settings back to default every time you update the game though, even if it's a minor bug fix.
So you can take it a bit further and instead of outright loading the default values for all settings, just check which setting entries don't exist in the user's save data and just load the default value for those.

I'm not sure if that solution will work or if it's the best solution but it's what I can think of right now. Hopefully it was helpful!
I'll definitely try to keep this in mind when developing the 3.0 update so thank you so much for bringing it into light.

When I handled this situation without Godot, I wrote merge code. As long as GGS requires you to keep default values for each setting, it just needs a bit of additional code: when loading a user's settings, look for any settings that are missing, and apply the defaults.

Is this something you will consider adding, given that 2.0 is no longer in development?

Yes. As mentioned I'll keep this issue in mind for 3.0.

Cool. Do you have a rough timeline for 3.0?

No, unfortunately. I'm fairly busy IRL right now and GGS is a simple side project so there's no deadline or development timeline I'm afraid.

GGS 3.0 automatically keeps track of the used settings. It adds any nonexistent entry to the save file and removes the unused ones.