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:
2026-11-12 05:35:32 -05:00
co-authored by Claude Opus 5.5
parent 8cf164d562
commit 1d6a24ab64
38 changed files with 1633 additions and 15 deletions
+4 -4
View File
@@ -229,7 +229,7 @@ func _stop() -> void:
func _drop(sim: Simulation, grid: NavGrid, world: BotWorld) -> PlayerCommand:
state = "drop"
if _landing < 0 and not world.markers.is_empty() and sim.drop != null:
var rng: RandomNumberGenerator = sim.rng.stream("bots")
var rng: RandomNumberGenerator = nav.stream(sim)
var a: Vector2 = Vector2(sim.drop.start.x, sim.drop.start.z)
var b: Vector2 = Vector2(sim.drop.finish.x, sim.drop.finish.z)
var near: Array[int] = []
@@ -365,7 +365,7 @@ static func _weapon_score(me: SimEntity, slot: int, distance: float) -> float:
func _update_aim_error(sim: Simulation) -> void:
if (sim.tick + player_id) % Tuning.BOT_AIM_WANDER_TICKS == 0:
var rng: RandomNumberGenerator = sim.rng.stream("bots")
var rng: RandomNumberGenerator = nav.stream(sim)
_aim_error_goal = Vector2(rng.randf_range(-1.0, 1.0), rng.randf_range(-0.5, 0.5)) * _aim_error_degrees
_aim_error = _aim_error.lerp(_aim_error_goal, 0.25)
@@ -400,7 +400,7 @@ func _combat_move(sim: Simulation, grid: NavGrid, me: SimEntity, target: SimEnti
to /= gap
var wanted: float = minf(clampf(def.range_full * 0.8, 5.0, 30.0), _fire_range(def) * 0.8)
if sim.tick >= _strafe_until:
var rng: RandomNumberGenerator = sim.rng.stream("bots")
var rng: RandomNumberGenerator = nav.stream(sim)
_strafe = -_strafe
_strafe_until = sim.tick + rng.randi_range(TICKS / 2, TICKS * 2)
var side: Vector2 = Vector2(-to.y, to.x) * _strafe
@@ -758,7 +758,7 @@ func _hunt(sim: Simulation, world: BotWorld) -> void:
var arrived: bool = _goal_set and nav.status != NavBot.MOVING
if not _goal_set or arrived or sim.tick >= _hunt_until:
var phase: int = sim.tide.phase_at(sim.tick) if sim.tide != null else 0
_hunt_goal = world.random_safe(sim.rng.stream("bots"), phase)
_hunt_goal = world.random_safe(nav.stream(sim), phase)
_hunt_until = sim.tick + 40 * TICKS
_go(_hunt_goal, 4.0)
else: