Under 150 ms latency and 2% loss the local player moves at once, pushes crates without a jump, and sees the other player move smoothly #31
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "task/3993-under-simulated-150-ms-latency-and-2-los"
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: #3993
Step 2 of the multiplayer netcode plan (#3571). It adds exactly-once commands, prediction and reconciliation of the player's own body and of the bodies it pushes, interpolation of everything else, and a network conditioner.
--lag <ms>(round trip, half each way),--loss <percent>(each way) and--jitter <ms>condition the app's own link from a seeded generator (src/net/conditioner.sx). Each datagram waits half the lag, give or take the jitter, or is lost, so one may overtake another.tests/net_conditioner.sxdrives it on a simulated clock.Body. The client nudges its tick rate to keep about two waiting.stepBodyfor each command as it sends it. Each client tick it reconciles from its snapshot buffer at a base that advances one tick a client tick. The base starts six ticks behind the newest snapshot. Each second it steps forward to three behind when the newest stayed more than six ahead, and back only as far as the newest fell behind it, so it bridges jitter and three snapshots lost in a row. From the base the client re-runs every command the server had not taken.tests/sim_latency.sxplays two clients on the first map at 150 ms round trip, ±10 ms jitter and 2% loss each way, at 60 frames a second. It checks:tests/sim_pushed.sxcovers drawing and correction:Under 150 ms of lag and 2% loss, a player's own view answers at once and corrects without a snap, and the other player moves smoothlyto Under 150 ms latency and 2% loss the local player moves at once, pushes crates without a jump, and sees the other player move smoothly