OUTBOUND
This one wants a keyboard
A throttle you hold down, a clutch on Shift and seven gears under your left hand - there is no honest way to do that with a thumb. Open it on a computer and the whole road is there.
OUTBOUND
github.comnetanelyan/outbound buymeacoffee.comitsblackz
0.0 km
CLUTCH
N
0
KM/H
0 RPMAUTO
AUTOPILOTREVENGINE
STALLEDhold SHIFT to restart
ROUTE
OUTBOUND
EnterDRIVE
W/S gas & brake   A/D steer   Space handbrake   C camera   G autopilot   H headlights
E cruise control on/off   Shift clutch - hold to change gear   17 gears   0 neutral   T back to auto
reverse: R to select it, then S to back up and W to stop  ·  P fresh car   M sound   Esc back here
github.comnetanelyan/outbound buymeacoffee.comitsblackz

OUTBOUND

A driving game that is one HTML file. The road is endless and procedural, there are no laps and no timer, and the manual gearbox is a real clutch you can stall, over-rev and money-shift.

What it is

You pick a car, a road, a gearbox, some weather and how much traffic you want, and then you drive. There is nothing to win. The only thing that can tell you how far you have come is how far you have come, which is why the distance is the one number the HUD never lets go of.

Eight cars, each with its own body, gear ratios, torque curve, mass and handling. Four roads - moor and farmland, forest, city, autobahn - and four kinds of weather that change the light, the fog, the sky and how much grip there is. Every road marking, every cloud, every panel of every car and every note of the engine is generated at runtime. The only thing the page fetches is three.js, from a CDN.

It needs a keyboard: a throttle you hold down, a clutch on Shift and seven gears under your left hand. Phones get a notice instead.

The gearbox

The engine is not a lookup table. It is a rotating inertia driven against the torque the clutch feeds back from the wheels, which means the interesting failures are not special cases - they fall out of the simulation.

The clutch is Shift. Hold it, pick a gear with 1-7, ease off. Let it up at the wrong revs and it drags the engine to match the wheels, because that is what a clutch does.

Stalling is the engine falling below 380 rpm with the clutch out. It restarts on the way back up - over 550 rpm with the throttle open and it bump starts, so a stall on a hill sorts itself out if you are quick.

Over-revving is visible before it is fatal. The danger band is painted into the tach itself the way a real cluster does it, so the bar is scaled to the burst limit rather than the redline, and running past the red is something you can watch yourself do.

Money-shifting is fatal. Third instead of fifth at the top of the rev range and the wheels spin the engine 16% past its redline: a rod leaves the block, the engine is gone, and it stays gone until you press P for a fresh car. The spike is caught inside the physics substep, not after it - a money shift lives and dies within a single frame, and read one frame later the revs have already come back down and the engine gets away with it.

The road

Everything is procedural and everything is deterministic: the same arc length always produces the same road, the same hills and the same village. The world streams in chunks of 180 m as you drive and is thrown away behind you. Terrain is rings swept along the road out to 755 m either side, flattened near the tarmac and growing into landform further out. The country turns over every few kilometres between moor - heather, gorse, loose stone - and farmland, which is a patchwork of fields with a hedge or a drystone wall on every boundary.

Why the road cannot cross itself

The road is defined by its heading as a function of arc length, and curvature is that function differentiated. It used to be the other way round - a curvature function integrated into a heading - and that is a genuinely different road, because the integral of a sum of sines is unbounded. With the old amplitudes the heading wandered through several complete turns. The road looped, and every couple of kilometres it came back and crossed a stretch of itself.

That is what put hills on the carriageway. The terrain skirt built out to 755 m as the far wall of a valley at one point on the road was, in world space, sitting on the tarmac two kilometres later - thirty metres above it, because the elevation function had moved on. You drove into the side of a mountain that was standing on the road, and nothing about the terrain code was wrong.

Defining the heading directly fixes it by construction rather than by tuning. The four amplitudes sum to 1.36 rad, and 1.36 < π/2, so the cosine of the heading is never less than 0.21: every metre of road gains at least 21 cm along the forward axis. The road is therefore a graph over that axis and cannot touch itself, whatever the phases do. Amplitude is spent where it shows - the two fast terms carry most of the bend and cost almost no heading - so the road corners harder than the old one, 257 m at the tightest against 200, while still going somewhere.

Back to the road  ·  Source on GitHub  ·  MIT