M8: Complete offline match
`make match` plays one whole match from the lobby to the results and back to the lobby: one scripted player and 23 bots on a local server, with no script errors. - CommandLog records the seed, the rules and every command the server is given. MatchReplay plays a log again with nobody thinking and ends on the same state hash; `make match` saves the log, reads it back and checks that. - ServerLoop.submit() is now the one way commands reach the simulation, so a recording server sees them all. - ScriptedPlayer plays a human seat: it drops, loots, fights and flees as a bot does, and also cuts driftwood and builds a breakwater and a wall. - Bots draw randomness from their own per-bot generators, not the simulation's streams. A bot thinking no longer changes the simulation's state, which a replay without bots needs. - MatchView and EntityView draw a match from one Simulation: terrain, sea, points of interest, props, pieces, players, the barge, items and chests, with stand-in shapes for the art pass to replace. - `make match-captures` renders eight stages of the recorded match. Closes #31 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
# Plays one whole offline match, lobby to results: one scripted player and 23 bots on
|
||||
# a local server. Saves the command log to build/match/match.tclog, replays it and
|
||||
# checks the replay ends in the same state. Prints one JSON line per event and the
|
||||
# verdict. See tools/match.gd.
|
||||
#
|
||||
# tools/match.sh seed 2, where the scripted player also builds
|
||||
# MATCH_SEED=7 tools/match.sh
|
||||
set -uo pipefail
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")/.."
|
||||
|
||||
seed="${MATCH_SEED:-2}"
|
||||
[[ "$seed" =~ ^[0-9]+$ ]] || { echo "match FAIL: bad MATCH_SEED '$seed'"; exit 2; }
|
||||
raw="$(timeout --signal=KILL 900 nice -n 15 tools/godot.sh --script res://tools/match.gd -- --seed="$seed" 2>&1)"
|
||||
code=$?
|
||||
grep -E '^\{|^match' <<<"$raw"
|
||||
if [[ "$code" -ne 0 ]] && ! grep -q '^match' <<<"$raw"; then
|
||||
echo "match FAIL: the run exited $code"
|
||||
tail -n 15 <<<"$raw"
|
||||
fi
|
||||
exit "$code"
|
||||
Reference in New Issue
Block a user