# Time Trial: flags, penalties and what they do

There's an interactive version with simulators at [flags.html](flags.html).

This covers **multiplayer races** (lobbies). Solo laps have no race control: the only rule there is the lap check before a time goes on the leaderboard.

Race control runs on the multiplayer server (`mp/server.js`). It decides every flag and every penalty. Your browser shows them and makes your car keep to them.

## Who decides what

- **The host** picks the rules in the lobby before the race, in the **🚩 Race control** box. The switches are: yellow & blue flags, safety car, virtual safety car, red flags, the restart type, no overtaking and race-control messages. There are also the toggles **💥 Wreck = out** and **🚫 No rules**. During the race the host can call a VSC, a safety car, a red flag or the green flag from the race menu (`Esc`), but only the ones they switched on. The host can also **end the race straight away** from that menu (⏹ End the race now).
  - When a race is ended early, everyone still running is **placed where they are on the track** ("Stopped" in the results).
  - In a tournament, those places score points.
  - DNFs stay DNFs.
- **Race control (automatic)** calls flags when cars crash or stop on the track, within what the host allowed.
- **The admin** (admin panel → Racing → Lap times → *Multiplayer right now · race control*) can, during any race:
  - call any flag, even ones the host switched off;
  - change the rules for that race;
  - show a yellow flag at a driver;
  - black-flag a driver;
  - end the race straight away.

Automatic calls have limits:
- at most **3** automatic neutralisations (VSC, safety car or red flag) per race;
- none within **45 s** of the last one ending;
- none in the first **3 s** of the race;
- an incident never turns a stronger neutralisation into a milder one.

The host and the admin are not limited.

## The flags

| Flag | What causes it | What it does |
|---|---|---|
| 🟢 **Green** | The start, and the end of any neutralisation | Racing as normal. |
| 🟡 **Yellow** (local) | A car **wrecks**, or a car **stands still on the track** (not in the pit lane) for more than **5 s**. Needs *Yellow & blue flags* on. The admin can also show one at any driver. | A zone from **160 m before** the incident to **60 m after** it, for **12 s** (a new incident within 80 m extends it). The HUD shows **YELLOW FLAG** in the zone. No speed limit, but **no overtaking** in the zone (see *Overtaking* below). |
| 🔵 **Blue** | A car a lap or more ahead is within **70 m** behind you. Needs *Yellow & blue flags* on. | A message to the slower car: let it through. At most every **6 s**. **No penalty**. It's advice. |
| 🟨 **Virtual safety car (VSC)** | **2 wrecks within 15 s**, or a car **stopped on the track for more than 10 s** (with at least 2 drivers in the race). If the VSC is off, race control uses the safety car instead. Or the host or admin calls it. | Lasts **15 s**. Every car is held to **60% of its own top speed** (the game limits it). **No overtaking**. **Weapons off** in combat races. The pit lane stays open. |
| 🚗 **Safety car (SC)** | **3 wrecks within 20 s**. If the SC is off, race control uses the VSC instead. Also used for a stopped car when the VSC is switched off. Or the host or admin calls it. | A yellow car joins **140 m ahead of the leader** at **24 m/s (86 km/h)**. Lasts **32 s**; "**Safety car in this lap**" shows for the last **8 s**. A green flag from the host or admin brings it in **8 s** later. |
| 🟥 **Red flag** | A big pile-up: at least 3 drivers, and within **10 s** at least **3 wrecks** or **60% of the field** wrecked (whichever is more). Or the host or admin calls it. | **Every car brakes to a stop where it is** and is held there for **12 s**. **No overtaking**, **weapons off**. Then the restart. |
| 🔁 **Restart** | After every red flag, the way the host chose. | **Rolling**: the safety car leads for **18 s**, then green. **Standing**: five red lights for **4 s**, with every car held still where it stopped, then lights out. |
| 🏴 **Black flag** | Two warnings and then still standing still or driving the wrong way; causing **3 crashes**; or the admin black-flags you. | **Out of the race (DNF)**. See *Out of the race*. |
| ⚠️ **Warning** | Standing still or driving the wrong way (see *Conduct*). | The HUD shows **WARNING 1/2** or **2/2** with a countdown to fix it. |

How the cars are held to the safety car:

