godot icon indicating copy to clipboard operation
godot copied to clipboard

Allow project settings to be overridden from command line via environment variables in debug builds

Open myaaaaaaaaa opened this issue 2 years ago • 4 comments

Environment variables are typically used to allow more flexible configuration handling when using the command line.

Examples:

# Force this run only to be single-threaded
GODOT_THREADING_WORKER_POOL_MAX_THREADS=1 godot args...

# Subsequent launches go back to being multithreaded
godot args...

# This will persist the environment variable until the command line session is closed
export GODOT_THREADING_WORKER_POOL_MAX_THREADS=1

# Because of the above command, all of these launches will now be single-threaded
godot args...
godot args...
godot args...

myaaaaaaaaa avatar Feb 03 '23 21:02 myaaaaaaaaa

Edit: Disregard the section below, as this PR only affects debug builds. Release export templates won't be affected by this PR.

I like the idea on principle. A --set "path/to/project_setting" "value" CLI argument was also proposed at some point (this argument could be repeated on a single command line).

However, there are likely some caveats. For instance, some designated project settings should not be overriddable with environment variables or --set. This is particularly the case for project settings that could be modified by players to cheat in some way, such as gaining a visual advantage over others. (While this can be done with modified engine binaries, it still increases the amount of effort required to cheat.)

If anything, it may be better to create a list of overridable project settings, and disallow overriding any setting that is not in the list.

Calinou avatar Feb 03 '23 21:02 Calinou

Should this be debug only or dev only?

RandomShaper avatar Feb 04 '23 08:02 RandomShaper