How We Built Vapor Drift: Synthwave Racing Tuned by Prompt
Top-down time-trials, three tracks, ghost replays of your own best lap — and a drift mechanic that lives on exactly one physics coefficient. Here's how the AI pipeline built a synthwave racer that felt right on the sixth iteration.
Browser racing games usually pick one of two camera angles. First-person gives you the dashboard fantasy but asks a phone GPU to render a world to the horizon. Side-scrollers dodge that but lose the feeling of lines and apexes. Vapor Drift went with the third option: top-down. You see the whole corner before you enter it, which turns every lap into a thinking exercise rather than a reflex test.
What the AI built was a three-track synthwave time-trial with ghost replays of your best lap, waypoint-validated corner cutting prevention, drift physics on a single grip coefficient, and time-gated unlocks. Here's how it came together over six iterations.
Want to play first, then read the build story?
▶ Play Vapor Drift NowWhy Top-Down Was the Right Call
The brief was short: "Synthwave racing game. Three tracks. Time trial — no AI opponents. Make it feel like driving a neon sports car through an 80s album cover." The camera angle was left open.
We expected first-person. What came back was top-down, with an argument: top-down is a racing puzzle, first-person is a reflex puzzle. With a one-to-three-minute session and no AI traffic, reflex doesn't have much to do — the interesting decisions are racing line, brake point, and when to commit to the drift. All easier to see from above. A top-down camera also spends its rendering budget on the track itself instead of trying to paint palm trees and sunset gradients on the horizon every frame.
The Drift Mechanic Is One Number
What does drift actually do? Realistic sims model tire slip angles and weight transfer; arcade racers fake it. We were never shipping a tire model in a browser canvas.
The AI proposed treating drift as a lateral-grip modifier. The car's velocity has two components relative to its facing direction: forward speed and sideways slide. Every frame, the sideways slide gets bled off — the car wants to go where it's pointed. The rate of that bleed-off is a single coefficient. Press the drift key and the coefficient drops; the back end steps out. Release and the line tightens. Hold a real slide and it also banks a little boost time, capped at a second and a half — but the handling is that one number.
It sounds too simple to feel good. In practice, tuning that one number is the difference between a car on rails and a car on ice. Drift too early and the car washes wide of the apex and onto the grass, where a heavier drag and a hard speed cap do the punishing; drift too late and it won't rotate in time. On a straight, where there is no sideways slide to preserve, holding it does nothing at all.
Waypoints Prevent Cheating the Line
A top-down racer has an obvious exploit: cut across the grass. The fix is waypoint validation — the track is a chain of ordered checkpoints the car has to tick off in sequence before the lap closes at the line.
The three tracks carry seventeen, fifteen and twenty waypoints. The tolerance radius — nine tenths of the track width — forgives a tight racing line but won't let you straight-line an infield: miss a waypoint and the lap simply doesn't close until you go back for it. Cutting the grass is punished on its own timer, with a fifth of a second off-track enough to flag the lap invalid, so the time won't save and the unlock won't trigger. Density matters: too few and you can straight-line between them, too many and a chicane becomes a corridor too narrow for the racing line. The first version of Track 1 let you cut the infield. The shipping version fixed that with the same shape and a denser chain.
Ghost Replays: Position, Rotation, Twenty Hz
The only opponent in Vapor Drift is yourself — your best lap, rendered as a translucent teal car retracing its path while you drive. Ghost systems sound simple until you build one.
Push a sample into an array every fifty milliseconds. Each sample holds x, y, facing angle, and time offset from the lap start. On a new personal best, the array replaces the stored ghost and gets written to localStorage. Next lap, the ghost retraces its path by interpolating between samples based on elapsed time.
The subtle part is interpolation. Position is a standard lerp. Angle needs a shortest-angle-delta helper — interpolating raw radians across the pi wrap-around produces a car that spins backwards through a full rotation every time. That bug showed up in the first implementation and took one iteration to isolate.
The ghost's playback clock resets when the player crosses start/finish, so a ghost three seconds ahead at one line stays three seconds ahead at the next. You don't chase a ghost that's always ahead — you chase the shape of its line. It's a better teaching tool than we expected: the ghost shows where you braked early, where you gave up exit speed, where your line drifts wide.
Time-Gated Unlocks Without the Grind
Two of the three tracks unlock in sequence. Sunset Boulevard is open from the start. Neon Oasis — a figure-eight that crosses itself, with a chicane on the right lobe — unlocks when you set a clean lap under the Sunset target. Palm Reef, the narrowest and twistiest of the three, built around back-to-back S-curves and one long straight, unlocks off a clean target on Neon Oasis.
The tricky question was where to set the targets. Too loose and the unlock happens on lap one. Too tight and the player bounces off Track 1. The AI's first proposal was the halfway point between a clean first-attempt lap and an optimal lap, which turned out to be right — a focused player hits the target in a handful of runs. Unlock flags persist in localStorage, so the unlock is a one-way ratchet.
The Synthwave Visual System
The palette — hot pink, cyan, purple, sunset orange on deep violet — landed on the first pass. The work was in composition. A sky gradient sits at the back. Above it, a perspective grid fans from a horizon with horizontal lines at quadratic spacing and vertical lines that slowly scroll. The track has a dark surface with a hot-pink line down one edge and a cyan line down the other, both carrying a glow shadow. A CRT scanline overlay sits on top at low alpha — you don't notice it while playing, but the screen looks wrong if you remove it. Each track also carries its own accent colour, which shows up in the speed lines streaking off the car at high speed and during a boost.
Two Input Paths, Both First-Class
Desktop is arrow keys or WASD, with Space or Shift for drift. Mobile is two-zone touch — tap-and-hold the left or right half of the canvas to steer — with fixed overlay buttons for gas, brake, and drift. Both paths were in the first iteration; neither was a fallback.
What makes mobile controls work is that touchmove calls preventDefault, the canvas has touch-action: none, and handlers are registered non-passive. Without those, scrolling steers the car or steering scrolls the page. Multi-touch matters — players press gas and drift simultaneously while holding a steering zone with another thumb. A single-touch shortcut would have felt broken from the first corner.
What the Sixth Iteration Added
Vapor Drift went through six iterations. The fifth added a Web Audio sound package — engine rumble that shifts pitch with speed, drift whoosh, countdown beeps, a personal-best chime. The sixth was polish: larger HUD buttons, vapor grid behind the pause overlay, and a tightened pause delta accumulator. Each iteration scores against a rubric; the sixth landed three half-point fixes, cleared the ship threshold, and stopped. Polishing past the ship line mostly risks regressions.
What Surprised Us
Racing has a lot of established design language — lap times, ghost replays, target times, unlock chains. The AI didn't invent any of it. What it did was pick the right subset: drop AI opponents because they're expensive to render and shallow to fight; keep the ghost because it's a richer teacher than a rival; use time gates rather than coin purchases; make drift a single coefficient because two would be one too many to balance.
The depth lives in the tuning pass. The drift coefficient, the waypoint density, the unlock targets, the ghost sample rate — none are interesting decisions on their own. Tuned badly, any one makes the game unplayable. Tuned well, they vanish. Nobody playing Vapor Drift notices the sample rate or the waypoint count. They just feel the line getting tighter, the ghost slipping behind, and the next track waiting on the select screen.
Play Vapor Drift — the Sunset Boulevard target is the one to beat first. The ghost is watching.
Related reading: The Overnight Game Pipeline: How We Ship Games While We Sleep · What Is Vibe Coding? · Vibe Coding Tools: From Chatbots to AI IDEs · How We Built Path Runner