Personal project · 2026
Trailhead: an off-road driving game built in Godot
An off-road driving game where the world, the truck and every sound are generated by code. I designed and directed it, and built it with AI coding agents under a harness I set up.

At a glance
- What it is
- An off-road driving game. Three timed climbs up mountain and desert trails are complete; an open-world Explore mode is in progress.
- My part
- I designed and directed it. It was built with Claude Code, an AI coding agent, under a harness I set up, with a gated roadmap, an independent evaluator at each milestone and playtest stops for me.
- Status
- Playable prototype on Windows, not released. The repository is private.
On this page
01What it is
The mountain is the opponent
Trailhead is an off-road driving game I’m building in Godot 4. You drive a lifted, 4Runner-inspired off-road SUV up mountain and desert trails. There are three timed destinations, an alpine summit, a glacier lake and a desert arch, each with green, blue and black routes, and an open-world Explore mode with a generated trail network and a GPS.
Getting up a trail is about reading the ground, choosing a line and a drivetrain setting, and arriving at a loose climb with enough speed, without rolling the truck. Everything in the game is generated by code when it loads: terrain, roads, trees, rocks, water, the truck itself, the sky and weather, and every sound. The repository contains no imported models, textures or audio files.
It is also an experiment in the work I do professionally. I designed and directed the game, and it was built with Claude Code, an AI coding agent, working under a harness I set up. How that harness works is the first of the engineering details below.

02Status
Where it stands
- The timed game is complete. Title screen, level select, three levels with three routes each, medals, Expedition and Time Trial modes, results, saves, settings, keyboard and gamepad.
- Explore mode is in progress. A streamed 6 × 6 km open world that holds all three timed maps, with a generated trail network, GPS routing, camps, viewpoints, fords and bridges. The newest work, still on a branch, grows the world and redesigns one of the levels.
- Next on the roadmap: a winch and camping, random events, more weather and wildlife, then a final pass on look and performance.
- Not released. It runs on Windows from the Godot editor. There is no public build yet, and the repository is private.
03Screenshots
Screenshots
All frames are rendered by the game at 1920 × 1080 and are unedited. Select one to enlarge it.








