five-on-it / apps/client/src/renderer/latency
apps/client/src/renderer/latency
A transport decorator that delays every frame in both directions, to feel the netcode at a chosen round-trip time on localhost (L), and loses a share of the frames a lossy transport may lose (K), with some jitter, so the acked snapshots and the inputs sent again can be judged by hand without a bad network. Both can be changed live.
The frames that may be lost are those sent on the unreliable channel and, coming in, the binary frames up to RELIABLE_ABOVE bytes (the snapshots; a bigger one the server sends reliably); text frames never are. While it loses frames the transport says it is lossy (lossy), so the game sends its inputs four to a frame, and over a reliable socket the game asks the server for the acked snapshots (ACKED_REQUEST).