← Torna al blog

One racing game, six ways: Three.js, Bloom and Bevy, built by the same agent

Same game, same assets, same agent, six stacks. Among the native builds, Bloom finished fastest with the smallest app. Porting a Three.js game touched two lines of it. three.js's own WebGPU renderer compiles correctly but runs 10–12× too slow. And on the web, Three.js is still ahead of us. All code and logs are public.

The Three.js build mid-race in Chrome: red car at 228 km/h, minimap and lap counter The Bloom build's finish screen: YOU WIN, with lap times for all four cars
Same game, same assets. Left: arm A1, Three.js in Chrome. Right: arm B, Bloom's own APIs (here its WebAssembly build).

Why we did this

"Is Bloom good?" is not a useful question on its own. The useful one is: if you sit down to build a real game, how far does each stack get you, and where does it hurt? So we wrote one spec for a small arcade racer and built it five times. Every build had the same 12-point Definition of Done and the same assets, and all five reached a playable 3-lap race. A sixth arm tried the same native port on a real open-source Three.js project; that port is unfinished. The same coding agent (Claude Opus 5.5 in Claude Code) did all the work.

Using an agent instead of a person was deliberate. It does not get tired, it does not already know our engine, and it writes down every wrong turn. The weakness is just as real: the result says as much about how well each stack's docs and error messages guide an agent as about the stack itself. Keep that in mind for everything below.

The setup

  • One asset set, generated entirely by script and released as CC0. It has a coupé with four colour variants and a 2.2 km circuit with a hairpin, a fast sweeper, an S-section and a hill. It also has scenery, a sky, synthesised audio, UI icons and a manifest describing every node, spawn point and checkpoint. Every file passes the Khronos glTF validator with zero errors.
  • One spec, word for word in every prompt. It asks for 3 laps against 3 AI cars, nitro, drifting, no wall tunnelling at top speed, auto-reset and anti-shortcut checkpoints. It also asks for two cameras, keyboard plus multi-touch plus gamepad input, engine audio that follows the revs, a full HUD with a minimap, and a best lap that survives a restart. The target is 55 fps or better on an iPhone 12-class phone.
  • Six arms, each in a fresh folder with only the docs for its own stack:
    • A1: Three.js + TypeScript in the browser.
    • A2: the finished A1 game compiled to a native app with Perry, on Bloom's Three.js bridge, changing as little as possible.
    • B: Bloom's own APIs (wgpu rendering, Jolt physics, audio, 2D UI), in TypeScript compiled by Perry.
    • C: a hybrid, with Three.js on the bridge for rendering and Bloom for physics, input, audio, HUD and storage.
    • D: the A2 treatment applied to a real open-source Three.js project, Bruno Simon's folio-2025. Unfinished: see below.
    • E: Bevy 0.20.1 with avian3d physics, in Rust.

Each agent kept notes and a friction or port log as it worked. Everything is public in Bloom-Engine/racer-experiment: the prompts, the code for every arm, the logs, the benchmarks and the asset generator.

Four cars in red, blue, yellow and black on the start grid under the START FINISH gantry
The shared asset set, rendered from its own glTF files. Every arm started from exactly this.

Bloom native was the shortest road to a finished native game

Arm B finished its game in 1 h 13 min of working time (wall-clock time minus the time the agent sat waiting for us). On the same basis the hybrid needed 2 h 12 min and Bevy 2 h 25 min. (The browser-only Three.js build, A1, took 33 min, but it is not a native app.) B also produced the smallest app (71 MB on macOS, 76 MB on iOS, against 131 / 130 MB for Bevy) and had the fastest edit loop: a one-line change rebuilt in 5.4 s. Bevy needed 10–12 s on its dev profile, and 5 min 46 s for the same one-line change in a release build, because thin LTO re-optimises the whole program. The hybrid needed about 2.5 minutes, because Perry recompiles all of three.js on every build. On an iPhone 16 Pro, B held a steady 60 fps (the vsync cap) through a full race on its Low preset.

