Daemon icon indicating copy to clipboard operation
Daemon copied to clipboard

The need for an option to not store modified cvars (even archive ones)

Open illwieckz opened this issue 4 years ago • 4 comments

Doing /set cvarname cvarvalue archives the cvar even if the cvar does not have CVAR_ARCHIVE flag

While investigating #501 (Make in_nograb and in_mouse temporary cvars?) I was like “but wait, but if someone does ./daemon -set in_nograb 1, this will not be archived and then not stored… This is true, unless the user has experimented with it before and did:

/in_nograb 1
/in_nograb 0

Which is like doing:

/seta in_nograb 1
/seta in_nograb 0

Then those cvars become flagged as CVAR_ARCHIVE ones and a benchmark software doing ./daemon -set in_nograb 1 would disable grabbing forever, and because the cvar would be flagged as archive one because of prior experimentation, the benchmark would break the game in the back of the user.

Benchmark may want to use specific home path to not mess with user config, this is what the Phoronix Test Suit does, which is right.

Anyway, by benchmark, we may refer to a special crafted set of command we may give to an user to test some stuff for us, so good practices for third-party benchmark does not defeat the need to set temporarily a value to a cvar that is marked as archive, especially when wanting to benchmark or do some test on an existing user config.

So I suggest the sett command that would set a temporary value to a cvar. So, the trick is that the temporary flag would be temporary itself, so setting a temporary value would not remove the archive flag to a cvar an user would have set. The only effects of /sett would be to set a value that would live until the game quit, but would never be stored, and would never change the cvar kind. We may need another flag that is not CVAR_TEMP then.

illwieckz avatar Jul 09 '21 07:07 illwieckz

Related: https://github.com/Unvanquished/Unvanquished/issues/499.

I feel that implementing this would not be worth it because it adds a crazy amount of complexity to the cvar system. As a saner alternative, I propose a -nowriteconfig flag which would disable writes to autogen.cfg and keybindings.cfg.

Also we should have a command to set all cvars to the default value. Apparently there used to be one called cvar_restart but it was removed. This would be more convenient than deleting autogen.cfg to clean up unwanted settings.

slipher avatar Jul 09 '21 09:07 slipher

A -nowriteconfig option is also a good idea, maybe a better one, that would also take care of resolution change and things like that.

illwieckz avatar Jul 12 '21 08:07 illwieckz

I remembered there is the -resetconfig command line flag. This is sort of an alternative to cvar_restart, except it also clears binds, and only works on startup.

Anyway, -resetconfig -nowriteconfig could be an interesting combination. Run as if from a clean configuration, but without wiping your current one or having to create any temp dirs.

Probably it should be a cvar rather than a flag, so really -set common.writeConfig 0.

slipher avatar Jul 12 '21 17:07 slipher

Then common.writeConfig should be marked as temporary…

illwieckz avatar Jul 12 '21 17:07 illwieckz

Then common.writeConfig should be marked as temporary…

It should already be temporary if you don't write the changes 😃

Related PR:

  • https://github.com/DaemonEngine/Daemon/pull/733

necessarily-equal avatar Nov 09 '22 20:11 necessarily-equal

Seems like this is a common trend: Note that I wrote: https://github.com/DaemonEngine/Daemon/commit/fc7e9d5a0b60ecb0caac849a1d42987b8ff36425

DolceTriade avatar Nov 10 '22 03:11 DolceTriade