Race to Treasure Island: Building a Web-Native Phaser Game with Free AI

Why the fourth browser game went Phaser instead of Pygbag, how boost/wind/overtaking mechanics evolved, and what the AI model workflow looked like.

After three Pygbag/WebAssembly ports (Cannonball Clash, Treasure Cove, Kraken’s Wake), the fourth browser game took a different path: a web-native Phaser 3 game built in TypeScript. Race to Treasure Island is the project’s most iterated browser game — and the first web-native one.

Why Phaser Instead of Pygbag

The first three browser games are Python/Pygame code compiled through Pygbag to WebAssembly. They work, but:

For a side-scrolling racer with real-time input, these constraints mattered. Phaser 3 gives:

The OutRun Direction

The initial design was a top-down racer. After playing with the physics, the game leaned hard into the OutRun feel:

The goal was a 30-second race that feels tight every time.

Touch Mode Was the Hardest Part

The desktop keyboard version (arrow keys + Shift boost) came together quickly. Touch controls took many iterations:

The final touch layout uses a left/right steer zone, a hold-to-boost button, and separate pause/restart controls.

Model Workflow: DeepSeek V4 + Nemotron

The development followed an iterative pattern:

This workflow — broad passes on a capable cloud model, narrow fixes on a local model — worked well for a solo project with no paid subscriptions.

Debug Hooks for Deterministic Testing

The game exposes a window.__paRace* API for Playwright:

This lets the test suite verify specific behaviors (hit penalty, boost effect, overtake cue timing, win/loss states, restart clearing) without simulating gameplay frame by frame.

What Remains Imperfect

A Note on the Model Claims

These observations are session notes, not benchmarks. Each model was used for different tasks at different stages. The relative quality reflects what the prompt asked for and how clearly the problem was scoped — not a general ranking of model capability.

The full experiment methodology is documented in EXPERIMENT.md in the desktop repo.