What it does
The course is a road-data file: a five-lap circuit or legs from start to goal, a narrow road with drivable ground
either side, and every object on it as data with a role. The race runs a clock. Each checkpoint adds time, which
carries over, and every time gate driven through on a leg adds seconds at the next checkpoint. Point gates score when
you drive between their poles and crash you on a pole. Flags score, and collected in the order shown they pay a bonus,
followed by a flashing round where any colour counts. Footballs fly off for points, and some rocks are footballs in
disguise.
The ground shapes the driving. Logs are ramps that launch the vehicle; stumps and small rocks are bumps that put it on two wheels, where points double, and steering hard drops it back or, held toward the raised side at speed, rolls it over. Banks are walls you can ride up, water beside a bridge and chasms are hazards, tunnels have a face to crash into, and rival vehicles drive the course with you. A crash tumbles or splashes, and a new vehicle stands on the road while the clock keeps running.
At the goal, the race pays for the time left, the time gates of the last leg and a bonus for each leg. You tick it with
throttle, steering and a gear lever, draw scene() with road-view-pseudo3d, read state for the time, score, leg,
flags and bonus, and present events such as time-gate, flag, jump, tip, crash and goal.
Features
- A carried-over clock — time added at each checkpoint by difficulty, seconds for every time gate, a configurable rate and cap, and a countdown.
- Gates and flags — point gates with poles to avoid, flags with colours and points, and an order bonus with a wild round after it.
- Jumps and two wheels — ramps that launch, bumps that tip, multipliers for points scored in the air and on two wheels, and roll-overs.
- Banks, water, chasms and tunnels — walls to ride, hazards that splash or swallow, and tunnel faces that crash.
- Footballs and hidden bonuses — balls kicked for points, and rocks that turn out to be balls.
- Crashes and recovery — tumbles and splashes, a gentle stop below a minimum speed, and a new vehicle clear of every obstacle.
- Rivals — vehicles of your kinds, at a speed range and frequency, on set lines.
- A goal bonus — rest time, last-leg gates and a bonus per leg.
- Difficulty — Arcade is the measured table; Normal and Easy add time and pass an assist level to the vehicle.
- Deterministic — fixed 1/60 s steps, a seed and snapshots.
Good for
- Off-road arcade racers seen from behind, in the style of Buggy Boy.
- Rally stages with jumps, checkpoints and a clock that carries over.
- Moon-buggy and rover races with low gravity, chasms and samples to collect.
- Stunt-driving time trials scored only by jumps and two-wheel driving.
- Collect-in-order delivery runs, where the flags are parcels.
Make it yours
The race is a configuration: the road and its number of legs, the vehicle and its assist level, which surfaces are hazards and what crash they cause, how far beyond the kerbs the vehicle may drive, the clock's start, leg times, gate seconds, rate, carry-over and cap, the flags' colours, order and wild round, every score and multiplier, the crash and tip rules, the rivals, and whether a brake is accepted. Roles on the course's objects say what each is: flag, gate, time gate, ball, hidden ball, obstacle or scenery.
Two presets show the range. buggyBoyPreset is five courses, a five-lap circuit and four courses of five legs each, with a
clock that starts at 70, runs 1.2 times as fast as real time and carries over, a five-colour shuffled flag order, double
points in the air and on two wheels, water that crashes the buggy, rival buggies and no brake. moonRallyPreset is an
original three-leg rally under gravity of 3.2 metres per second squared, with chasms, crater-rim banks, samples worth
3,000, a fixed three-colour order with no wild round, a real-time clock that starts each leg afresh, rovers and a
brake. A stunt course is another step away: set gate and flag points to nothing and score only through the air and
two-wheel multipliers.
A quick look
A course from the preset, started, ticked with the controls, and drawn by the pseudo-3D road view:
const race = game.offroadCourse.createOffroadRace(
game.offroadCourse.buggyBoyPreset({ course: 'north', difficulty: 'normal' }));
race.start();
race.tick(dt, { throttle, steer, gear: lever }); // fixed 1/60 s steps inside
for (const e of race.drain()) present(e); // flag, gate, time-gate, jump, tip, crash, goal…
view.draw({ ...race.scene(), style }); // road, banks, tunnels, water, every object
Works with
road-data— required: the course file, with its checkpoints, goal, ramps, bumps, walls, tunnels and bridges.vehicle-handling— required: the two-speed buggy, its jumps, landings, tipping and wall rides.scaled-depthandpseudo-road— required: every object in one depth field, projected along the road.road-view-pseudo3d— draws the scene, with a camera measured for this kind of game.road-racer— for road racers whose rules are traffic, forks and endings.track-racer— for top-down circuits.
Good to know
- One road strip per course: there are no forks.
- A crash is one tumble or splash, with no damage model, and rivals drive straight along their line without jumping.
- Objects beyond a bank in the same stretch of road are drawn over it.
- The course layouts are authored to follow the original's set pieces, not traced from it, and some timings, such as the leg times and crash time, are estimates.






