Our Multiplayer Engine Survives Café Wi-Fi
How PopCraft keeps collaborators in sync when the connection drops, the laptop sleeps, and the espresso machine interferes with 2.4GHz.
My unofficial test lab for multiplayer is a café two blocks from my apartment with the worst Wi-Fi in the city. If PopCraft works there, it works anywhere.
Edits are local first
Every change you make lands in a local document first and is saved to your browser right away. The network is a way to share edits, not a requirement for making them. Close the laptop mid-stroke, reopen it on the train, and your work is still there.
Conflicts resolve themselves
Under the hood each file is a CRDT — a data structure that lets any number of people edit concurrently and always merges to the same result, in any order. Two people recolor the same rectangle? Both edits are kept in history and everyone converges on the same final state without a "resolve conflict" dialog in sight.
When a socket drops we reconnect with exponential backoff and exchange only the changes each side is missing — usually a few kilobytes.
Lose edit access while offline? Your local changes are kept safe, but nothing is sent until someone with access says so.
The espresso machine test
Our favorite regression test is a script that randomly drops 30% of packets, pauses connections for up to 20 seconds, and replays everything out of order while three simulated designers go wild. It runs on every pull request. The café, meanwhile, remains undefeated in real life — but PopCraft now wins every rematch.