M1 Match state machine #24

Closed
opened 2026-11-09 05:27:05 +00:00 by claude · 1 comment
Owner

Depends on: W7

Lobby, countdown, drop, play and results, all server-driven, with configurable player counts and timers.

Acceptance

  • Tests cover every transition, including players leaving at each stage and an empty match.
  • The server returns to the lobby and starts a clean new match with no state leak across 10 consecutive matches.
**Depends on:** W7 Lobby, countdown, drop, play and results, all server-driven, with configurable player counts and timers. **Acceptance** - Tests cover every transition, including players leaving at each stage and an empty match. - The server returns to the lobby and starts a clean new match with no state leak across 10 consecutive matches.
claude added this to the v0.4 Match Loop and Bots milestone 2026-11-09 05:27:05 +00:00
claude added the priority/hightype/feature labels 2026-11-09 05:27:05 +00:00
claude added this to the Tidewall v1.0 project 2026-11-09 15:00:07 +00:00
eric referenced this issue from a commit 2026-11-12 01:24:05 +00:00
eric closed this issue 2026-11-12 01:24:05 +00:00
Author
Owner

Done in c6f3c19.

What changed

  • src/sim/match.gd: Match runs lobby → countdown → drop → play → results → lobby, one step() per server tick, no scene tree or clock. The next match's Simulation (and island) is built when the lobby opens, so nothing carries over.
  • src/sim/match_rules.gd: max/min players, team size, lobby/countdown/results timers (defaults Tuning.MATCH_*), bot fill. MatchRules.immediate() skips lobby and countdown.
  • Participants are server-chosen handles. A join during a match waits for the next one; leaving during the drop or play records the leaver as eliminated in place. Placements, winners (last team standing, so duos work once M7 lands) and events for every transition.
  • Match 0 uses the server's seed; later matches derive theirs from it and the index.
  • ServerLoop now drives a Match; bots fill every match and are rebuilt each time. The smoke run's state hash is unchanged, which shows the refactor didn't alter the match. The headless server logs match events and counts ticks across matches.

Tests (make check passes: 271 tests, self-check, smoke p95 0.66 ms with 24 bots)

  • test_match (13): empty lobby waits; lobby wait and full-lobby countdown; leaving in lobby and countdown; drop → play when the barge finishes; last one standing with places; leaving during drop and play; everyone leaving (no winner); empty match; leaving during results and joining mid-match; teams; 10 consecutive matches, each checked tick 0, no placements, only its own players and loot, entity IDs from 1, a distinct seed, and a state hash identical to a freshly built simulation for that seed.
  • test_server_loop: the server returns to the lobby and starts the next match with bots rebuilt.

Follow-ups

  • The tide isn't driven by the match yet; that's M2 (#25). Spectating and the results screen are M3.
  • No server CLI flags for the timers yet; the headless server uses immediate rules. Worth adding with N7.

— tidewall-build

Done in c6f3c19. **What changed** - `src/sim/match.gd`: `Match` runs lobby → countdown → drop → play → results → lobby, one `step()` per server tick, no scene tree or clock. The next match's `Simulation` (and island) is built when the lobby opens, so nothing carries over. - `src/sim/match_rules.gd`: max/min players, team size, lobby/countdown/results timers (defaults `Tuning.MATCH_*`), bot fill. `MatchRules.immediate()` skips lobby and countdown. - Participants are server-chosen handles. A join during a match waits for the next one; leaving during the drop or play records the leaver as eliminated in place. Placements, winners (last team standing, so duos work once M7 lands) and events for every transition. - Match 0 uses the server's seed; later matches derive theirs from it and the index. - `ServerLoop` now drives a `Match`; bots fill every match and are rebuilt each time. The smoke run's state hash is unchanged, which shows the refactor didn't alter the match. The headless server logs match events and counts ticks across matches. **Tests** (`make check` passes: 271 tests, self-check, smoke p95 0.66 ms with 24 bots) - `test_match` (13): empty lobby waits; lobby wait and full-lobby countdown; leaving in lobby and countdown; drop → play when the barge finishes; last one standing with places; leaving during drop and play; everyone leaving (no winner); empty match; leaving during results and joining mid-match; teams; **10 consecutive matches**, each checked tick 0, no placements, only its own players and loot, entity IDs from 1, a distinct seed, and a state hash identical to a freshly built simulation for that seed. - `test_server_loop`: the server returns to the lobby and starts the next match with bots rebuilt. **Follow-ups** - The tide isn't driven by the match yet; that's M2 (#25). Spectating and the results screen are M3. - No server CLI flags for the timers yet; the headless server uses immediate rules. Worth adding with N7. — tidewall-build
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: claude/tidewall#24