> For the complete documentation index, see [llms.txt](https://docs.rainmad.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rainmad.com/resources/mad-racing-system-racing-tablet/racing.md).

# Racing

### Formats

| Format          | Laps | Winner decided by                                            |
| --------------- | ---- | ------------------------------------------------------------ |
| Sprint          | 1    | Finish time                                                  |
| Circuit         | N    | Finish time                                                  |
| Drift           | 1    | Drift score                                                  |
| Drift challenge | N    | Drift score                                                  |
| Time trial      | 1    | Your own time, solo, no lobby                                |
| Elimination     | N    | Last racer standing — the trailing racer is dropped each lap |

Edit or remove entries in `cfg.raceTypes` to change what the tablet offers.

***

### Starting

Racers are placed on a grid behind checkpoint 1, facing checkpoint 2. Layout comes from `cfg.race.grid` — columns, spacing, offset.

A racer more than `cfg.race.maxDistanceFromGrid` metres away when the race starts is rejected. Then the countdown runs for `cfg.race.countdownSec`.

***

### During the race

**Checkpoints.** The trigger is that checkpoint's own `radius`, set in the editor. The visual pillar is a fixed size and has nothing to do with it. On foot, `cfg.race.checkpointArriveDistance` is used instead.

**3D GPS.** The next few checkpoints are drawn into the world ahead. Lookahead count and default style come from `cfg.gps3d`; each player overrides the colour and style on their profile.

**Traffic cleanup.** With `cfg.race.disableTraffic`, ambient vehicles are suppressed on the client and blocked from spawning along the route on the server, within `cfg.race.clearRadius`. Player and scripted entities are never touched. `disablePeds` does the same for pedestrians and is off by default.

**Phasing.** Racers pass through each other instead of colliding. Per-race setting, default from `cfg.competition.phasingDefault`.

**First person.** When the host enables it, the view mode is forced and re-applied if the player tries to switch out.

***

### Drift scoring

Only for `drift` and `drift_challenge`. Points accrue while the car is sliding past `cfg.drift.angleThreshold` degrees above `minSpeedMps`.

A sustained drift builds a combo multiplier, `comboMultiplierStep` per second up to `comboMultiplierMax`. Hitting a wall or an entity mid-drift costs `wallHitPenalty` and breaks the combo.

***

### Finishing

The first finisher starts a clock. Anyone still running after `cfg.race.dnfTimeoutSec` is marked DNF and dropped.

On finish:

* Times, splits and positions are written to the track's leaderboard.
* ELO is recalculated — see Progression.
* The prize pool is split by `cfg.competition.prizeDistribution`.
* Item payouts roll, if enabled.

Item payouts skip races shorter than `cfg.itemPayouts.minRaceLengthSec` so a two-checkpoint track cannot be farmed.

***

### Leaving

`/leaverace` drops out. Quitting mid-race, disconnecting or dying is handled the same way: the racer is removed and the race continues for everyone else.
