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>
This commit is contained in:
+11
-4
@@ -138,18 +138,25 @@ func after_tick() -> void:
|
||||
if not bytes.is_empty():
|
||||
own_changes[handle] = bytes
|
||||
net.send(handle, NetProtocol.CHANNEL_CONTROL, bytes, true)
|
||||
if not snapshot_due():
|
||||
return
|
||||
for handle: int in net.handles():
|
||||
if sender.has_client(handle):
|
||||
if sender.has_client(handle) and snapshot_due_for(handle):
|
||||
net.send(handle, NetProtocol.CHANNEL_STATE, snapshot_for(handle), false)
|
||||
|
||||
|
||||
## True on the ticks a snapshot goes out.
|
||||
## True on the ticks a snapshot goes out to an owner that carries packets for a single
|
||||
## client itself (LocalServer and tests).
|
||||
func snapshot_due() -> bool:
|
||||
return loop.ticks % Tuning.NET_SNAPSHOT_INTERVAL_TICKS == 0
|
||||
|
||||
|
||||
## True on the ticks a networked client's snapshot goes out. Clients are spread over
|
||||
## the ticks of the interval by handle, so the cost of building snapshots, the largest
|
||||
## share of a busy server's tick, is split between them instead of landing on one.
|
||||
func snapshot_due_for(handle: int) -> bool:
|
||||
var interval: int = Tuning.NET_SNAPSHOT_INTERVAL_TICKS
|
||||
return (loop.ticks + posmod(handle, interval)) % interval == 0
|
||||
|
||||
|
||||
## The snapshot for a participant as things stand: what they may see, and their own
|
||||
## block while they are playing.
|
||||
func snapshot_for(handle: int) -> PackedByteArray:
|
||||
|
||||
Reference in New Issue
Block a user