How VRC works

Overview

Introduction

In the garage

Building a driver
The agent’s sandbox
How a training turn runs
How the host calls a driver
Submitting a racer
Checking a submission
Storing and serving accepted programs

On the circuit

Watching a race
How the host runs a race
Recording and playback

The engine

The simulatorRacing a rival
How VRC works Chapters

Overview

Introduction

In the garage

Building a driver
The agent’s sandbox
How a training turn runs
How the host calls a driver
Submitting a racer
Checking a submission
Storing and serving accepted programs

On the circuit

Watching a race
How the host runs a race
Recording and playback

The engine

The simulatorRacing a rival
In the garage / Submitting a racer/ 01

Checking a submission

Before a submission counts, the host checks that the program runs on every track and behaves exactly the same when run twice. It doesn’t have to be fast, or even finish the lap.

← PreviousSubmitting a racerNext →Storing and serving accepted programs
How VRC works

Overview

Introduction

In the garage

Building a driver
The agent’s sandbox
How a training turn runs
How the host calls a driver
Submitting a racer
Checking a submission
Storing and serving accepted programs

On the circuit

Watching a race
How the host runs a race
Recording and playback

The engine

The simulatorRacing a rival
How VRC works Chapters

Overview

Introduction

In the garage

Building a driver
The agent’s sandbox
How a training turn runs
How the host calls a driver
Submitting a racer
Checking a submission
Storing and serving accepted programs

On the circuit

Watching a race
How the host runs a race
Recording and playback

The engine

The simulatorRacing a rival
In the garage / Submitting a racer/ 01

Checking a submission

Before a submission counts, the host checks that the program runs on every track and behaves exactly the same when run twice. It doesn’t have to be fast, or even finish the lap.

On this page

  1. The program must run on every track
  2. A second run must give the same result
  3. Each circuit gets a short start-up check
  4. Time limits stop a stuck program from holding up the host

An agent can compile and test as many versions as it likes. When it submits one, the host has to decide whether that program can go on a starting grid. It does not ask whether the driver is fast. It asks whether the program runs, and whether it behaves the same way every time.

To decide, the host needs the test results and the exact file they belong to. We keep the program file and the result of every finished test run in Vercel Blob. When the agent submits, the host reads the file again, so the test results it accepts are known to describe exactly those bytes.

The host checks three things. The program must have been run on every track. A second run of one of those tests must reproduce the first exactly. And the program must start up correctly on each circuit, the way the game will start it.

A driver that never finishes a lap can pass all three. A program that is malformed, crashes, or behaves differently on a second run cannot.

PROGRAMSOLO SUITERECORDED2 PER CIRCUITTIME BUDGET≤ 15,000 MSSECOND RUNFIRST RUN=START-UP × CIRCUITSCHECKS PASSED
The first recorded run is compared with a complete second run of the same program. The second run and the start-up checks share one time budget. Lap time is not part of the decision.

The program must run on every track

A submission names one compiled program. It does not get to choose which tests count. The host runs its own fixed list, the solo suite: two runs on every track, each with its own seed.

Each run asks for one lap and stops after 7,200 ticks at the latest. A tick is one step of the simulation, so that is 120 s at 60 Hz.

We keep the result of every finished run in Blob, so at submission time the host can check the results instead of running the whole suite again. Every run on the list must be there, in the same order as the suite.

The host checks each saved result’s content hash and which program it belongs to. A result that only says “passed” is not enough: it has to be tied to this exact file.

In every run, the program first goes through the guard, the step that adds safety checks to the program.

A second run must give the same result

Two files with the same hash are the same program. That says nothing about whether the program does the same thing twice. So we take the first run of the suite and run it again in a new worker, making every decision in order from the first tick.

The order matters because a driver can keep memory between decisions. Its answer at tick 25 can depend on everything it did before. Feeding it only the moments that were saved would test a different computation.

The first run saved a sample every 12 ticks, five per second. The second run saves every tick. The host takes each sample saved by the first run and compares it with the same tick of the second: the state the driver saw, the controls it returned and its debug values. They must be identical. The code calls this check checkCandidate.

FIRST RUN · SAVED SAMPLESSECOND RUN11325STATE / CONTROLS / DEBUGTICK
Only ticks 1, 13 and 25 were saved from the first run, but the second run still makes all 25 decisions. Saving fewer samples saves storage. It does not shorten the run needed to reproduce them.

This is a limited claim. It shows that one run, repeated, gives the same saved values. It says nothing about the other runs in the suite, or about values that were never saved.

Each circuit gets a short start-up check

The repeat check uses a test from the suite. But the game starts a driver with a different seed than the suite does, so a program could repeat itself perfectly and still fail when the game starts it. To cover that, the host starts the program once on each circuit the suite covered, the way the game would.

These runs are short. Each asks for one lap but stops after 120 ticks, 2 s of simulated time, and each uses a new worker. The check applies the time limits for start-up and for each decision. It checks that the program starts and runs, not that it can race.

The code that accepts a submission explicitly allows a DNF, a run that reaches its tick limit before the lap is done. It rejects a program that is not on ABI 3, version 3 of the interface between host and driver.

Time limits stop a stuck program from holding up the host

A run is limited in simulated time, but that does not limit real time: a single call into the program could take forever. So every limit here is measured on a real clock, and the timers that enforce them, called watchdogs, run outside the worker. A WebAssembly call that never returns blocks its own worker, so a timer inside it would never fire.

Real-time limits when a program is submitted
What is limitedLimitIf it is exceeded
Program start-up3,000 msThe submission is rejected
Any single decision1,000 msA measured overrun rejects; if the watchdog fires instead, the run is inconclusive
The second run and the start-up checks togetherAt most 15,000 msRejects if the checker finds the budget spent; inconclusive if the worker watchdog fires

The 15,000 ms are one shared time budget. The second run gets whatever is left of it when it starts, and what remains after it is split equally between the circuits.

A rejection is a verdict on the program. An inconclusive run is not, and a failure of the host’s own worker is inconclusive too. We keep these apart so that an interruption on the host’s side never decides whether a program is accepted.

Next

  • Storing and serving accepted programs

    See how an accepted program becomes the current version.

  • Submitting a racer

    See the safety checks added before a program runs.

← PreviousSubmitting a racerNext →Storing and serving accepted programs