Page 1 of 1

[ZScript] Manual config save function

Posted: Wed Oct 09, 2024 7:39 am
by kevansevans
As GZDoom is used more and more for increasingly grandiose projects, I feel there will be growing needs to ensure that custom data stored in the gzdoom.ini config needs to be reliably saved. Currently, the only way to ensure a custom cvar saves with its respective data is for the user to manually close GZDoom in some fashion. However, if GZDoom crashes, any changed data that would get saved is lost entirely, which is a situation I’ve ran into with one of my current projects. While it is my responsibility to make sure my creations don’t crash, I definitely don’t want my players having to lose any major progress they’ve made. Being able to manually save the config would be a great way to keep that data persistent.

Re: [ZScript] Manual config save function

Posted: Wed Oct 09, 2024 11:35 am
by Blue Shadow
In the Options menu, there's a command that is called "Save current settings".

Re: [ZScript] Manual config save function

Posted: Wed Oct 09, 2024 11:39 am
by Rachael
I think there are two sensible approaches to this that may work, besides what Blue Shadow already said:

1) Automatically save the config every time a game save is triggered (including auto saves)
- or -
2) Automatically save the config every time the options menu is closed

Re: [ZScript] Manual config save function

Posted: Wed Oct 09, 2024 3:17 pm
by kevansevans
Having it save from a menu is not what I need. I'm using CVARS to store info that is save agnostic and modified across several places in game, not in an options menu. Instructing my players to open and close a menu, with maybe hitting a setting, to ensure this data is saved correctly is pretty backwards. Having it write the new config when a save is performed is a good approach, however I don't want to have the player end up with a deadman save. Saving the config on a save game should be implemented regardless, but I need to save the config specifically.

Re: [ZScript] Manual config save function

Posted: Fri Oct 11, 2024 4:17 am
by Blue Shadow
To be honest, as a user, I don't like the idea of mods having the capability of writing something to disk at will, even if it is just saving the config that we're talking about here.

Another thing, using CVARs to store "data" is just wrong. I get it, there isn't another way currently, but it doesn't mean CVARs are the right way.

Re: [ZScript] Manual config save function

Posted: Fri Oct 11, 2024 7:09 am
by kevansevans
Mods can already write stuff to your system just fine as is, and plenty of mods use custom CVARS.

If you’re that concerned about doing it “””correctly”””, then I would more appreciate the ability to create my own save files that are readable/writable at a whim. Which means the ability to write to your system.

Either way, the engine needs a way to reliably save custom data. Offering a function to make the config be saved whenever will not affect any perceived security concerns that already exist.

Re: [ZScript] Manual config save function

Posted: Tue Oct 15, 2024 1:16 pm
by kevansevans