01One coefficient
I traced every car sliding and never recovering to the lateral shape factor in the magic formula. At 1.35 the sliding tail sat at 85% of peak grip, so a tyre dragged fully sideways still returned about 1.5 g and a slide never scrubbed off speed. Moving it to 1.63 drops that tail to 55% of peak; peak grip is set by D, not C, so the change moved only the far side of the curve — how a tyre behaves once it has let go.
02Testing feel
simtest.js drives the real physics, AI, track sampler and timing system with no browser, so its lap times are the numbers the game shows, and a full twelve-circuit sweep takes a few seconds. A valid lap under the circuit's real record is reported as SUPERHUMAN and fails the run. drivetest.js is the stranger harness: 21 gates measuring steering build-up, speed-sensitive lock, reverse engagement and snap resistance, which I run on an infinite flat plane so a result can never be contaminated by running off a real circuit.
03Drivers, not cheats
Every AI car runs the identical vehicle physics the player does — same grip, power and mass. Difficulty moves only a pace ceiling, a consistency band and an error rate, never the simulation. I wrote no brake-point table anywhere: the racing line is scanned ahead, curvature measured geometrically, cornering speed solved from estimated grip and current downforce, and a backward pass turns that into an allowed-speed profile, so the brake point is simply wherever that profile forces the car below its current speed.
04Sound from mechanics
I synthesise the engine from the behaviour of a V6 rather than pitch-shifting a recording: a four-stroke V6 fires three times per crank revolution, so I build the note from oscillators locked to engine orders, each with its own load exponent, plus exhaust resonators, turbo whine that lags throttle, and overrun crackle. Each manufacturer reshapes the same mechanics instead of being an EQ preset. Browsers will not route speechSynthesis through WebAudio, so I built the race engineer's radio effect around the speech instead — mic click in, band-limited static bed, squelch out, a duck on the engine bus — with a formant vocoder as fallback when no voices are installed.
05Trusting the client
The client simulates its own car and ships state at 30 Hz, which is what makes the driving feel good and is also the obvious way to cheat. Every packet is checked against what the physics allows between two ticks: speed and acceleration ceilings, travel per tick against claimed speed, centreline progress against distance actually covered, lateral distance off the road, and lap times against the circuit record. Violations carry weights that accumulate into a time-decaying score and are written to an audit table; serve the client from an origin the CORS allowlist does not cover and it drops straight into offline mode, guest profile intact across a reload.