Files
tidewall/Makefile
T
claudeandClaude Opus 5.5 05c7568ec1 N8: 24-client network soak, and the server fixes it found
make soak runs a real server and 24 headless clients in three processes for
two whole matches in real time. Each client reaches the server through its own
UdpRelay, which adds 60 ms, +/-20 ms jitter and 2% loss each way, so ENet runs
unchanged over a bad link. SoakPlayer drives each client from what a client
knows: it drops, glides, heads for high ground, harvests and tries to build.
tools/soak_report.gd checks world hashes against the server's, errors,
unreadable packets, every client playing every match with its connection
intact, memory between matches, and the p99 tick with the network's share.
make soak-selfcheck proves a drifted client world is caught.

Server changes: --matches=N, --world-hash-every=N, tick timing that includes
after_tick, and memory in match and progress lines.

What the soak found and fixed:
- Snapshot building for 24 clients took the p99 tick to 13.8 ms, over the
  12 ms budget, against a 2.8 ms simulation. Encoded records are now shared
  between clients for the tick, unchanged records skip the field diff, and
  clients are spread over the snapshot interval by handle. p99 is 7.3 ms.
- ENet peers had a timeout limit of 0, which gives up on a peer as soon as any
  reliable message has waited the minimum timeout. Now ENet's default, 32.

Not fixed: one or two clients still lose their connection about 15 s into the
second match's drop in each run (see the issue), so the soak still fails and
N8 stays open.

Refs #39

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 21:56:01 -05:00

85 lines
3.0 KiB
Makefile

# Tidewall build entry points. Everything runs headless with the repo-local engine.
GODOT := tools/godot.sh
.PHONY: check import parse test test-selfcheck smoke capture-test terrain-capture binaries verify-engine bot-matches match match-captures client-check client-captures discovery-check fuzz soak soak-selfcheck
## Everything that must pass before a push.
check: verify-engine binaries parse test test-selfcheck smoke
verify-engine:
@$(GODOT) --verify
binaries:
@tools/check_binaries.sh
## Refreshes Godot's global class cache, so class_name lookups resolve.
import:
@$(GODOT) --import --quit >/dev/null 2>&1 || true
parse: import
@$(GODOT) --script res://tools/parse_all.gd
test: import
@tools/run_tests.sh
## Proves the test runner detects each kind of failure.
test-selfcheck: import
@tools/test_selfcheck.sh
## Boots the headless server for 1,000 ticks and checks exit codes, logs and timing.
smoke: import
@tools/smoke.sh
## Plays 20 bot-only matches and checks each has a winner, few bots drown and easy
## bots do worst. Takes about ten minutes, so it isn't part of `check`.
## BOT_MATCH_SEEDS and BOT_MATCH_FIRST change how many seeds and where they start.
bot-matches: import
@tools/bot_matches.sh
## Plays one whole offline match, lobby to results, with a scripted player and 23 bots,
## then replays its command log and checks the replay ends in the same state.
## MATCH_SEED picks the seed.
match: import
@tools/match.sh
## Renders each stage of the match `make match` last played. Needs Docker.
match-captures: import
@tools/match_captures.sh
## Joins a real client process to a real server process over loopback UDP and checks
## it gets from the lobby into the match. About a minute, in real time.
client-check: import
@tools/client_check.sh
## Feeds FUZZ_MESSAGES (default 1,000,000) malformed messages to every network parser.
FUZZ_MESSAGES ?= 1000000
FUZZ_SEED ?= 1
fuzz: import
@nice -n 15 $(GODOT) --script res://tools/fuzz_parsers.gd -- --messages=$(FUZZ_MESSAGES) --seed=$(FUZZ_SEED)
## Finds a real game server on the LAN (over loopback) and through a real list server.
discovery-check: import
@tools/discovery_check.sh
## Renders what a network client sees on the barge, gliding and landed. Needs Docker.
client-captures: import
@for stage in barge glide landed; do tools/capture.sh client_$$stage captures/client_$$stage.png; done
## Renders the capture test scenes in the offscreen container. Needs Docker.
capture-test: import
@tools/capture_selfcheck.sh
## Renders the terrain crack check and its control in the offscreen container. Needs Docker.
terrain-capture: import
@tools/terrain_capture_check.sh
## The 24-client network soak: a real server and 24 headless clients behind a relay that
## adds latency, jitter and loss, for SOAK_MATCHES (default 2) whole matches in real
## time, about half an hour. Checks for desyncs, errors, leaks and the tick budget.
soak: import
@tools/soak.sh
## About a minute: proves the soak catches a client whose world has drifted.
soak-selfcheck: import
@SOAK_SELFCHECK=1 tools/soak.sh