DaemonEngine / Daemon

The Dæmon game engine. With some bits of ioq3 and XreaL.
https://unvanquished.net
BSD 3-Clause "New" or "Revised" License
306 stars 60 forks source link

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

Open illwieckz opened 3 years ago

illwieckz commented 3 years ago

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

While investigating #501 (_Make in_nograb and inmouse 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.

slipher commented 3 years ago

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.

illwieckz commented 3 years ago

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

slipher commented 3 years ago

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.

illwieckz commented 3 years ago

Then common.writeConfig should be marked as temporary…

necessarily-equal commented 2 years ago

Then common.writeConfig should be marked as temporary…

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

Related PR:

DolceTriade commented 2 years ago

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