STORY · POKEMINIGRAM · 23 OCT 2026 · 5 MIN

Four players, four connections

How pokeMiniGram keeps four players on four connections in one game: a clock they share, a server that judges the frame a press was made on, and the fix that stopped Barrier Ball's players bouncing around.

pokeMiniGram’s minigames are for four people, each on their own phone or computer, joined through one small server. Every press takes time to reach the others, and never the same time for everyone. This is how the game deals with that, from the first game online to the fix that made Barrier Ball playable.

Barrier Ball's court from above: four Mr. Mime behind their barriers, two Poké Balls flying with red and green glowing trails.
Barrier Ball: four Mr. Mime, four connections, one court.

One server, one clock

The server is a single Python program on Google Cloud Run, talking to every device over a WebSocket. Every game’s rules exist twice, in JavaScript for the browser and in Python for the server, kept equal bit for bit. The browser plays the game; the server’s copy decides what counts. That was settled on the first evening online: the server started keeping the score itself from the players’ inputs, and a device’s claim that doesn’t match is corrected. A phone can’t score catches its player didn’t make.

Each device keeps its clock in step with the server’s by pinging it and going by the quickest of its last twelve round trips. Every press carries the frame it was made on, counted on that shared clock, and that frame is what gets judged, not the moment the message arrives. From there it depends on the kind of game.

Three kinds of game

Each player in their own lane. In Clear Cut Challenge everyone cuts their own logs, all falling on the same clock. The server checks the cut against the same rules and accepts it if its frame falls inside that log’s window. Nothing else is needed: a slow connection only means the others see the swing go up on the signpost a moment later. Egg Emergency, the first game online, is lanes too, but players move all the time, so each device shows the other Chansey a little behind. At first that was a fixed 0.3 s; now it’s a delay that follows how late each player’s moves actually arrive, between 0.05 and 0.6 s.

Presses that race. Eager Eevee, Streaming Stampede and Pichu’s Power Plant have winners, so someone has to decide who was first. A press is trusted to have happened when its device says, within an allowance: half that device’s round trip plus a tenth of a second, kept between 0.2 and 0.5 s. A press that claims to be older counts as exactly that old. The server waits out the allowance before it hands out the prize, so no press still on its way can change who got there first. A slow connection doesn’t lose a race it won, and no device can claim a quicker press than its player made by more than its own lag.

The same race, frame by frame. If the server went by arrival, the first press in would win, and 2P, who pressed first, would lose to a slow line. The server goes by the frames instead, and waits out the allowance (about 0.4 s for 2P's 580 ms round trip) before it names the winner. Round trips and frame numbers are illustrative; the waiting follows the server's own rule.

One shared space. In Gutsy Golbat, Barrier Ball, Rampage Rollout, Topsy-Turvy, Furret’s Frolic and Delibird’s Delivery all four players move in the same world, and nobody can wait for anyone. Every device runs the whole world from everyone’s controls, and so does the server. A device guesses that the others kept doing what they were doing; when a real input arrives for a frame it has already played, it goes back to its last saved state (it keeps one every six frames), plays forward with the right input, and eases whatever moved into its new place.

Bouncing Mr. Mimes

The rewind worked, and in Barrier Ball it showed. João:

on the first stress test while playing the mime game, it was clear that the players were bouncing around
João, in the interview

Every other player’s input arrived a few frames after the frame it was for. So every time someone changed direction the world ran again, and their Mr. Mime, with any ball that had just come off their barrier, jumped to where it turned out to be. The clock added to it: it jumped straight to each better ping, so a round’s frames could stall or come in a burst.

The fix landed about seven hours later, and it turned the problem round. Instead of correcting late inputs, make them arrive early: a device now counts its own input a few frames after it’s made, and sends it at once. One to three frames at 30 a second, enough to cover the slowest other player’s connection, measured when the round starts. By the time the others play that frame, the input is usually already there, and there’s nothing to correct. The server accepts inputs up to four frames ahead, and the clock now drifts towards a better ping, at most 5 % fast or slow, instead of jumping. The rewind stayed; it’s just rarely needed.

The same Mr. Mime on two screens, with A's inputs reaching B three frames late. Before the fix, B guesses, overshoots every time A turns, and is pulled back (orange). After, A's input counts three frames later on both screens and arrives in time, so B never needs correcting. Movement and corrections follow the game's own numbers; A's steering is made up.

To measure it, a test mode adds a delay to a page’s connection. With two pages at 80 ms a round trip, a Mr. Mime moved with the keys used to be put right by 96 units a second; after the change, not at all. Moved with a finger, by 44 units a second, then 0.9. At 150 ms the corrections fell from 162 to 70.

What it taught

I think it turned out great, maybe I could try to make the game support more players, that would be to complicated for some games and brake other games.
João, in the interview

Stadium 2’s minigames are built around four: four corners in Barrier Ball, four lanes in Clear Cut, four Hitmontop in Topsy-Turvy’s ring. That’s why more players would break some of them: the rules, not the network, are made for four.