diff --git a/tools/autoplay-batch.sh b/tools/autoplay-batch.sh index e0a7cc6d..5f1e2b3b 100755 --- a/tools/autoplay-batch.sh +++ b/tools/autoplay-batch.sh @@ -22,6 +22,9 @@ # PARALLEL — Max seeds to run concurrently (default 1 = serial). # Remote runner is concurrency-safe via scoped pkill per AUTO_PLAY_DIR. # Apricot has 64 cores → PARALLEL=10 is a safe, ~10× wall-clock speedup. +# LAUNCH_COOLDOWN — Seconds to sleep between launching each parallel worker (default 0). +# Use 10–20 on memory-constrained hosts to stagger Godot init spikes +# so games never all peak-initialize simultaneously (prevents OOM crashes). # SEED_OFFSET — Shift the seed range from [1..COUNT] to [1+OFFSET..COUNT+OFFSET] # (default 0). Use for multi-sweep runs that share a parent # results_dir and need disjoint seed numbers (e.g. Task #10 @@ -70,6 +73,7 @@ AUTOPLAY_HOST="${AUTOPLAY_HOST:-}" REMOTE_BATCH_ROOT="${REMOTE_BATCH_ROOT:-/tmp/@magic-civilization/builds}" SAFETY_TIMEOUT=$(( TURN_LIMIT * 2 + 300 )) PARALLEL="${PARALLEL:-1}" +LAUNCH_COOLDOWN="${LAUNCH_COOLDOWN:-0}" # SEED_OFFSET shifts the seed range from [1..COUNT] to [1+OFFSET..COUNT+OFFSET]. # Used by multi-sweep aggregation (e.g. Task #10 B5 AI_PIN_PERSONALITY rotation) @@ -310,6 +314,7 @@ else wait -n 2>/dev/null || break done _run_one "$seed" & + [ "${LAUNCH_COOLDOWN}" -gt 0 ] 2>/dev/null && sleep "$LAUNCH_COOLDOWN" || true done wait fi