Devlog · Tech
A 3D game in SwiftUI and WebGL: how Neon Courier 2099 works

Neon Courier 2099 looks like a native 3D game, but it's built in two halves: menus, progress and purchases are SwiftUI, while the ride itself is a WebGL game using three.js inside a WKWebView. Here's why, and what I learned along the way. To see how it plays, head to the home page.
Why two halves?
The menus had to feel like a proper iPhone app: Dynamic Type, VoiceOver, haptics, Game Center, purchases through StoreKit. SwiftUI does that best. For the ride, with rain, neon, traffic and drones, I wanted to iterate fast, in the browser, with instant reloads. JavaScript does that best. So each half gets what it's good at.
One file, offline
The whole game, three.js, engine and game logic, ships as a single HTML file inside the app bundle. It loads nothing from the network, which is why Neon Courier 2099 plays the same in airplane mode as on Wi-Fi. The only things that go online are the purchase, Game Center if you use it, and, if you own the full version, a report to RevenueCat that I use to analyse sales (details in the privacy policy).
Who decides what?
The key rule of the architecture: Swift owns progress, JavaScript owns every single frame.
- Swift turns bike, upgrades and contract into final numbers and hands them to the game as a configuration before the page loads.
- JavaScript drives: controls, camera, collisions, traffic, pursuit, HUD. During a ride only small status messages cross the bridge (progress twice a second, checkpoints, pause, haptics); physics and rendering stay entirely in the game.
- At the end the game reports raw data only: time, distance, damage, fragments collected. Rating and credits are computed in Swift again.
Swift validates every message from the game strictly: missing fields, wrong types or NaN are rejected, and implausible values (say, more distance than could be covered in the time) are capped. That keeps your progress clean whatever happens inside the web view.
The same engine for the garage
The bike spinning on the turntable in the garage is the same 3D engine in a different mode. What you see there is exactly the model you ride, with the same colours and upgrades.
Testing without fingers
Testing a game by hand is slow and imprecise. So there are three layers:
- Headless simulations: driving physics, deadlines and difficulty run through 79 cases without any graphics. Change a number and you see at once whether a contract is still beatable.
- An autopilot: test builds can be driven by an autopilot. UI tests let it ride whole contracts, the training run and Corporate Hunt, then check the result, credits and best times.
- Accessibility audits: the UI tests run Apple's accessibility audit over every screen, including at the largest text size, on a large iPhone and on the smallest screen.
What the setup costs
To be honest: the first ride after installing takes longer to start than with a native engine, because the web view has to compile the game first; after that it's half a second. And graphics need care: in Low Power Mode iOS caps the game at 30 frames per second; the game keeps the picture sharp anyway instead of lowering the resolution.
In return I can change a ride in the browser and see it instantly, and the app around it feels like any other iPhone app. For a game built by one person, that was the right trade.


