Skip to content

Pass --fixed-fps as two argv tokens - #263

Open
Eliasepfl wants to merge 1 commit into
edbeeching:mainfrom
Eliasepfl:fix-fixed-fps-argument
Open

Pass --fixed-fps as two argv tokens#263
Eliasepfl wants to merge 1 commit into
edbeeching:mainfrom
Eliasepfl:fix-fixed-fps-argument

Conversation

@Eliasepfl

Copy link
Copy Markdown

I have been building a personal project on top of godot-rl-agents, a harness that generates Godot games from text and trains a policy on each one to check it is actually solvable. Getting it to run at scale surfaced a handful of small bugs and rough edges in the library. This is the first of four PRs, all independent and small, mostly fixes and throughput things I needed. Happy to rework or drop any of them.

--fixed-fps is a Godot engine argument and expects its value as a separate token, but it is appended as one string:

launch_cmd.append(f"--fixed-fps {framerate}")

Popen receives argv as a list, so Godot gets a single unknown parameter --fixed-fps 60 rather than the flag and its value. On 4.7 the engine then gives up before starting the game:

$ Godot_v4.7-stable_linux.x86_64 --headless --path project --quit "--fixed-fps 60"
ERROR: Couldn't detect whether to run the editor, the project manager or a specific project. Aborting.

$ Godot_v4.7-stable_linux.x86_64 --headless --path project --quit --fixed-fps 60
(gets past argument parsing and runs the project)

So passing any framerate to GodotEnv currently stops the game from launching.

The fix splits it into two tokens. I also pulled the argv construction into GodotEnv._build_launch_cmd so it can be unit tested without a game binary, and added tests for the flag forms. Everything else keeps the --key=value shape the plugin parses.

--fixed-fps is a Godot engine argument and takes its value as a separate
token, but it was appended as one string ("--fixed-fps 60"). Popen passes
argv as a list, so Godot receives a single unknown parameter and aborts with
"Couldn't detect whether to run the editor, the project manager or a specific
project" instead of starting the game. Passing any framerate to GodotEnv is
therefore broken today.

The argv construction moves to GodotEnv._build_launch_cmd so it can be tested
without a game binary. Everything else keeps the --key=value form the plugin
parses.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant