F6 Headless server entry point and smoke test #6

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

Depends on: F5

Add a --server entry point with command-line config for seed, port, and player and bot counts.

Acceptance

  • make smoke boots the server, runs 1,000 ticks, reports timing statistics and exits cleanly.
  • Non-zero exit on any script error.
  • Logs are structured and contain the seed so runs can be reproduced.
**Depends on:** F5 Add a `--server` entry point with command-line config for seed, port, and player and bot counts. **Acceptance** - `make smoke` boots the server, runs 1,000 ticks, reports timing statistics and exits cleanly. - Non-zero exit on any script error. - Logs are structured and contain the seed so runs can be reproduced.
claude added this to the v0.1 Foundations milestone 2026-11-09 05:26:04 +00:00
claude added the type/featurepriority/high labels 2026-11-09 05:26:04 +00:00
claude added this to the Tidewall v1.0 project 2026-11-09 15:00:04 +00:00
claude moved this to To Do in Tidewall v1.0 on 2026-11-09 15:00:20 +00:00
eric closed this issue 2026-11-10 01:07:42 +00:00
Author
Owner

Done in d9d4c04.

What changed

  • tools/godot.sh -- --server starts a headless dedicated server (src/app/main.gd → HeadlessServer). Options: --seed, --port, --players, --bots, --ticks, --unthrottled, --log-every. Unknown or malformed arguments are errors (exit 2), so a typo can't run the wrong match.
  • ServerLoop (RefCounted, no scene tree) adds players and bots, collects commands, steps the sim and times every tick. It runs at the real 30 Hz with the 5-tick catch-up cap, or back to back with --unthrottled.
  • Logs are JSON lines (start, progress, stats, stop, config_error), and every line carries the seed. With no --seed, the server picks one and logs it.
  • ErrorCounter (a Godot Logger) counts engine and script errors, so the server exits 1 after any of them.
  • WanderBot is a placeholder in src/bots/ that walks seeded headings, so the smoke run carries 24 players' worth of load until the v0.4 bots land.
  • --port is validated and logged, but nothing listens until v0.5. The start line says so ("listening": false).

Testing

  • make smoke (now part of make check): 1,000 ticks with 24 bots. Tick time on this host was min 140 µs, p95 147 µs, max 189 µs, none over the 12 ms budget. It reruns the same seed and checks the state hash matches, checks that a deliberate --fault=script-error exits 1, and checks that a bad command line exits 2.
  • SMOKE_REALTIME=1 SMOKE_TICKS=90 tools/smoke.sh took about 3 s, which confirms real-time pacing.
  • 13 new unit tests in test/server/ cover config parsing and ranges, timing stats and percentiles, bot movement and seed reproducibility. make check passes: 51 tests and 8 self-check fixtures.

Follow-up: SIGTERM kills the process with exit 143 and no stop line, because Godot doesn't hand the signal to scripts. Graceful shutdown belongs in hardening, and I've opened an issue for it.

Done in d9d4c04. **What changed** - `tools/godot.sh -- --server` starts a headless dedicated server (`src/app/main.gd` → `HeadlessServer`). Options: `--seed`, `--port`, `--players`, `--bots`, `--ticks`, `--unthrottled`, `--log-every`. Unknown or malformed arguments are errors (exit 2), so a typo can't run the wrong match. - `ServerLoop` (RefCounted, no scene tree) adds players and bots, collects commands, steps the sim and times every tick. It runs at the real 30 Hz with the 5-tick catch-up cap, or back to back with `--unthrottled`. - Logs are JSON lines (`start`, `progress`, `stats`, `stop`, `config_error`), and every line carries the seed. With no `--seed`, the server picks one and logs it. - `ErrorCounter` (a Godot `Logger`) counts engine and script errors, so the server exits 1 after any of them. - `WanderBot` is a placeholder in `src/bots/` that walks seeded headings, so the smoke run carries 24 players' worth of load until the v0.4 bots land. - `--port` is validated and logged, but nothing listens until v0.5. The start line says so (`"listening": false`). **Testing** - `make smoke` (now part of `make check`): 1,000 ticks with 24 bots. Tick time on this host was min 140 µs, p95 147 µs, max 189 µs, none over the 12 ms budget. It reruns the same seed and checks the state hash matches, checks that a deliberate `--fault=script-error` exits 1, and checks that a bad command line exits 2. - `SMOKE_REALTIME=1 SMOKE_TICKS=90 tools/smoke.sh` took about 3 s, which confirms real-time pacing. - 13 new unit tests in `test/server/` cover config parsing and ranges, timing stats and percentiles, bot movement and seed reproducibility. `make check` passes: 51 tests and 8 self-check fixtures. **Follow-up:** SIGTERM kills the process with exit 143 and no `stop` line, because Godot doesn't hand the signal to scripts. Graceful shutdown belongs in hardening, and I've opened an issue for it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: claude/tidewall#6