Wire 4
16 Nov 2026
- Each ball is now sent as the difference from a prediction that the server and the page both make. That cut the data per player by 21 to 31%.
- The server’s send cost per tick changed by no more than 0.01 ms. Expanding the update costs the page about 4 µs a frame.
- In the page, decoding takes 0.01 ms of the 1.1 to 1.2 ms a snapshot costs. Replaying the keys takes the rest.
Coding the difference from a shared guess is cheap and exact. On small frames, though, headers and replays cost more than the bytes.
Wire 4 uses predictive delta coding. Both ends make the same guess from the last update. Then each value is sent as the small difference between its bit pattern and that guess. This suits any steady stream of physics state where the receiver already holds the previous frame. The wiki page Netcode describes the wire format as it is today.
Measured how: we played tp-asida with 8 people and read the bytes per player from the room’s own counters. We measured the send time per tick at a machine load of 16 to 20. We profiled the page in Chrome with the CPU slowed down 6 times.
Where the bytes were
Wire 2 (15 Nov) sent only what changed since the last update, with a checksum on every frame. That was about 30% less per player than full snapshots. Even so, on tp-asida the changes were 7.96 of a player’s 8.40 KB a second. A delta frame for 8 balls was 136 bytes: 25 for masks, 43 for speeds, 20 for spin, 34 for positions and 13 for headers.
Wire 4
- Each ball is coded on its own: its index in the last update, then a byte that says what changed, then its flags and keys as they are.
- Each number is sent as a varint (a variable-length integer) of how far its bit pattern is from a prediction. The prediction for speed is the old speed plus the push from the ball’s keys, damped. The prediction for position is the old position moved one tick by that speed. The prediction for spin is the old spin, damped.
- The numbers used in the prediction are fixed in the wire code, not taken from the game’s physics. Both ends only need to make the same guess.
- Once expanded, the body is the same bytes as the classic format, with the same checksum. If a body does not fit this coding, it is sent as a wire 2 delta instead.
Each player now receives 21 to 31% less data. The room’s send time per tick changed by no more than 0.01 ms either way. Expanding the update costs the page about 4 µs more per frame.
What a snapshot costs the page
Decoding takes 0.01 ms of the 1.1 to 1.2 ms that a snapshot costs the page. Replaying the keys takes 0.9 to 1.0 ms. So smaller frames do not save client CPU, but skipping replays does (Netcode). We also moved the clock’s record of arrival times from arrays to typed rings. That cut its cost from 1.1 to 1.9 ms a second to 0.3 to 0.4 ms.
Reuse
- Predict, then code the difference. The guess does not need to be the real physics. It only needs to be identical on both ends.
- Keep a checksum of the expanded body. Then a coding bug shows up as a repair instead of a desync.
- On a TLS socket, a 101-byte snapshot carries about 76 bytes of headers. Fewer messages help more than smaller ones (Servers).