A 1:32 raceway at sundown

Dusk Circuit

You hold the power. The slot does the steering. Carry speed through the bends, lift before the tail steps out, and beat the teal car over five laps.

FreeRuns in your browserMouse · keys · gamepad · touchOne 220 KB file
LIVE DEMO · REAL-TIME WEBGL2640×360 · 67 COLOURS
Two slot cars side by side through a bend, sunset glowing through the hobby room windows.

Then hold left mouse, W or RT to race · Space or Y changes camera · Esc pauses

Open in its own tab ↗ Sound is off until you press M.
How it plays

The slot does the steering

Like the real thing, you only control the power. Racing is about judging how much speed a bend can take, and the second you can get back on the throttle.

Hold to go

Left mouse, W, the throttle pad or a controller's right trigger. Power ramps in over a quarter of a second, so short taps feather it through a corner. The trigger is fully analog.

Read the grip

The grip a bend demands rises with speed squared and with how tight it is. Near the limit the tyres squeal, the body rolls and the grip lamp glows. A controller with rumble starts to buzz.

Lift or slide

Overdo it for a moment and the tail steps out and scrubs off speed. Stay over the limit and the guide pin pops out of the slot.

Meet the marshal

A deslot costs about two seconds while the car is lifted back into its lane. You never gain lap distance while you're off the track.

BrakeRight mouse, S, the brake pad or the left trigger. Brake beats throttle when you hold both. The motor brake is fierce: lights glow, the nose dips and the motor note drops.
The circuit

17.7 metres of plastic track

A figure-eight with a bridge, built when the page loads. Below is a real flying lap recorded from the game: the cars are where the simulation put them, frame by frame.

Replay · 7.10 s flying lapSpeed 0 km/h (1:32)
Start lineSpeed through the lapFinish
  1. S/F

    Start-finish straight

    Gantry, pit garages and the grandstand. Lap timing starts and stops on the chequered line.

  2. 1

    Climb

    A long left that starts the climb onto the bridge. Flat if you're brave, a feather if the tail twitches.

  3. ↗

    The bridge and the plunge

    11 cm of clearance over the lower track, then the fastest part of the lap: a downhill run at about 335 km/h scale.

  4. 2

    Hairpin

    Bottom of the hill. Brake hard, wait for the exit, then squeeze. Most races are won or lost here.

  5. 3

    Underpass

    A medium right that dives under the bridge. A short lift, then power early.

  6. 4

    Esses

    A sweeping left then right (4 and 5). Carry speed and keep the car tidy.

  7. 6

    Carousel

    A double left (6 and 7) back onto the straight. Lift early, then power out.

7 cornersLanes equal to 0.17 cmBridge clearance 11 cmLap ≈ 7 s
Three cameras

Watch from the rafters or the bonnet

Press Space to cycle. Views blend over a second, or fade quickly if you turn on reduced motion.

Chase

Instruments

Every needle is real

The dashboard, map and controller are drawn pixel by pixel from the live simulation. Nothing is faked for show.

The bonnet camera: the vermilion bonnet, the dashboard with speedometer, rev counter and lap readout, the track map and the handheld controller.
  1. Race statusPosition, lap, lap time, best lap and the live gap to the rival.
  2. Track mapBoth cars at their real positions, with the next corner lit.
  3. Speedometer1:32 scale km/h, straight from the car's speed.
  4. Lap readoutLap count, running time and best lap.
  5. Grip lampAmber near the limit, flashing red when the tail lets go.
  6. Motor RPMFollows the wheels, with a flare at launch and when the rear spins.
  7. Your controllerThe trigger follows the throttle, the brake lamp reacts instantly, and the coiled cable bounces as you accelerate.
The rival

Teal, gold and on the same physics

The rival doesn't cheat. It reads a speed map of its lane, brakes for corners and gets back on the power on the exit, all through the same tyres, motor and slot as you.

  • Now and then it overcooks an entry and slides, or hesitates on the way out.
  • Once in a while it lunges at the hairpin and pops out of the slot.
  • Five laps, a three-light start and a compact results card. Hold the throttle to go again.
  • Your best clean lap (one without a deslot) is saved in your browser.
The results card after five laps: race time, best lap, the rival's time, deslots and the lap list.
The hobby room

A model railway room at golden hour

Low sun through sash windows lays warm bands across the flocked grass. Violet shade pools under the bridge. Lamps and pit garages glow amber. Every tree, rock, screw and coil of controller cable is generated as the page loads.

Under the hood

One file. No libraries. No images.

The whole game is a single HTML file: raw WebGL2 for the world, Canvas 2D for the instruments, Web Audio for the sound and the Gamepad API for controllers and rumble. Everything you see is drawn by code.

1HTML file, about 220 KB. No build step.
0Libraries and image assets.
67Palette colours. Every final pixel uses one.
240 HzFixed-step physics. Same lap times at any frame rate.
0.17cmLane length difference over a 17.7 m lap.
105kTriangles generated at load.

A track that closes itself

The layout is a list of straights and arcs. Their curvature is smoothed so nothing kinks, integrated into a path, and two straights are solved so the loop closes exactly. Elevation and banking get the same smoothing.

Because a figure-eight turns left as much as it turns right, the inside and outside lanes come out the same length. Each slot is its own arc-length spline.

Light through real windows

Sunlight is worked out per pixel: each point traces toward a low sun and checks the window panes, so the warm bands on the table line up with the glazing bars. A shadow map adds long shadows, and a top-down height map pools violet shade under the bridge and the trees.

Pixels on purpose

The scene renders at about 340 px tall. A post pass outlines the cars, then snaps every colour to the best pair of palette entries through a 64³ lookup table built in OKLab, and dithers between them with a 4×4 Bayer matrix.

Physics you can feel

A DC-motor torque curve, drag, slope and a grip budget boosted by the car's magnet. Brief excess becomes a tail slide that scrubs speed; sustained excess pops the guide out. The rival runs the same model with a speed map of its lane and the occasional human mistake.

Sound is synthesised too: motor whine tied to RPM, rail chatter, tyre squeal, clicks over every track joint.

Controls

Hold, lift, brake

ActionMouse & keysControllerTouch
ThrottleLeft mouseorW↑RTanalogThrottle pad
BrakeRight mouseorS↓LTanalogBrake pad
CameraSpaceYCAM
RestartRViewR
PauseEscMenuII
SoundMXSound button
Questions
Can I use a game controller?

Yes. Connect any standard gamepad and press a button. RT (R2) is an analog throttle and LT (L2) an analog brake; Y changes camera, Menu pauses, View restarts and X toggles sound. Controllers with rumble buzz as you near the grip limit and jolt when you deslot.

Does it work on a phone?

Yes. Big throttle and brake pads appear on touch screens, and you can hold both at once. Landscape is best.

Why is there no sound?

Sound starts off and only begins after you press M or the sound button. It also pauses whenever the game or the tab does.

What counts as a clean lap?

A lap with no deslot. Your best one is kept in your browser's local storage. If storage is blocked, the game still works and just forgets it later.

Will it run on my laptop?

It needs WebGL2, which modern browsers have. If frames get slow it drops its internal resolution on its own.

Can I read the code?

Yes, all of it, in one file. It's on GitHub.

Hold to race

Five laps, one rival and one sunset that never quite ends.