feat(*): Add exported Linux binary training path for faster parallel instances

This commit is contained in:
Josh Creek
2026-07-28 20:56:14 +01:00
parent 4408ec3ecd
commit 01dbfc7ede
10 changed files with 179 additions and 11 deletions
+24 -8
View File
@@ -19,10 +19,27 @@ TRAINING_SCENE = "res://scenes/training.tscn"
class CosmicClashEnv(GodotEnv):
"""GodotEnv that launches `godot --path Game res://scenes/training.tscn`."""
"""GodotEnv that launches either the project from source or an exported binary.
# env_path is a Godot binary, not an exported game: skip the suffix and
# platform checks stock GodotEnv applies to exported executables.
Source mode (default): `godot --path Game res://scenes/training.tscn` — the
positional scene argument overrides the project's normal main scene.
Exported mode (`exported=True`): `env_path` is a pre-built game executable
(see training/export_linux.sh, "Linux Training" preset) — no `--path` and
no scene override needed or possible: official Godot export templates have
path/scene overrides compiled out (`--scene`/a positional scene argument
hard-aborts with "compiled without support for path overrides"), so the
binary instead boots straight into training.tscn on its own via
project.godot's `run/main_scene.training` feature-tag override, activated
by that preset's `custom_features="training"`.
"""
def __init__(self, *args, exported: bool = False, **kwargs):
self.exported = exported
super().__init__(*args, **kwargs)
# env_path is a Godot binary (or, in exported mode, a game executable we
# built ourselves), not a stock godot_rl exported-project path: skip the
# suffix and platform checks stock GodotEnv applies to those.
def _set_platform_suffix(self, env_path: str) -> str:
return env_path
@@ -32,11 +49,10 @@ class CosmicClashEnv(GodotEnv):
def _launch_env(self, env_path, port, show_window, framerate, seed, action_repeat, speedup, **kwargs):
# sync.gd reads --key=value pairs from the raw command line; they must
# NOT go after a `--` separator or OS.get_cmdline_args() drops them.
cmd = [
env_path,
"--path",
str(GAME_DIR),
TRAINING_SCENE,
cmd = [env_path]
if not self.exported:
cmd += ["--path", str(GAME_DIR), TRAINING_SCENE]
cmd += [
f"--port={port}",
f"--env_seed={seed}",
]