A game tick
60 ticks a second: inputs, physics, snapshots, and what a tick costs, phase by phase.
Each game room runs 60 ticks a second: one every 16.7 ms. Every tick does the same work in the same order. Every measurement of rooms on Cloudflare: Room measurements.
How it works now
- 60 ticks a second, each timed against the room's start (start + n × 16.7 ms), so a late tick doesn't push the next one late.
- A tick in order: inputs (bots decide here), one Box2D step, the rules, one snapshot built once per distinct view, the send, then highlights and stats.
- A tick's cost without bots: 0.040 ms mean and 0.172 at p99 for 8 people; with 4 people and 4 Expert bots, 0.194 / 0.848 (16 Nov 2026, in-process, a busy machine).
- On Cloud a room's clock moves only at I/O and pauses 40 to 200 ms a few times a quarter hour. The clock mend repays a pause evenly: live 31 / 73 / 81 ms behind real time at p50 / p90 / p99, stalls over 40 ms 0.0 a minute.
- Room heal plays the bots one level lower, once a game, when a room keeps falling behind.
- On Dedicated the clock is real: ticks late p99 1.9 ms with 8 games on one core. Clock mend and room heal are off there.
Last checked: 16 Nov 2026.
Key decisions
| Decision | Why | Rejected | Date |
| Ticks timed against the room's start | A late tick doesn't push the next one late: stalls of 40 ms or more went from 7 to 11 a minute to 2.2 | Chained timers, which ran at 57 ticks a second | 15 Nov 2026 |
| Mend the room's clock from players' pings, repaid at 0.25 ms per ms | Repaid evenly, bursts went from 8.2 to 0 a minute in replays of live traces | Repaying a stall at once in a burst; pacing the room by inputs, which ran 500 ms ahead in a test | 15 Nov 2026 |
| One snapshot encode shared by every socket, each getting the change since its last one | Encoding is 13% of the room's work; about 30% less data with deltas | One encode per socket | 15 Nov 2026 |
| A 16-bit checksum on every frame; a bad one is never drawn | The page asks for a full one and keeps predicting meanwhile | None recorded | 15 Nov 2026 |
| Room heal: bots one level lower, once a game, never back | Bots are most of a tick's cost, so a level lower cuts the falls; once a game, so a game never changes twice | A strict per-room work budget for bots: it cut the falls but cost play (bots with it won 40% ± 12 of 60 ladder games) | 15 Nov 2026 |
| Clock mend and room heal off on Dedicated | Its clock is real | None recorded | 16 Nov 2026 |
Changes that mattered
- 16 Nov 2026: games no longer freeze for seconds while the day's maps are checked (5.3 to 9.4 s under a local Worker). The bug
- 16 Nov 2026: the room's own tick trimmed, every byte sent the same: 8 people 0.050 to 0.040 ms mean. Room tick cost
- 16 Nov 2026: Cloudflare's room clock pauses measured: falls of 40 to 94 ms with no bots at all. Room clock pauses on Cloudflare
- 16 Nov 2026: a portal trip locks only its exit portal; a chain of portals no longer skips one. Second portal in a chain was skipped
- 15 Nov 2026: room heal plays bots a level lower when a room keeps falling. Lower bot level when a room lags
- 15 Nov 2026: the clock mend: stalls over 40 ms went to 0.0 a minute. Chasing crispness
- 15 Nov 2026: updates sent as the change from the last one, with a checksum: about 30% less. Making it fast
Known limits and next
- Rooms on Cloud still pause; the mend hides it as a moment more delay, it doesn't remove it (Known rough edges).
- Bots still add hitches on Cloud with the bot brain in use; the cause is not known yet. The open bug
- The once-a-second tick (scoreboard, concede and seat checks) costs about twice a plain one.
- A catch-up after a stall takes about 4 times the stall.
- Small tick times were measured on a busy machine: read them as a direction.
In order
- Inputs. Each player's keys for this tick are applied. Bots decide here, before physics, and in big rooms at most 6 bots do a full decision per tick.
- Physics. One step of Box2D version 3, compiled to WebAssembly, 1/60 s long. The same build runs on the server and in your browser, so both get the same answer. Every built-in map plays on it since 2026-11-15; before that the game ran on planck.js, a JavaScript Box2D.
- Rules. Tags, pops, flag grabs, caps, boost pads, powerups and timers.
- Snapshot. Every ball's state in binary, built once for everyone.
- Send. Each player gets the snapshot with a few bytes of their own (which of their inputs it includes).
- After. Highlights, stats and live numbers. What they change goes out next tick.
Each tick is timed against the room's start (start + n × 16.7 ms), so a late tick doesn't push the next one late. Live since 15 Nov 2026: stalls, a tick 40 ms or more behind its time, went from 7 to 11 a minute to 2.2.
The room's clock
On Cloudflare a room's clock only moves at I/O. After a long tick (bots replanning at a grab or return, mostly) it falls behind real time in steps of 10 to 165 ms and creeps back at 20 to 70 ms a second, and every update is late until it has. Measured live in US West: no bots 5 / 20 ms behind at p50 / p99, 4 v 4 Expert bots 52 / 193, 12 v 12 109 / 431. Since the evening of 15 Nov 2026 the room mends its clock: pages ping four times a second, the room reads how far behind real time it is from them and runs the missing ticks at once. Live after: 31 / 73 / 81 ms behind at p50 / p90 / p99 (before 55 / 195 at p50 / p99), stalls over 40 ms 0.0 a minute. The status site shows it as Clock behind real time.
Round 3: the reading is the lowest of the players' pings. A lone slow ping used to read the room as less behind, then the next normal one as a jump, and the slowest ping in 90 s set the on-time mark for every later one. Now a rise counts only if the ping before shows it too, or the clock's normal creep allows it. A stall is repaid at 0.25 ms per ms (ticks 13.3 ms apart), up to 0.5 for big ones, never more than one extra tick a wake, with the next wake timed by that rate so ticks stay even. In replays of live traces, bursts (40 ms or more of game time inside 20 ms) went from 8.2 to 0 a minute, and from 10.9 to 0 with slow pings. The cost: a catch-up takes about 4 times the stall. The story: Chasing crispness.
On your screen, Classic draws your ball from the last half second of its steps at a moment that runs at an even 60 ticks a second and drifts toward the room's by 1% (3% once over 3 ticks off). A late stretch or a catch-up is a moment more delay that fades, never your ball speeding up or slowing down. On the live timing your roll is 2 to 2.5 times steadier, and it adds 0 ms at the median, 12 ms at the 99th percentile.
When the clock keeps falling
A room watches its own clock. Over the last minute it counts its clock falls of 40 ms or more (never a player's slow ping) and the 250 ms windows with 15 ms or more of the bots' thinking. With more than 6 of either, past the game's first 30 s, while bots are at least half the balls:
- every bot plays one level lower for the rest of that game: Expert to Elite, Elite to Regular
- chat and a toast say "Bots eased to keep the game smooth", and staff's ops page marks the room eased
- it happens once a game, never twice and never back, and the next game starts at the room's level
- if updates stay late with the bots eased, the machine is the cause, and the corner note reads "Server catching up"
Public rooms always; a custom game only when its host turns on "Ease bots if the server lags". On Dedicated servers the clock is real, so it stays off there. The switch is ROOM_HEAL_LIVE. More: Lower bot level when a room lags.
Physics
Every game plays Classic physics unless a custom game picks TagBalls physics. The values were measured from the classic game. One tile is 40 px.
Sleeping piles
A ball pit's balls sleep when at rest: the pile leaves the solver until something touches or pushes it (a ball rolling in, a conveyor, a band, a bomb, the pit parting round a ball that dives in). Awake contacts a step went from 229 to 8 on Lab: Big and from 277 to 9 on Hangout. The server and your browser stay bit for bit alike even when their piles sleep and wake at different ticks: a test compares every body over 4000 ticks and none differ. The switch is PIT_SLEEP_LIVE.
Gravity piles needed four fixes before they could sleep, each found by that test:
- gravity and damping applied inside the step, after the collision, so a woken pile gets that step's gravity
- a touching contact between two still bodies starts its solve without warm start, since a resting pile's carried impulses never settle
- every touching contact recolored from state, so both sides solve a loaded pile in the same order (from the same state, impulses were 10% apart before)
- a sleeping body moved by a snap gets its set's manifolds recomputed
Portals
- Entering is a check of where the ball is each tick: at boost speed a tick moves 0.25 tiles against a trigger circle 1.7 tiles across, so a ball can't tunnel past one.
- A trip locks only the portal the ball comes out of, until the ball leaves that portal's circle, so it never bounces straight back. Any other portal takes it the first tick it touches.
- Your screen keeps the same lock, so a chain of portals is drawn as the room plays it.
- Swaps and shuffles wait 30 ticks before another.
Until 16 Nov 2026 every trip locked all portals for 30 ticks, and at speed a ball rolled over a portal beside the exit. More: Second portal in a chain was skipped.
Snapshots
A snapshot is 11 bytes plus 23 bytes per ball (position, speed, spin, keys), every tick.
| Game | Bytes a tick | Per player a second |
| 4 v 4 | 195 | about 11.7 KB |
| 12 v 12 | 563 | about 33.8 KB |
| 16 v 16 | 747 | about 44.8 KB |
Since 15 Nov 2026 each update is sent as the change from the last one (a full one first, and whenever that's smaller), with a 16-bit checksum on every frame. It costs about 30% less: about 8.3 KB a second per player at 4 v 4 on Harbor and 23 KB at 12 v 12 on Foundry, 15.6 KB over real connections. A frame that fails its checksum is never drawn: the page asks for a full one at once, every 250 ms until it comes, and keeps predicting meanwhile. The status site counts those repairs.
What a tick costs
Measured 2026-11-15 on an M3 Max, a room with bots run on its own (CPU ms per tick, median and 99th percentile):
| Room | Whole tick | Bots | Physics | Snapshot and send |
| Maze map, 4 v 4 | 0.13 / 0.90 | p99 0.79 | p99 0.05 | p99 0.03 |
| Maze map, 12 v 12 | 0.51 / 1.36 | p99 1.22 | p99 0.07 | p99 0.03 |
| Ball pit map, 4 v 4 | 0.49 / 1.23 | | p99 0.87 | |
A tick has 16.7 ms, so a room uses under a tenth of it. Bots are most of the cost; physics only matters on maps full of loose balls. Live, over the 24 hours to 2026-11-14, ticks ran at most about 3 ms late.
The room's own work
Without bots, a tick is mostly the room's rules. Measured 2026-11-16 in-process on Box2D in WebAssembly, a fixed seed, every byte sent the same before and after the trims (thread CPU ms a tick):
| Room | Tick mean / p99 | Powerup timers | Snapshot | Inputs | Memory made a tick |
| 8 people | 0.040 / 0.172 (was 0.050 / 0.223) | 0.002 (was 0.007) | 0.006 (was 0.008) | 0.005 (was 0.007) | 11 KB (was 26) |
| 4 people and 4 Expert bots | 0.194 / 0.848 (was 0.213 / 0.848) | 0.004 (was 0.010) | 0.006 (was 0.008) | | 136 KB (was 156) |
- With 8 people the rules are about 80% of a tick and the physics about 15%; with 4 Expert bots, the bots are about 70%.
- With real sockets, sending is about half a tick, 5 µs a send.
- The snapshot is built once per distinct view and each socket gets only the change since its last one; every socket's frame now shares one buffer a tick.
- The once-a-second tick (scoreboard, concede and seat checks) costs about twice a plain one.
The machine was busy (load average 8 to 18), so read the small times as a direction. More: Room tick cost.
A room on a Durable Object
A game is one Durable Object: single-threaded JavaScript on Cloudflare's shared edge machines, with no size to pick. It runs 60 ticks a second, and its bots think in a bot brain next to it (Where bots think). Its clock moves only when it does I/O, so after a long tick it falls behind real time (the room's clock).
What that costs today, measured 15 Nov 2026:
- A tick's CPU on an M3 Max, median / p99: a 4 v 4 maze room 0.13 / 0.90 ms, 12 v 12 0.51 / 1.36 (what a tick costs). Bots are most of it.
- Live, before the fixes, the room's clock ran 52 / 193 ms behind real time at p50 / p99 with 4 v 4 Expert bots, and 109 / 431 with 12 v 12. With the clock mend: 38 / 73 / 81 ms at p50 / p90 / p99 for 4 v 4.
- On staging, one room with 8 scripted players, 4 spectators and no bots: no stalls, worst gap between sends 19 ms, tick lateness p99 2 ms, about 13 KB/s per player, and the room's clock falling behind 3 to 4 times a minute by 40 to 94 ms; with 8 Expert bots, 6.3 times a minute, up to 126 ms.
- The room's own work in Node is 5.5 ms per 250 ms at p99 (physics 70%, encoding 13%, sends 12%; one encode shared by every socket), so the falls are the platform's scheduling, not the game's code. Bots' bursts are cut where play allows.
- Money: a room running all the time is about $4 a month in object time, plus its players' messages; the whole site comes to roughly $80 to $120 a month at 100 people online around the clock (estimates from list prices, not a bill).
Known rough edges
- Rooms on Cloudflare can pause 40 to 200 ms a few times a quarter hour, everyone in the room at once. It's the platform's shared machines: a room's own work is about 5 ms per 250 ms at p99, and falls of 40 to 94 ms happen with no bots at all.
- What the game does about it: the clock mend repays a pause evenly instead of in a burst; your own ball keeps an even pace, so a pause shows as a moment more delay; other balls ease their corrections in; room heal plays the bots a level lower if a game keeps falling; the status site counts every fall by room and region.
- What fixes it: a real clock. Dedicated servers have one (Servers and deploys), and bot games hosted on a capable player's computer, by choice, are being built.
More: Room clock pauses on Cloudflare.