It was not free. B logged 29 friction entries, the most of any arm, though 9 of them come from a WebAssembly port it built on top of the brief. It also used the most input tokens: 61.7M, against about 36–44M for the other native arms. The top items on its wish list are things we should have had already:

  • a way to get triangles out of a loaded glTF for colliders;
  • engine sources that pass strict tsc;
  • an iOS packaging flow that does not need hand-made provisioning profiles;
  • a body-mass setter and a per-substep physics callback.

Porting a normal Three.js game touched two lines of it

Arm A2 took A1's finished browser game and made it a native macOS and iOS app. The port log has 17 entries and 428 changed lines, and only 2 of those lines are in the game. The rest are adapters (222) and build and packaging (204). Physics, AI, camera and game state compiled and ran unchanged.

The interesting part is where the frame time went. On the iPhone the port first ran at 38.4 fps, and the cause was not the 3D scene. It was the HUD: A1 used ordinary DOM and CSS, and the bridge's page engine spent 14–17 ms per frame on about 10,200 draw calls of HUD decoration at 3× scale. A phone profile (Low preset, a flat HUD stylesheet, page updates at 30 Hz) brought it to 59.5–59.8 fps. None of the three was enough alone: the Low preset by itself gave 43.9 fps, and Low plus 30 Hz page updates gave 49.4. A second bug was quieter. Our Web Audio emulation kept every scheduled AudioParam event forever, and the game slid from 57 to 35 fps after about three minutes. Both are bridge problems, and both are fixable without touching anyone's game.

The same bridge gaps, three times

A2, the hybrid and the folio port hit the same holes in the bridge. Points, Sprite, Line and InstancedMesh are not drawn. Normal and ORM maps are dropped. The equirectangular sky background is missing, and the 2D canvas is incomplete. The games still ran, but particles, speed lines and skid marks quietly went missing, and each agent lost time finding out why. The hybrid's top request was not a feature at all but a feature matrix in the bridge README, so you know what works before you start.

A real-world port is a different animal

folio-2025 is not a racing game. It is a rich open-world portfolio built on three.js's WebGPU renderer and TSL node materials, with Rapier physics, GSAP, Howler and a pile of custom shaders. That made it a good stress test. The agent wrote an inventory of every dependency first, with a prediction for each. It then ported the game with zero lines of game code changed, using an ~820-line Rapier-to-Jolt facade, patched copies of three libraries and a staged asset pipeline.

It also found Perry bugs that no small test had caught. GSAP failed with TypeError: value is not a function, and Howler hit a temporal-dead-zone error. The worst one was silent: spreading an array into the constructor of an imported class passed the whole array as one argument, so every TSL colour in the game came out white. Most of folio's look comes from shaders (grass, water, foliage, GPU particles, post-processing), and that does not survive a renderer that cannot run TSL. The inventory's predictions held for the big items but missed GSAP, Howler and seedrandom. The agent's log stops before its final summary, so treat D as a map of what breaks, not a finished port.

Can three.js run its own WebGPU renderer on Bloom?

That question decides how we bring Three.js to Bloom. Either we keep re-implementing three's renderer in the bridge, or we give three a navigator.gpu backed by wgpu and let it render itself. A spike compiled about 90,000 lines of unmodified three.js r187 (WebGPU renderer, TSL, compute, post-processing) with Perry and ran it against a recording fake GPU. The answer is in two parts:

  • Correct. After two Perry fixes, the generated WGSL and every byte uploaded to the GPU were identical to the same code running in Node.
  • Too slow. Perry used 3.4–5.0 ms of CPU per frame against 0.33–0.37 ms in Node, about 10–12× slower. About 62% of that time went to runtime slow paths. A missing-property lookup on a deep class chain costs 39.8 ns in Perry against 0.7 ns in Node.

So the route is viable, and the blocker is now Perry's runtime, not our engine.

On the web, Three.js is still ahead

