A Mac hosts a game of 8 players #32
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "task/3994-a-mac-hosts-a-game-of-8-players"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Tracker: #3994
Step 3 of the multiplayer netcode plan (#3571). A hosted game now holds 8 players. Snapshots go out delta-compressed. A bots tool fills the game, and a bench holds the server's tick to 2 ms with 8 players.
Player limit. The server holds at most 8 players (
MAX_PLAYERS). A 9th connect is refused with the new reasonfull, and so is an accept that arrives after the game has filled. The joining app and the bots tool both printthe server at <address> holds 8 players already, as many as a game holds. The protocol version goes to 4.Delta snapshots. Each client's commands now carry the tick of the newest snapshot it holds. The server keeps what it sent over the last 60 ticks, both the shared world and each connection's own part, and writes each snapshot against the newest one that client acknowledged:
A client that has acknowledged nothing the server still holds gets a whole snapshot. The client keeps the snapshots it may be sent against and drops one written against a base it does not hold.
Bandwidth. With 8 players walking and the bodies asleep, each client within a tick's round trip, as on a LAN, receives about 15 KB a second (
tests/net_bandwidth.sx, budget 20 KB/s); whole snapshots would take about 150 KB a second. Each snapshot also carries the players of the two ticks before it, and those of a tick its base does not hold are written against the base's own, so a client one to two ticks away receives about 25 KB a second and one further about 35 KB.Tests.
tests/net_deltas.sxpins the delta round trip: exact values, only changed fields written, joins and leaves since the base, a lost snapshot leaving the next decodable, and an unheld base refused. It also pins how the server picks a base from acknowledgements.tests/net_handshake.sxandtests/net_joining.sxpin thefullrefusal from both sides.Bots.
tools/bots.sx, built intosx-out/tools/bots, joins--count Nscripted players by address (--join <address>[:port]). Each is a full client on its own UDP socket and joins at the first spawn marker. It walks its own loop through the clearing, from where one of the map's bodies starts or a dummy hangs to the next, pushing what it walks into.tests/bots.sxruns it against the dedicated server: 7 bots join, and a watching client sees them walk in the clearing and push 18 of its 20 bodies. A further bot is refused with its reason printed, and Ctrl-C makes each bot leave.Server bench.
tools/bench/server.sxtimes the first map's server with 8 scripted players walking from the spawn into the props and the dummies over a loopback, with every body and dummy part awake. The worst tick is about 0.85 ms undertaskpolicy -b(2 ms budget). The gate builds it and runs it beside the physics bench.tests/server_bench_scene.sxchecks that the scene does what the bench claims.README. It now says how many players a game holds, how snapshots are written, and how to run the bots and the server bench.
The in-app check is for Agra: host, then run
sx-out/tools/bots --join 127.0.0.1 --count 7from the repository root. A client walking among the 7 bots predicts in about 0.5 ms a frame, 2 ms at worst, built as the app is built.