How we test
Test scripts, lag tests, benchmarks, the Chromebook profile, bots and load tests.
Most testing is scripts that play the game. The repo has about 640 scripts: around 360 tests, 88 browser tests that drive the real site in Chrome, and the benchmarks.
How it works now
- About 640 scripts: around 360 tests, 88 browser tests that drive the real site in Chrome, and the benchmarks. Tests and the feel audit play on Box2D 3, like the live game.
- The feel audit plays the real room and the real client on a virtual clock with seeded randomness: 352 games in about 5 minutes at 4 at a time.
- The feel gate runs a quick set of 36 of those games before every deploy, against the saved full report, and fails when a number over its threshold gets more than 20% worse or a game stops running.
- The deploy chain applies each patch to a fresh tree at the newest main, runs the type checks, the tests the patches name, the feel gate and the browser tests on fresh servers, and ships only if every step passed.
- Bot changes play against the frozen previous version and are kept only on 512 games or more.
- Benchmarks run 3 times and keep the middle result; the database bench counts statements.
Last checked: 16 Nov 2026.
Key decisions
| Decision | Why | Rejected | Date |
| A feel gate before every deploy, against a saved full report | A deploy can't make the game feel worse unseen | None recorded | 15 Nov 2026 |
| The audit runs on a virtual clock with seeded randomness | The same code plays the same game, so its numbers come out the same to the decimal | A real clock, which lies on a busy machine | 15 Nov 2026 |
| Bot-play numbers are listed but never fail the gate | The bots react to your ball, so any client change plays a different game | Gating them | 15 Nov 2026 |
| A failing browser test refuses the ship, and a skipped patch is never called shipped | One deploy shipped with its browser test crashed, one was reported live with its patch missing | None recorded | 16 Nov 2026 |
| Blame a change only from two trees run at the same moment | A sequential control under load blamed a correct change | One run after the other | 16 Nov 2026 |
| Per-process temp files and ports found free at run time | Three tests failed at random when two copies shared a path or a port | Fixed paths and ports | 16 Nov 2026 |
| Bot changes kept only on 512 games or more | Two runs of the same code differ by up to 10 points at 256 games | 256 games | 15 Nov 2026 |
Changes that mattered
- 16 Nov 2026: tests and the feel audit moved onto Box2D 3, which showed a ball bouncing off a corner it never touched. The bug
- 16 Nov 2026: an hour of browser tests ran against another agent's tree; the gate now proves its own server started. The bug
- 16 Nov 2026: a correct change blamed on a lucky control run. The bug
- 16 Nov 2026: up to 22 agents on one 16-core Mac at load 30 to 120: what failed from load. Running many agents on one machine
- 16 Nov 2026: the deploy chain: a skipped patch had been reported as shipped. Forty deploys in a day, the bug
- 16 Nov 2026: 24 red tests read: 19 behind the code, five real bugs. Fixing 24 failing tests
- 15 Nov 2026: the feel audit and the gate before a deploy. How we build and test TagBalls
- 13 Nov 2026: load tests on a staging copy: healthy to 8,000 online. Ready for a crowd
Known limits and next
- Tests on a real clock fail on a busy machine (1-minute load over about 30); timed numbers count only under load 20. The ones left are listed to move to a virtual clock.
- A saved feel report from before the last metric change shows dozens of rows worse at once; it's made again after any deploy that changes the simulation.
- Load tests come from one Mac against a staging copy, not live traffic.
Kinds of tests
| Kind | What it does |
| Maps and physics | Bots play every built-in map for a few simulated minutes, and every built-in map is checked and its physics built. |
| Lag | A player at 80 ms ± 20 and 150 ms ± 40 round trips, with 1% of messages arriving late. Every drawn frame is compared with the server, and visible jumps fail the test. |
| Smoothness | A real bot game at 50, 100 and 150 ms with jitter and 200 ms stalls, counting kinks other balls show that the server's path doesn't have. |
| Replays | Record, save, watch, seek, follow, download and load again. |
| Rooms | 12 v 12 rooms and the room's load meter. |
| Database | A copy with 50,000 accounts, 5,000 maps and 100,000 games. Times every common request and flags any lookup that reads a whole big table. |
| Browser | 88 tests open the site in Chrome and click through the features. |
| Clock | Live tick traces replayed with slow pings; jumps counted by cause. Each room logs its last 50 jumps with size and cause (tick, net, wake, mend), and the ops API shows them. |
| Dialogs | A test fails if a native confirm, alert or prompt comes back. |
Before and after
One command runs every benchmark 3 times and keeps the middle result:
- frames in Chrome with the CPU slowed 1 to 10 times
- key press to screen at 0, 40 and 100 ms ping, for each netcode
- a room's tick cost and its snapshot bytes
- real connections: late and missing updates
- the database: game ends and page reads
A change meant to be faster is measured before and after on the same Mac, an M3 Max. An ordinary laptop is about 3 to 6 times slower per core, so the CPU is slowed to match. Results: Making it fast.
The Chromebook profile
The slowest computer we test for: 1366 × 768, the CPU 10 times slower, the graphics card off, and Auto quality like a new player gets. It plays a ball pit, a Hangout, a busy game, and joins someone else's game online.
The physics swap
Before the physics moved to Box2D version 3 in WebAssembly, a test stepped both engines with the same inputs, tick by tick:
| Case | Worst position difference |
| Accelerate, coast, bounce off a wall at top speed | 0.0001 tiles or less |
| Bounce off a wall at boost speed | 0.012 tiles |
| Roll into a corner | 0.044 tiles (one bounce lands a tick earlier) |
Then the live server tests, public bot rooms (4 v 4 and 12 v 12, 6 simulated minutes each across the rotation maps: no errors, memory flat) and Chrome end to end. It went live on 2026-11-15. The story: Making it fast.
Bots
A bot change is played out in simulated games: Expert against Expert, 4 v 4, on the same maps from both sides, 256 games or more. Two runs of the same code can differ by up to 10 points at 256 games, so a change is kept only on 512 games or more, or repeats. A ladder keeps every accepted version of the bots and takes a change only when it beats the top one by a clear margin (How bots think).
Red tests
A test that stays red stops saying anything, so a red test is read the day it goes red. A behaviour change updates its tests in the same commit, and a check that fails only on a busy machine is rewritten so load can't move it. On 16 Nov 2026, 24 tests were red: 19 had fallen behind the code, and five were real bugs (quick chat phrases without a key, deleted maps kept offline, a group's next game not starting, the end screen losing its result, Minimum ping letting keys in early). More: Fixing 24 failing tests.
Feel audit
It plays the real room and the real client on a virtual clock, at pings from 0 to 150 ms and screens from 60 to 144 Hz, and checks every drawn frame against the server for snaps, stutters and late events. Before a deploy, the feel gate compares a quick run with the saved full report. A saved report made before the last metric change shows dozens of rows worse at once, all of which reproduce on the untouched base commit. So the check is to rerun one failing job on the base commit with the same scripts, and the saved report is made again after any deploy that changes the simulation.
The full audit is 352 games and takes about 5 minutes; the quick set before a deploy is 36 of them. The saved report keeps only the numbers over their thresholds. The gate fails when one of those gets more than 20% worse (plus a small margin per number), when a number goes over that was under, or when a game or a situation stops running. CPU counts only when it doubles, since the machine's load moves it. Numbers from bot play are listed but never fail the gate: the bots react to your ball, so any change to the client plays a different game.
Load tests
Load tests run on a staging copy of the game with its own data, never on tagballs.com. Each simulated player is a browser tab that loads pages, polls like the real site and moves on every 20 to 120 seconds; 60% are signed in, 30% are background tabs, and some play in game rooms. The load came from one Mac in Texas. Healthy means p95 under about 200 ms with no errors.
| Date | Code | Healthy up to | Past that |
| 2026-11-13 | before the load work | about 1,000 online | about 1,500 (p95 10 s, 15% errors) |
| 2026-11-13 | round 1 | 4,000 online (p95 117 ms) | between 4,000 and 6,000 |
| 2026-11-13 | round 2 | 8,000 online (p95 175 ms, 0.02% errors) | 10,000 still holds (p95 342 ms) |
What runs out first is World, the one object that handles accounts and matchmaking one request at a time. How it got there: Ready for a crowd. Every load test and benchmark, with what is not tested yet: Load tests.