Skip to content

Game netcode rules

lagless fixes the transport. These rules are for your game code, and they matter just as much.

Send absolute state on unreliable channels

Section titled “Send absolute state on unreliable channels”

Each unreliable message should stand on its own: positions, not deltas from a message that might be lost.

When send() returns false, don’t queue that message. Mark the state as owed and send the freshest version next tick.

Reliable bytes block behind each other. Put only events that must arrive (chat, kills, inventory) on the reliable channel, and stream everything else unreliably.

Stamp state per entity and ignore anything older than what you already applied.

A sent unreliable message can still be lost. Use a sequence number or ack so you know what the client actually has, and resend fresh state for anything missing.

On the HUD, show max(lastRtt, now − oldestUnansweredPing). A stall then shows up as it happens instead of after the pong finally arrives.

Compare ICE (STUN) RTT, SCTP srtt and app ping:

  • STUN low and app ping high: the queue is on your server.
  • Both high: the path itself is bufferbloated.