04Features
Features
World and terrain
- Deterministic generated levels. Each level script shapes a heightfield and writes surface, trail, moisture and forest data for it.
- Roads built the way mountain roads are: grade-limited, crowned or cambered, with cut and fill banks, widened hairpins, water bars and rock steps.
- Terrain in chunks with four levels of detail, displaced in a shader so the finest level is exactly the collision surface.
- Nine surface types from rock to snow, where one id drives the look, the grip and the sound.
Explore mode (in progress)
- A 6 × 6 km world streamed from 1 km tiles on worker threads, with collision built only around the truck.
- Biomes as data: desert, montane, alpine and glacial, blended per pixel, with fog and colour following the biome.
- A generated trail network with an automated report that checks grades, run-ups and ford depths.
- GPS routing over the trail graph, with Fastest, Easiest and Scenic profiles and a dash unit on the HUD.
Vehicle physics
- A custom vehicle model on one rigid body: per-wheel suspension, a brush tire model and loose ground that digs in.
- A simulated drivetrain with high and low range, and rear and front lockers on one key.
- A readable rollover margin on the HUD, and slopes too loose to crawl that need speed on the way in.
- Deep water that can flood the engine, with a bow wave that grows with speed (newest work).
- Rewind: hold a button to take the truck back through the last 15 seconds.
The truck and its effects
- Built in code: body, glass, lamps, chassis, suspension and wheels are generated meshes.
- A lighting rig of low beams with a projector cut-off, a roof bar, ditch lights and rock lights.
- Terrain feedback: wheels sink, ruts form in mud, sand and snow, and loose rocks roll.
- Cosmetic damage with armour: dents, scratches, cracked lamps, undone by rewind.
Sky, weather and light
- A sky shader with ray-marched clouds whose shadows on the ground match the clouds you see.
- A day and night cycle with real sun and moon paths, moon phases, stars and the Milky Way.
- Weather that builds and clears: rain, hail, lightning, thunder delayed by distance, and wet grip.
- Wetness everywhere: terrain, rock, foliage and paint darken and gloss, and puddles fill.
Audio
- A real-time engine synthesiser running on a worker thread, with no samples.
- Every other sound synthesised at load, from tires and impacts to birds, wind and thunder, then cached.
- Sparse generative music, silent while driving except near the summit.
Camera
- A chase camera that adapts to speed and slope, plus scout, hood and orbit views.
- A rear-view mirror rendered through a second viewport.
- A summit reveal that searches for a postcard framing with a clear view of the truck and the scenery.
- Photo mode with field of view, exposure, depth of field and time of day.
Game flow and UI
- A driving HUD: inclinometers, wheel contact, a compass strip, gear, range and locker state, medal pace.
- A topographic trail map rendered on the GPU from the terrain data.
- Checkpoints, splits and medals, per-level challenges, and pace notes before hazards.
- Menus over a live level, with a conditions picker and settings that apply as you change them.
Tooling and tests
- An autopilot that drives any route, including GPS routes, and reports JSON.
- A regression harness with a quick gate per feature and a full gate per milestone: smoke runs, drives, world-hash checks, image diffs.
- A vehicle test bench with scripted experiments and a keyboard bot.
- Screenshot and UI-tour automation, GPU benchmarks and audio analysis.
05Technologies
Technologies
- Engine
- Godot 4.7, Forward+ renderer on Vulkan
- Language
- GDScript only, statically typed throughout. No C#, native extensions or plugins.
- Shaders
- Godot Shading Language: terrain, rock, foliage, water, sky, weather, vehicle, particles, post-processing and UI
- Physics
- Jolt Physics at 120 Hz with a custom suspension, tire and drivetrain model; Godot’s built-in vehicle is not used
- Assets
- None imported. Meshes are built in code, textures are generated images, sounds are synthesised.
- Rendering
- Multimesh instancing, hand-built terrain levels of detail, tile streaming, soft shadows, colour grading
- Concurrency
- Worker threads for world generation, tile streaming, and texture and sound baking
- Tooling
- PowerShell runners, Git with one worktree per module and one branch per milestone
- AI coding agent
- Claude Code, working to a gated roadmap
- Platform
- Windows desktop; keyboard and mouse, or a gamepad
In numbers: 747 commits between 3 and 30 October 2026, about 105,000 lines of statically typed GDScript in 175 files, about 8,800 lines of shader code in 56 files, and no imported image, model or audio files.
06Engineering details
A harness for a long-running coding agent
Of those 747 commits, 720 were co-authored by Claude Code. The interesting part is not the volume but the rules that kept an agent working for days at a time without drifting. The history shows three phases.
A parallel build behind contracts. The second commit stubs every module behind stable data contracts, with an ownership table that gives each subsystem its own files. Eight modules (terrain, scatter, environment, physics, truck model, camera, audio and UI) were then built on separate branches, each in its own git worktree, and merged within about a minute of each other.
A long-running agent on a gated roadmap. I approved a written roadmap with milestones, performance budgets and a “won’t have” list. Its rules:
- A feature list the agent can only mark as passing. Each of 97 features has acceptance criteria and a command that verifies it. The agent may change only the pass flag and its notes; the regression harness compares the file with a git tag and fails on any other edit. New ideas go to a separate proposals file for me to accept.
- One feature at a time, each behind an automated regression gate, with a fuller gate at the end of each milestone.
- A fresh-context evaluator at every milestone, because, as the roadmap puts it, agents over-praise their own work. The evaluators do fail work: the open-world vertical slice failed four rounds on water and terrain seams before it passed on the fifth, graded by a panel of two.
- Playtest stops at six points where feel matters more than any test. The agent merges, writes a checklist, and waits for me.
- A paper trail: an append-only session log, numbered decision records, and numbered open questions for me to answer.
Multi-agent workflows with critics. For the newest content work, each map has its own workflow: a plan, a builder for the look, a builder for the roads, a code review and a critic, then a fix pass. Planning and critique run on a different model from the builders, and an adversarial verifier caught a fix that had not fully closed a water bug. My part in this phase is direction: feedback on the look, reference photos, and the calls recorded as decisions.
An agent can’t see the screen, so the game has tooling built for one: named camera shots for every level, an autopilot that drives any route and reports JSON, a runner that fails on any script error, golden-image comparisons, and a machine-wide lock so only one run uses the GPU at a time. It is the same approach as my agent toolkit at work: written rules, scripts for anything that must be repeatable, and a person deciding what counts as done.
No asset files, and a cache keyed by its own source code
The repository has no imported models, textures or audio. Meshes are built vertex by vertex, textures are generated images, and every sound is synthesised, including the engine, which is modelled from the crankshaft’s rotation on a worker thread.
Generating a level is deterministic but not instant, so the result is cached on disk. The cache key is a hash over the engine version, the level’s seed and the source text of every generator script the level uses, followed transitively, with comments excluded. Any code change invalidates exactly the entries it affects, with no version numbers to bump by hand. Writes are atomic, large arrays are compressed on worker threads, and a verify flag regenerates a level and compares it byte for byte.
One consequence became a written rule: open-world classes can’t have generic names like Trail. The key follows every capitalised word that names a global class, so a generic name would quietly pull open-world code into the timed levels’ cache keys.
Vehicle physics from scratch, tested by a bot that types
The truck is one rigid body in Jolt Physics, stepped 120 times a second. Everything else is custom GDScript rather than Godot’s built-in vehicle:
- a shape cast per wheel, so large tires roll up rock edges instead of snagging on them;
- progressive springs and bump stops on a solid rear axle;
- a brush tire model with a friction circle and load sensitivity, and loose ground that digs in;
- a drivetrain with a torque curve, torque converter, automatic gearbox, high and low range and lockable differentials, solved four times per physics step.
The HUD shows a tip margin, the degrees left before the truck rolls, computed from its support polygon and the effective gravity on it.
Metric tests were not enough to judge feel. A test bench runs scripted experiments side by side and prints a pass/fail table, and a keyboard bot presses W, A, S and D on a timeline through the same input shaping a player gets. The bot found problems the metric tests had missed: short taps of the throttle did nothing on hills, handbrake turns did nothing with the centre differential locked, reverse was far too fast, and every jump over a crest raised a false rollover warning.