How a board game turned into an arena for AI agents

This October I stumbled on Traversal, a two-player strategy board game with a twist: the board is a 3D landscape. Every square has a height, climbing costs movement, and attacking from higher ground makes you stronger. Six pieces each, the goal is to get them off the far edge of the board. It looks simple, and it isn't. The game itself, and the bot I wrote for it, deserve their own post (written later, once the leaderboard had humbled me).

I played a few games online and my first reaction wasn't "this is fun" (it is). It was the engineer's reflex: what happens to this site if a thousand people show up at once?

Rebuilding it, properly

So I rebuilt it. Not to replace the original, but because it was the perfect excuse to design a real-time game backend the way I'd want to run one in production.

The first thing I did was write the rules down as a spec: every rule numbered, every ambiguity in the original rules page flagged, the choice I made for it isolated in one config file, and at least one test per rule. When you're about to write a game engine, a bot, and later an SDK in a second language, the rules are the only thing that must never drift.

Then the backend. A real-time game is a nasty little problem: two players, a clock, spectators, bots computing moves in the background. The easy version keeps everything in memory in one process, and it breaks the moment you need a second instance: one player lands on instance A, their opponent on B, and nobody sees the other's moves anymore.

The textbook fix is Redis for pub/sub plus a job queue. I already had Postgres (Lampion, naturally), so I wanted to see how far it could go alone.

Postgres is the source of truth

Every move is a transaction that locks the game row:

SELECT * FROM games WHERE id = $1 FOR UPDATE;
-- validate the move, write it and the new game version

Two moves arriving at the same time, even on two different instances, are serialized by Postgres. Each instance's local cache is just an accelerator: a cached game is only reused if its version matches the database.

Real-time goes through LISTEN / NOTIFY

In the same transaction as the move, the backend emits a notification. It's delivered only on commit, so nobody ever hears about a move that didn't happen:

SELECT pg_notify('traversal', '{"k":"game","id":"...","v":42}');

Each instance keeps one dedicated connection listening on that channel and wakes up its own SSE streams. The detail that matters: if that connection drops, you may have missed notifications. On reconnect, the instance clears its caches and tells its clients to re-read the state. Skip that, and you get the occasional frozen game that nobody can reproduce.

Background work too

Clocks, bot moves, game reviews: each is a row in a table, and any instance can claim it with FOR UPDATE SKIP LOCKED, so two instances never pick the same job and never block each other. A job claimed for too long (instance died mid-way) becomes available again.

The bill: one extra round-trip per move (a few ms in the same region), a handful of connections per instance to watch, and a limit that turned out to have nothing to do with Postgres. On Scaleway, an instance accepts 80 concurrent requests, and an open SSE stream holds one for its whole life. That number decides how many games an instance can host.

Talking to the developer

At some point it felt wrong to keep building on someone else's game without saying hello, so I reached out to the developer behind Traversal. We talked about the game, about where it could go, and I shared what I'd learned rebuilding it: keep the server stateless and let the database carry the state, write the rules down before writing the engine, and measure before scaling anything.

It was a good conversation, and it clarified something for me. The game is his. What I had that was genuinely new wasn't another place to play Traversal. It was everything around the engine.

So I opened an arena instead

I'd written bots to play against while testing: five levels, from Galet (a pebble) to Mont Blanc. Tuning them was the part I enjoyed most. So I asked the obvious question: what if other people wrote the bots?

That's traversal-bot.app. You write a bot, compile it to WebAssembly, upload it, and it gets ranked against every other bot, around the clock.

  • Same machine for everyone. Bots run in a wasmtime sandbox with a fuel budget of 2 billion instructions per move, 64 MB of memory, no files, no network, no clock. Running out of fuel loses the game, like running out of time.
  • Reproducible games. No system randomness: every move gets a seed, so any game can be replayed exactly. The server replays and verifies every game the runner reports.
  • A real SDK. The Rust SDK ships the full engine and the house bot, so starting from the starter bot means starting from Mont Blanc. Any language that compiles to WebAssembly works too.
  • A local loop. One Docker command plays your .wasm against any house bot on your machine, with the same rules as production.

Then the vibe coders showed up

I expected a handful of Rust people who enjoy alpha-beta search. What I got was a lot of people who had never written a game engine, writing bots with an AI coding agent. Point the agent at the SDK and the rules, ask for a bot, play a duel locally, paste the result back, iterate.

And honestly? They're not bad at all. For a while, the number one bot on the leaderboard wasn't mine.

In hindsight it makes sense. An arena like this is close to the ideal environment for a coding agent: a written spec, a typed SDK, a deterministic sandbox, and a one-command feedback loop that returns a win rate. The agent doesn't have to guess whether its change helped. The scoreboard tells it.

What I took away

  • Write the rules down first. The spec ended up being read by me, by my tests, by a second engine in Rust, and by a lot of AI agents.
  • Check what your database can already do before adding infrastructure. Postgres locks, notifies and queues. For a few hundred concurrent games that's plenty, and it's one less service to run and pay for.
  • The best feature might be the platform around the product. People didn't come to play Traversal against me. They came to build something that plays it.
  • Give agents a scoreboard. A measurable, reproducible feedback loop is what turns "vibe coding" into steady improvement.