A client for this project's own reference lockstep server (tools/multiplayer-server.mjs):
the transport, identity, and tick-authority piece item 129 asked for, without mwg
inventing a full prediction/rollback netcode a real game would likely want to replace
anyway. Every connected client submits at most one input per tick; the server broadcasts a
tick message once every client in its room has submitted for that tick, or once a
configured timeout elapses, substituting null for whoever is still missing - lockstep,
the model turn-driven and RTS-shaped games have used for this for decades, chosen because
it needs no client-side prediction to already be correct. A game wanting prediction or
interpolation on top of this still can: onTick hands over the same ordered, authoritative
input stream a prediction layer would reconcile against.
This is deliberately the only network surface in mwg that assumes a server exists rather
than a game's own endpoint - FeedbackClient/NewsClient/SaveSyncClient all assume the
opposite, a one-shot request/response a game points at its own backend. Real-time
multiplayer has no one-shot shape to hide a server behind, which is why mwg ships a
reference one (tools/multiplayer-server.mjs) rather than assuming a game brings its own,
the same reasoning that decided this the moment the item was sized.
A client for this project's own reference lockstep server (
tools/multiplayer-server.mjs): the transport, identity, and tick-authority piece item 129 asked for, withoutmwginventing a full prediction/rollback netcode a real game would likely want to replace anyway. Every connected client submits at most one input per tick; the server broadcasts atickmessage once every client in its room has submitted for that tick, or once a configured timeout elapses, substitutingnullfor whoever is still missing - lockstep, the model turn-driven and RTS-shaped games have used for this for decades, chosen because it needs no client-side prediction to already be correct. A game wanting prediction or interpolation on top of this still can:onTickhands over the same ordered, authoritative input stream a prediction layer would reconcile against.This is deliberately the only network surface in
mwgthat assumes a server exists rather than a game's own endpoint -FeedbackClient/NewsClient/SaveSyncClientall assume the opposite, a one-shot request/response a game points at its own backend. Real-time multiplayer has no one-shot shape to hide a server behind, which is whymwgships a reference one (tools/multiplayer-server.mjs) rather than assuming a game brings its own, the same reasoning that decided this the moment the item was sized.Example