networking
tinynet
a low-latency multiplayer networking stack built from scratch in c++20 on non-blocking udp.
- timeline
- aug 2026 — present
- stack
- c++20, udp, posix sockets
16-byte
protocol header
32-bit
ack bitfield
why build it
multiplayer games can’t wait for tcp to retransmit a lost packet. tinynet is a networking stack built directly on non-blocking udp, to understand from the ground up how reliability and ordering are layered on an unreliable transport.
foundations
a custom socket abstraction wraps posix sockets, and an endian-safe binary serialization layer keeps packets consistent across machines.
reliability without tcp
every packet carries a 16-byte protocol header. sequencing and selective acknowledgement use remote acks and a 32-bit ack bitfield, so one packet can acknowledge the 32 before it. fixed-size ring buffers track packets in constant time.
connection lifecycle
on top of that sit protocol validation, rtt smoothing, packet-loss detection, and timeout-driven connection management.
testing
unit tests cover serialization, and client–server integration tests cover transport behaviour.