Mario Kart 64 Online
Online play for two, with lockstep netcode, room codes and each player’s own kart full screen.
A fork of SpaghettiKart, the open-source PC port of Mario Kart 64, that adds online play for two players on two computers. Each player sees their own kart full screen, the way a one-player game looks, while both machines run the same race frame by frame.
It’s lockstep netcode: only controller input crosses the network, four bytes per player per frame. The input delay is chosen from the measured round trip, inputs are sent redundantly so a lost packet doesn’t stall the race, and a per-frame state hash warns if the two games ever drift apart.
Joining takes a room code. The host gets an eight-character code, it’s exchanged through a public ntfy topic, public STUN servers find each side’s address and UDP hole punching connects the two machines directly, with a LAN address, a copy-paste code or a small self-hosted relay as fallbacks.
The hard part was determinism: two different machines have to compute the identical race. That meant strict IEEE floating point and signed chars so a Mac and a Linux PC can play each other, zeroed uninitialised fields, and a fixed-pattern heap during online sessions. A test harness races two copies against each other and compares their state hashes frame by frame.