| Gap to the safety car | Top speed allowed |
|---|---|
| Less than 8 m behind it | 60% of the SC's pace |
| Less than 25 m behind it | 95% of the SC's pace |
| Further back | Up to 1.7× the SC's pace, so you can catch up |

During the safety car there's **no overtaking** and **weapons are off**.

## Overtaking under flags

When **No overtaking** is on, passing a car is not allowed:
- under a **VSC**, a **safety car** or a **red flag** (anywhere on the track);
- inside a **yellow** zone (both cars in the zone).

If you pass a car there, you get "**GIVE THE PLACE BACK**": let that car past within **10 s** and nothing happens. If you don't, it's **+5 s** on your finish time.

It doesn't count when the other car is:
- in the pit lane;
- wrecked;
- crawling (under 3 m/s);
- not sending its position.

It also doesn't count when the other car went backwards to a checkpoint after a wreck.

## Conduct: standing still and driving backwards

| What | When it counts |
|---|---|
| **Standing still** | Below **1.5 m/s** for **6 s** |
| **Driving the wrong way** | **50 m** backwards along the lap (driving forwards takes it off again; a respawn jump doesn't count) |

What happens:
1. **Warning 1**: you have **8 s** to drive on properly.
2. Still doing it: **warning 2**, another **8 s**.
3. Still doing it: the **black flag**, DNF.

If you fix it in time, the warning stays on your record. With 2 warnings, the next offence is an immediate black flag. A warning is forgotten after **90 s** of clean driving.

It **doesn't count**:
- in the first **10 s** of the race;
- in the **pit lane**;
- while your car is **wrecked** (waiting to go back on track);
- while **loading** (nothing sent for 3 s);
- under a **red flag**, a **standing restart** or the **safety car**;
- once you've **finished**.

## Crashes

**Causing a crash.** This needs *Cars can bump into each other* on, or party mode's Bumper cars. It's judged when a car is **wrecked within 1.5 s** of touching another car.

The server looks at both cars just before the touch. It counts as **your fault** when all of these are true:
- you were closing in at **6 m/s (22 km/h) or more**;
- you were pointed within **40°** of the other car;
- you were going at least **5 m/s**.

Anything else is a "racing incident, no action". Each pair of cars is judged only once per **8 s**.

| Crash you caused | Penalty |
|---|---|
| 1st | **+10 s** |
| 2nd | **+10 s**, and a warning that one more means the black flag |
| 3rd | **Black flag**, DNF |

**💥 Wreck = out** (host toggle). A car that is **wrecked is out of that race** (DNF "Wrecked") instead of going back to the last checkpoint. This applies however the wreck happened.

## Pit stops and tyres

- **Mandatory pit stop** (from 3 laps, on tracks with a pit lane): finishing without a stop adds **+30 s**.
- **Tyres at 0%**: your **top speed is halved** until you pit for fresh ones. Worn tyres also grip up to a third less. Tyres only wear in multiplayer races with pit stops switched on (never in solo time trials). The admin can change every tyre number (admin panel → Racing → Race cars → Tyres).

## Combat races

- **0 HP**: out of the race (DNF "Destroyed by …").
- **Weapons are off**:
  - in the first 3 s;
  - in the pit lane;
  - under a VSC, the safety car, a red flag or a restart.
- The pit lane is safe: nobody can hit you there, and a pit stop repairs 50 HP.

## Out of the race (DNF)

A **black flag**, **wreck = out** or **0 HP** puts you out of that race:
- Your car stops and disappears from the others' screens.
- You can watch the rest of the race.
- The server **keeps the DNF until the next race**: a lap or finish sent afterwards is ignored.
- The results show **DNF** and why.
- In a tournament, a DNF scores **0 points**.

## Time penalties

All the seconds (overtaking, causing crashes, a skipped mandatory stop) are **added to your finish time**. They show next to your name in the standings and the results.

## 🚫 No rules

With **No rules** on (host toggle, or the admin's) none of this applies:
- no yellow or blue flags;
- no automatic VSC, safety car or red flag;
- no warnings and no black flag: **standing still and driving backwards are fine**;
- no overtaking penalties and no crash penalties;
- a mandatory pit stop isn't forced, and skipping it costs nothing.

These still work with No rules on:
- **💥 Wreck = out**, if the host switched it on as well;
- **combat** HP and weapons;
- **tyres**;
- flags the **admin** calls by hand.