We also raced Bloom's WebAssembly build of arm B against A1 in Chrome on an M1 Max, over 5 interleaved rounds. Both held 120 fps, and in the median run neither dropped a frame past 25 ms. On everything else Bloom lost:

  • it loaded in 3.44 s against 0.56 s;
  • it used 4.28 ms of page CPU per frame against 2.00 ms;
  • Chrome as a whole used 78.4% of one CPU core at idle against 35.1%, and 78.1% against 55.6% during a race (summed over all of Chrome's processes; an empty Chrome tab uses 3.4%);
  • Chrome's total phys_footprint across all its processes was about 380 MB higher during a race (1,378 MB against 994 MB, medians).

The builds do not render identical effects, so this compares the apps as built, not the engines in isolation. Even so, Bloom on the web is not where it needs to be yet.

Bevy: solid, and heavy

The Bevy arm built a complete game too: about 5,800 lines of Rust in 16 modules, passing its own scripted checks for every gameplay item on macOS. Its costs were build time and size. A clean macOS release build (empty target directory, Bevy's default features) took 11 min 27 s, the binary was 95 MB, and the agent spent about 75 minutes waiting on the compiler. Most of its 14 friction entries were API renames between Bevy versions and ECS access conflicts reported without system names. It was never run on a real phone; the only mobile number is 59.2 fps in the iOS simulator.

The numbers

A1 Three.js webA2 portB BloomC hybridE Bevy
Agent working time†33 min2 h 381 h 132 h 122 h 25
Model calls62165186138163
Input tokens12.0M36.3M61.7M37.4M≈44.2M
Output tokens175k112k184k156k≈214k
One-line rebuild–≈16 s5.4 s≈2.5 min10–12 s dev / 5:46 release
Clean release build–≈2 min first native build‡267 s≈2.5 min11 min 27 s
macOS app36.5 MB web94 MB71 MB52 MB binary + 48 MB assets (no .app built)131 MB
iOS app–103 MB76 MB≈107 MB130 MB
iPhone 16 Pro–59.5–59.8 fps*60 fps59.96 fps avgnot run
Friction / port-log entries–17291614

* With the full phone profile (Low preset, flat HUD stylesheet, 30 Hz page updates); 38.4 fps without it.
Arm D is not in the table: its port is unfinished and it has no time or token record.
† From the first prompt to the agent's last message before we asked it to log its effort, minus every stretch where it was waiting for us. Raw wall-clock times: A1 33 min (no waits), A2 2 h 57, B 1 h 27, C 3 h 20 (68 min of it waiting for us to unlock an iPhone), E 2 h 56.
‡ What A2's port log measured: the first native build, not labelled as a release build, excluding the one-off ≈26 min build of Perry itself. B's clean build excludes the 282 s one-off engine build. Sources for every cell are linked from the repository README.

What this does not show

  • Arm D is unfinished. The folio port's log stops before its summary and never says whether the game is playable. Read it as a map of what breaks, not a result.
  • One run per arm. These are anecdotes with numbers attached, not statistics.
  • No iPhone 12-class phone was tested. All phone numbers come from an iPhone 16 Pro, Bevy's from the simulator.
  • Nobody tested multi-touch or gamepads with real hands, and the Bevy arm's audio was never listened to.
  • The toolchain moved during the experiment. The hybrid pinned an older Perry because the newer one miscompiled three.js.
  • We make Bloom. We published every log and the full code so you can check our reading of them.

What this tells us to fix

Fixing now

  • A bridge feature matrix, so you know what works before you start.
  • An AudioParam event history that gets pruned.
  • In Perry: the spread-constructor and TDZ bugs.
  • In Perry: incremental builds that do not recompile three.js.

Bigger, no date yet

  • Drawing for Points, Sprite, Line, InstancedMesh, normal maps and the sky background.
  • A faster page engine for HUDs.
  • glTF mesh introspection for colliders, strict-tsc-clean engine sources, and an iOS packaging flow with no manual steps.
  • In Perry: the property-lookup slow paths that block three's own WebGPU renderer.
  • A faster-loading, leaner WebAssembly build.

Clone the repository, run any arm, rerun make assets, or point your own agent at the same prompts and tell us what you get.