Rust game rooms
The game room rewritten in Rust: where it runs, crash isolation, how we prove it plays the same game, and what we learned.
Every game runs in one engine written in Rust: natively on the game servers (the tb-rooms program) and as WebAssembly in the browser, for prediction, local games, the editor's play test and bots on the page. Public Capture games moved to it on 18 Nov 2026, the rest of the game by 22 Nov 2026, when the TypeScript room, its bots and the page's TypeScript physics were deleted. The story and the benchmarks: One Rust engine for the servers and the browser.
How it works now
- Where a game goes. World sends a game to a server that reports every feature the game needs (one name per piece of the game) and whose map check passes. The Node room host is gone (22 Nov 2026), so there is no second room to fall back to on a server; a game no server can take goes to Backup.
- Lines: every public line (Capture, Duel, Eggball, Boostball, Knockout, mini-games and the rest) is its own Rust process, with ranked, custom and group games, Hangouts and places.
- The physics. The Rust room builds the same physics engine, Box2D version 3, natively, with settings that give the same bits as the WebAssembly build the page uses for prediction.
- The bots. The bot brain is Rust too (server-rs/src/brain_rs) and thinks in the room's own process, on its own thread, so the room's tick never waits for it. The same brain runs in the page as a second WebAssembly module.
- Results. A game's record, a golden ball, claps, a map's clear and other counted writes go to World under a name that is saved once. A retry after a timeout gets the first answer back and never counts twice. A write that can never succeed is marked final by the site, and the room drops it at once.
- Deploys. The Rust process runs on a pair of ports. A deploy starts the new build on the free port; the old one takes no new games, finishes the ones it has and exits. Every room deploy builds the Rust room from the same commit as the Node room.
- Empty games close as on the Node room: a private game 30 s after its last player leaves, a public room after 20 s.
What a Rust room plays
Every mode, map kind and custom rule the game has: the Rust room is the only room. The browser runs the same code, so local games, the editor's play test and the Sandbox play exactly what a server plays. Not done: top-down mini-games on a gravity map have no bots (they never had them), and a server restart keeps the score, clock and places but not each ball's spin or the bots' memory.
How the site decides
- Each server reports what it plays. Its health answer lists its features, one name per piece of the game, and World reads it at most a few seconds old.
- The site mirrors the room's map check. Before placing a custom game, World runs the same check the Rust room runs on the map: the tiles, objects, settings and modes it plays. A test reads the Rust source's lists and fails when the two disagree, so a game World places on Rust is one the room takes.
- Anything not reported goes to a Node room. A feature a server doesn't name yet, a kind not switched on, a map the check refuses: the game plays on the Node room, never refused. The room's own refusal stays as a safety net, and then the page plays the game on Backup.
How every change is proven
- Kept answers. 4,031 recorded games hold the Rust room's own answers from 22 Nov 2026 (before that, the TypeScript room's). A rules change must play them the same, or show which games differ and why, with a control that proves the check can fail.
- Controls. Each new check is run once against the old code and must fail there, so a check that can't fail doesn't count.
- An independent verifier builds main from clean after landings and runs everything: the Rust tests, the 185 base recordings, every recording folder, the bench hash and the server checks. It names the commit that broke anything.
- The servers roll only after it passes. When it finds a difference, rolls wait until the fix lands.
- Counts, 22 Nov 2026: all 4,031 recorded games the same on the crate split and on the fast build; 258 Rust tests; the bench hashes unchanged.
Crash isolation
One process runs every Rust room on a server. A failure inside one room closes that room and nothing else.
- Where it is caught. Around each room's step, each message a player sends and each join. The failing room closes, its players redial into a new game, the site is told the room is gone, and the server's health answer counts the failure.
- The physics library is never cut off. A failure inside one of its callbacks is held at the library's edge. The callback answers its plain default for the rest of that call, the library finishes its step, and the failure is raised again in Rust right after. The library's world is always whole, so the failed room's world can be freed safely.
- Shared state stays whole. Locks are read so a failure can't poison them for the other rooms, and the saved rotation is copied before a room reads it.
- A failed room is never stepped again. Its state may be half updated (a ball's body and its record, a flag and its carrier), so it closes instead of carrying on.
- Proven: four rooms, the fourth made to fail in its step, in a message and in a physics callback. The other three rooms' snapshots stay identical tick for tick: 17 of 17 checks pass, against 2 of 17 on the build before.
- Cost: about 3.5% more CPU per room tick, and a larger program.
What we learned on the way
Every skip leaves a note
The first joins never reached the Rust room. Plain Quick Play is the "any" line, which the setting could not name, and the room was skipped without a word. Now every time a new room goes to Node instead of Rust, the Ops page gets a note with the reason.
Recordings prove the game, not the door
Recorded games add players straight into the room, so nothing compared what a signed join ticket carries. A banned account could play, and levels that players hide were shown. A ticket-join check now joins both rooms with real tickets and compares the players list field by field.
Compare what each player receives
Recordings compared what the room sends, not what each player receives. A player holding Tagball, Rolling Bomb or Freeze Bomb was sent where enemies would respawn. Recordings now log what each connection was not sent, and the compare checks it per player, with one filter function that both the room and the compare use.
One bad room must not end every game
The process was built to stop on any internal error, so one bad room ended every game on its server. An audit found four outside inputs that could reach such an error: a malformed join address, an end-of-game vote drawn from 64 or more maps, a published map pointing at another layer, and a bad number in a sort. Each was fixed, and then the design changed to the crash isolation above.
Retry only when it can help
A result the site refuses is retried only when retrying can help. The site says "final" only when it knows for certain that the write can never count. Save-once names make every retry safe.
Deploys that keep games and placements
The port pair lets a deploy start the new build while the old one finishes its games. The site keeps each server's last good health answer, so a cold or freshly rolled server does not cost a placement. A region set to automatic lists its own servers. Every room deploy builds the Rust room from the same commit as the rest, cached by a hash of everything it is built from.
Servers with their own TLS
On servers where the Node room answers TLS itself, the Rust room sits behind its own small front on another port. The cost: players on networks that allow only the main port play those games on a Backup Server.
One line per process
Each Rust process plays one line. Duel will run as a second port pair on the same servers, deployed and rolled back on its own.
Measured
On our one-core US West server, 18 Nov 2026, spare processes, nobody playing there:
| With 12 rooms | Node | Rust |
| People only: CPU per tick, mean / p99 | 2.48 / 4.75 ms | 2.24 / 3.13 ms |
| 1 person and 7 bots: room CPU per tick, mean / p99 | 5.13 / 10.35 ms | 1.54 / 2.13 ms |
| 1 person and 7 bots: room plus bot brain | 5.13 ms | 4.97 ms |
| Memory | 258 to 290 MB | 34 to 37 MB |
| Snapshots a second to every client | 60 | 60 |
- Live, 18 Nov 2026: joining the live site from each of the four regions landed on a Rust room every time, at 61 frames a second. The room's tick at p99 was about 1 ms on a one-core server.
- The staff test room with 3 rooms: every client got 60 snapshots a second, none was closed, and CPU per tick at p99 was 0.64 to 0.80 ms.
- A 15-minute soak of 500 WebTransport clients (about 110,000 sessions) kept the process between 6 and 37 MB.
- Benchmark, 22 Nov 2026 (build laptop, the same key presses on both, 3 runs): CPU per room-tick 0.020 ms for a room of 8 people against the TypeScript room's 0.071, 0.063 against 0.219 with 1 person and 7 bots; 12 bot rooms in 29 MB against 317 MB.
- Load test with real clients, 22 Nov 2026 (one core of the build laptop): 192 rooms of 8 people and 192 bot rooms kept on time, against the Node room host's 128 and 32.
- Live, 23 Nov 2026 (US East, up to 24 bot rooms): 1.19% of the core and about 1.05 MB a room; ticks late p99 3.5 to 4.2 ms at every count, against about 1 ms on 22 Nov, cause not known.
Every table: Load tests and Server settings and capacity.
Key decisions
| Decision | Why | Rejected | Date |
| Rewrite against recordings | The TypeScript room writes every byte it sends; the Rust room passes only when the bytes match, per player | None recorded | 16 Nov 2026 |
| Re-record on every change | A recording made before a change can't fail for that change | Keeping old recordings | 17 Nov 2026 |
| Bots stay in TypeScript, in their own process | 14,500 lines of thinking; its own process takes it off the room's tick without a port | None recorded | 17 Nov 2026 |
| A failure closes one room, not the process | One bad room had ended every game on its server | Stopping the process on any error | 18 Nov 2026 |
| Roll out by share, back by share 0 | One setting moves new rooms; running games finish where they are | None recorded | 17 Nov 2026 |
| Each server reports its features; the site places a game only where every one it needs is named | A server on an older build never gets a game it can't play, and a roll needs no site change | One build number for everything | 18 Nov 2026 |
| The site mirrors the room's map check, kept in step by a test | A game World places on Rust is one the room takes | Trying the room and falling back after a refusal | 18 Nov 2026 |
| Degrade, don't refuse: anything not reported goes to a Node room | A player always gets their game | Refusing what Rust can't play yet | 18 Nov 2026 |
| Big patches on light checks, one independent verifier on main | Fewer, larger landings and fewer rebases; the verifier still runs everything | The full 40-minute run for every patch | 18 Nov 2026 |
| Roll the servers only after the verifier passes | A difference found on main never reaches players | Rolling at each landing | 19 Nov 2026 |
| One engine: delete the TypeScript room and bots, run the Rust room in the page as WebAssembly | Every rule written once; two engines had to be kept in step | Keeping rare features on the Node room | 18 to 22 Nov 2026 |
| The bots ported to Rust, thinking in the room's process | One engine for the bots too; no Node process beside the room | Keeping the TypeScript bots on a separate brain process | 22 Nov 2026 |
Changes that mattered
- 16 Nov 2026: a Rust room prototype, to see whether it plays the same game and how much it saves.
- 17 Nov 2026: a staff test room on the US West server; records, ranked games, voice and staff tools ported; results saved once by name; deploys on a pair of ports.
- 18 Nov 2026: the server benchmark and the WebTransport soak; all 284 recorded games identical.
- 18 Nov 2026: every new public Capture game in all four regions on Rust rooms, then ranked waiting-line games and gathered bot games after a side-by-side check. The one-room bug, the bad inputs, respawn spots
- 18 Nov 2026: crash isolation: a failure closes only its room.
- 18 Nov 2026: groups' games, the Duel line, custom games, then the Ranked Eggball, Knockout and Boostball lines on Rust rooms.
- 18 to 19 Nov 2026: side-view gravity, multi-layer maps, contraptions, every mini-game and Party mode, the custom rules, ball shapes, new tiles and Dungeon ported, each with its own feature name.
- 19 Nov 2026: Home's Hangout rooms and players' places on Rust rooms; map clears count from a private Rust room; sandboxes, players' mini-game maps, item pads, tilt switches and kickers ported.
- 19 Nov 2026: a player's Herding, Curling, Bowling or Cannons map has its pieces checked as any map's (a glass gear closed a test room; never live). The one difference the verifier flagged that day, a Boostball game with ram pops off, was in how the compare tool rebuilt a recorded game, never in a server room; the tool is fixed.
- 20 to 22 Nov 2026: local games, the editor's play test, the Sandbox, page bots and then prediction run the Rust room as WebAssembly.
- 22 Nov 2026: the Node room host, the TypeScript room and bots, and the page's TypeScript physics deleted; the server split into three crates for faster builds. The post
Fixes, 19 Nov 2026
Each was found by recorded games, checks or reading the code, not reported by a player.
- Ramps under an arena with a ceiling, and a pound there, played apart. The bug
- Juggernaut's arrows passed every ball. The bug
- Dungeon and Boss fight filled every seat with bots for one person. The bug
- A ball pit kept rolling after the game ended. The bug
- Out players were listed in the order they went out. The bug
- Dodgeball throws and the egg went through one-way walls. The bug
- A map with an unknown ability set played Knockout's abilities. The bug
- Bands, belts and bumpers moved the big balls differently. The bug
- Springs and fans skipped a ball off the floor under a ceiling. The bug
- A crate on a button did not hold its button wall. The bug
- A ball in the air picked up and laid oil. The bug
- A dash rest ran out in the air on a Jump map. The bug
- The Ops page marked every Rust room server as running an old build. The bug
- A map cleared in the editor's test game still could not be published. The bug
- The tilting floor pushed a ball sitting in a cannon. The bug
- Map balls counted as players in Infection, Light trails and Race on gravity maps. The bug
- Light trails popped a ball in the air. The bug
- A free boost aimed up launched balls slightly differently. The bug
- The egg and the rally ball bounced off elastic bands differently. The bug
- The egg rolled through free spikes. The bug
- A gravity powerup given on a top-down map didn't show. The bug
- Time by one's own flag counted outside capture the flag. The bug
- A map list skipped a multi-layer map after a map with abilities. The bug
- A Space that set a Rolling Bomb off also hopped. The bug
- Jump did nothing on a multi-layer map. The bug
- A Grapple pulled a ball in the air. The bug
- Petting a pet did nothing when the id came as text. The bug
- A custom game switched to a map with doors, free objects or cannons played the old map's. The bug
- Wading after a gravity map went differently. The bug
- A room with bots closed when a ball touched a cannonball or a bridge plank. The bug
- A Swap could land a ball beside a button wall. The bug
- An egg touching a Sitter block or a one-way wall did not count as a bounce. The bug
- A stunned ball near a sticky wall slid differently. The bug
- Gravity Reach the goal maps seated no bots. The bug
Not on Rust yet
In the code on main on 19 Nov 2026. Each of these plays on the Node room.
- Mini-game maps: a map script or an arena with a ceiling on a mini-game's map (Boostball's and the Skate rink's own ceilings play); free objects and other tiles on Boostball and Skate rink maps; most settings and tiles outside their own on Dungeon and Boss fight maps.
- Multi-layer maps: mini-games, gravity maps with floors (pending), and a portal to another floor.
- Room kinds: a group lobby's live changes (the leader's map, settings, co-leaders and map queue), playtests with live editing and Endless runs are built and pending; champion challenges stay on Backup.
- Public mini-game rooms other than the Boostball line.
- The bot brain is still the TypeScript one, in its own process (The bot brain in Rust).
- Backup games run the TypeScript room (Backup rooms on the Rust room).
Known limits and next
- Bot games cost about the same CPU in total as on Node, because the bots run the same code.
- WebTransport is off for Rust rooms outside US West for now.
- Next: the items above, then the Node room leaves the servers once every kind plays on Rust.