Free steps · kit optional
Make a kart racing game with AI: how we built Capybara Kart

We made Capybara Kart, a 3D kart race for phone browsers with drifting, items, five CPU karts and online races, in about 16 hours with AI coding agents. This page shows how, step by step: the brief, the plan, the tickets, the art, the tests and the two bugs our first player found. Play it first, free, on your phone or computer.
- Plays in the phone's browser
- Online races on a free plan
- 15 pull requests in 16 hours
Steps 1 to 7 are free on this page. The kit adds the finished files and steps 8 to 10.
Published · Updated
Start buildingHow do you make a kart racing game with AI?
It depends on how big the game is. For a small one-screen game, one prompt is enough: our phone game guide makes one in five minutes. A 3D race with online play is too big for one prompt. Write a brief, have Claude turn it into a plan and a list of small tickets, give the tickets to a coding agent one at a time, and check each one with tests and bots before the next. That is what this guide does.
What you will make
Capybaras in small karts race three laps of a Bangkok street circuit: a market street, a canal bridge, a temple hairpin and a lane of parked tuk-tuks. You hold Gas, steer with arrows, and a long turn at speed starts a drift that ends in a blue or orange boost. Item boxes give a mango to throw, a banana-leaf slick, a shield or a boost. Coins buy kart colours and hats. You can race alone against CPU karts, or online with friends through a room code. The whole game is about 560 kB compressed, and the first screen needs about 18 kB of it.
What you need
- A coding agent: Claude Code on a paid Claude plan, or OpenAI Codex.
- Node.js 22 or newer, to run the game and its tests.
- Blender (free), for the 3D models.
- A free Cloudflare account, only for online races.
The steps
Step 1: Write a brief that says what "done" means
The brief is the most important file. Ours is 79 lines: the game, the controls, the online rules, the art style, the size and speed limits for phones, and the checks that prove it works. A short excerpt:
- First visit at most 1.3 MB over the wire, at most 750 kB before the first screen shows. Measure and report.
- Frame time on Chromium Pixel 7 with CPU throttling 4x in the busiest moment: report median and p95; target p95 at most 17.5 ms.
Numbers matter more than adjectives. "Fast on phones" gives an agent nothing to check; "p95 frame time at most 17.5 ms" does. Try this prompt to start yours:
I want to make a 3D kart racing game for phone browsers: <your idea in two sentences>. Interview me with up to 10 short questions, then write docs/brief.md: the game, the controls, the art style, online play, size and speed limits with numbers, and the checks that prove each part works.
Step 2: Turn the brief into a plan and 12 tickets
We gave the brief to Claude Code with Claude Opus and asked for a plan and tickets. The plan set out the tools (three.js for 3D, plain JavaScript with no build step, a Cloudflare Worker for online rooms) and listed the risks, each with the ticket that reduces it:
Client and server rules drift apart: one copy of the rules in game/src/sim/, imported by the server (tickets 3, 7).
Each ticket has a goal, the files to create, the numbers to hit and a "done means" list. The order matters: the empty project and its test command first, one Blender picture of the game camera second, the race rules third, and the real art ninth.
Read docs/brief.md. Write docs/plan.md and then 8 to 12 tickets. Each ticket: the goal, the files, the numbers, and a "done means" list with a test for each item. Put the rules in plain modules with tests before any drawing. Do not write game code yet.
Step 3: Build the rules before the pictures
Ticket 3 wrote the whole race with no graphics at all: driving, drifting, laps, CPU karts. Its goal, word for word:
All race rules as plain modules that run in Node with no browser. The renderer later only draws what these modules say, and the server imports the same files.
That one choice saved us later. The rules have tests that run in seconds, a script races six CPU karts with no screen, and the online server uses the same rule files, which keeps online and offline races in step. Timing and the network can still make an online race feel different. OpenAI Codex coding agents built the tickets one at a time, each as its own pull request. The first ticket merged at 05:32 and the eleventh at 09:06: 3 hours 34 minutes.
Step 4: Make the art in Blender, with scripts
Ticket 2 came before any game code: one picture of a street, rendered from the game camera, as a target for the look. Then ticket 9 built all 23 models (the capybara, the kart, hats, stalls, tuk-tuks, the bridge) from Python scripts that run in Blender with no clicking. Because the art is code, an agent can change it, rebuild it and check the file size the same way it changes the game. All the models together weigh 373 kB, under the 450 kB limit in the brief.
Step 5: Add online races
Here is how an online race works, in plain words. Each phone drives its own kart, so steering feels instant, and sends its position 10 times a second. A small server on Cloudflare runs one "room" per race. The room is the referee: it decides who got an item box first, who got hit, the laps and the finish order, and it drives the CPU karts. It sends everyone the whole race 15 times a second, and each phone draws the other karts about a tenth of a second in the past, so they move smoothly between updates.
The brief set hard limits so it fits Cloudflare's free plan, where 20 incoming messages count as one request. The server's fake-clock test of a full 3-minute race with 4 players measured 7,239 incoming messages ÷ 20 + 5 connections + 4 match requests = 370.95 billed requests. The Workers Free plan allows 100,000 requests a day (as of November 2026). That count covers only the requests the race room bills. The room also uses Durable Objects run time and storage, which have their own free limits on the Durable Objects pricing page, and each visit to the game page is a separate request. After a few real races, check the usage in your Cloudflare dashboard before you count on the free plan.
Step 6: Test with bots, then play it yourself
Every ticket had to pass npm run check: 65 game tests, 39 server tests, a bot that drives a lap by touch on an emulated phone, two bots that race each other online, and a balance check where a clean bot must win under 60% of 40 races. Bots are good at finding crashes. They are bad at noticing a game feels wrong, which is why the next step exists.
Step 7: Fix what the first player finds
Jay played the first build and wrote back two lines.
"capybara kart controls are reversed". Pressing left turned the kart right, on the keyboard and by touch. Every test passed, because the CPU karts and the test bot used the same wrong sign. The fix flipped the sign; the useful part was the new test, which presses the real keys and checks through the real camera that the kart's nose turns to the screen left.
"i don't think my position in the pack is accurate". Half a second after GO, the standings read 2, 3, 4, 5, 1, 0: the back rows ranked ahead of the front row. The brief for the fix told the agent exactly how to rank:
Rule: rank by (laps completed, then distance along the centre line on the current lap, then time at which that distance was reached). Project each kart onto the nearest centre-line segment, with a continuity check so a kart near a hairpin cannot jump to the far side of the track.
The new tests script races where the true order is known: an overtake in a corner, the finish line, a kart going backwards. Before the fix, the first two had 5 and 181 wrong frames. Both fixes were done in Claude Code, along with a redesign of the menus.
How long it took
The plan and tickets went into the repo at 02:03 on 11 November 2026, Bangkok time. The position fix merged at 18:01 the same day: 16 hours and 15 pull requests from an empty repo to the version you can play now. The brief for the next round is written: better driving physics, a garage with outfits for your capybara, and player names, so you can tell people from CPU karts.
Get the kit
The kit is not on sale yet.
The steps above are free. Leave your email and we tell you when the kit is on sale.
What the kit adds
- The whole game as a starter you run with 2 commands. One theme file holds the name, colours, hats, models and music; one tuning file holds every speed and difficulty number, explained in plain words. The README has a "to change this, ask your AI" prompt for each common change, and remix prompts swap the whole theme in one go (capybaras to cats, Bangkok to Tokyo).
- The brief, the plan and all 12 tickets that made the AI build it step by step, plus the brief for the next round (better driving, outfits, player names).
- The Blender scripts that make every 3D model, so your AI can change the art the way it changes code.
- The test bots and checks: 104 tests, a bot that plays by touch on an emulated phone, and a balance check for the CPU karts. A guide shows the bugs we found and the tests we added so they stay fixed: the reversed steering, the wrong race position and a storage hole in the race server.
- Launch guides: online races on Cloudflare's free plan, Google's game ads and in-game items, a phone speed checklist, and how to make your own music. We ship no music, so the music slot is empty until you add yours.
It also opens steps 8 to 10 on this page
- Step 8: Run the kit in 2 commands
- Step 9: Make it yours with two files
- Step 10: Test, then put it online
Questions people ask
Do I need to know how to code?
No, but you need to be at ease in a terminal: you run commands, paste prompts into a coding agent and read what it tells you. The game is plain JavaScript files with no build step, and the two files you change most have a note in plain words on every line.
What does it cost to run?
The game is a folder of files, so a free static host can serve it. Online races need the race server on Cloudflare. In the server's fake-clock test of a full 3-minute race with 4 players, the room counted about 371 billed requests, and Cloudflare's pricing page lists 100,000 requests a day on the Workers Free plan (as of November 2026). That is only the request part: run time and storage have their own limits, so check your dashboard after a few real races. The coding agents need your own AI plan.
Can I publish or sell a game I make with the kit?
Yes, free or paid, with ads or in-game purchases, with the capybaras or without them. You may not resell the kit itself as a kit or template. three.js, the 3D library, is MIT licensed; keep its licence file with your game.
Does the kit include music?
No. The kit ships without music, so you add your own. A short guide shows how to make a loop with an AI music tool and add it with one line in the theme file. The kit's LICENSE.md says what the kit covers.
What happens after I pay?
Stripe takes the payment and you come straight back to this page with every step open. The kit download button is in the Get the kit box. We also email you a private link so you can open the guide on another device.