Skip to content

About

An open-source 3D driving simulator and benchmark built on OpenStreetMap. Compare rules, decision models, LLMs, and custom agents across twelve neighbourhoods in eleven Canadian cities, or drive the routes yourself.

Topics

Resources

Contributing

Stars

15 stars

Watchers

0 watching

Forks

Repository files navigation

OpenStreetDrive

OpenStreetDrive is an open-source 3D driving simulator and benchmark built on OpenStreetMap. Compare the built-in rules driver, decision models, LLMs, and custom agents across twelve neighbourhoods in eleven Canadian cities, or drive the same routes yourself.

Play in the browser · Leaderboard and replays · Run locally

A school bus stopped with its red lights flashing on West 2nd Avenue in Kitsilano, Vancouver, as a child crosses in front of it. The driver's lines of sight fan out from the car, and the lesson card on the left explains BC's school bus law.

Flashing reds (Kitsilano, Vancouver): a school bus on the far side of West 2nd Avenue has stopped with its red lights flashing as a child crosses. In BC, traffic in both directions must stop. The lines show what the driver can see.

The simulator runs in the browser with no frontend build step. Its maps include traffic, cyclists, pedestrians, changing weather and time of day, and provincial road rules. Try sixty authored challenges, a longer compound drive, two provincial-style road tests, or the seeded city benchmark.

Any of four driver types can take the wheel: a deterministic Rules baseline, a decision model such as TypeSafe AI's Jev (a model that answers typed questions with probabilities), a chat LLM, or a custom JavaScript agent. Every AI driver receives the same visible observations, candidate manoeuvres, controller, and emergency brake, so differences in outcomes come from differences in decisions. Human drivers use a keyboard, gamepad, or touch screen on the same streets without the safety filter or emergency brake.

Research simulator only. This project is not software for controlling a real vehicle, and it is independent of TypeSafe AI.

How it works

The simulator runs the same loop for each automated driver every 650 ms, or every 250 ms near a hazard.

flowchart LR
    A[Sense<br/>what's visible] --> B[Propose<br/>candidate manoeuvres]
    B --> C[Simulate each<br/>3 s ahead]
    C --> D[Screen candidates<br/>for collisions and road rules]
    D --> E[Driver chooses<br/>among survivors]
    E --> F[Controller +<br/>emergency brake]
Loading

Buildings, fog, and darkness occlude hazards and signals; a traffic light the car cannot see is treated as unknown. On the default guarded track, the safety filter removes both predicted collisions and rule-breaking manoeuvres before the driver chooses. On the open track, predicted collisions are still removed and the emergency brake stays active, but rule-breaking manoeuvres remain available with flags so the driver's own judgment decides (track details). Timeouts or invalid answers fall back to Rules and are counted against the run. Lockstep Rules runs repeat deterministically on the same JavaScript engine; model drives are recorded and replay without an API key.

A recorded Rules drive with the AI eyes overlay: visible and hidden hazards, sight lines and the candidate manoeuvres

Turn on AI eyes to inspect what the driver could see, which hazards were hidden behind buildings, where it predicted other road users would go, and why candidate manoeuvres were rejected. The replay buffer keeps the last two minutes of the active drive, so you can scrub back to an incident, swap drivers or try another eligible manoeuvre, and take over manually.

What you can drive

  • Challenges: Sixty short scenarios with fixed seeds, weather, time of day, and traffic, plus one longer compound drive (Rush hour on West 4th). A pass requires arriving without a collision or driving violation and spending less than a second off the road (Squeeze in also requires parallel parking within 30 cm of the kerb). See all sixty →
Challenge City Situation
Flashing reds Vancouver A school bus stops across the road with red lights flashing as a child crosses; BC requires traffic in both directions to stop.
Round the van Toronto A delivery van is double-parked on Brunswick Avenue; wait for oncoming traffic to clear before passing.
Lights out Halifax A storm knocks out the signals at Barrington and Morris; treat the junction as an all-way stop.
Behind the doors Toronto A 511 streetcar opens its doors beside your lane on Bathurst Street; stop at least 2 m behind the rear doors.
Bridges freeze first Saskatoon Nearly invisible black ice on the Traffic Bridge deck; ease off before reaching it.
Follow the officer Toronto An officer at Spadina and Bloor overrides the signals, holding you on green and waving you through on red.
  • Road tests: A Class 5-style route in Kitsilano and a G2-style route in Toronto's Annex, with examiner directions and a demerit sheet at the end. Any dangerous action fails the test; minor errors add demerits. (Styled on provincial exams; not affiliated with any licensing authority.)
  • City suite and free drive: Seeded unscripted routes with city hazards enabled, or free driving with configurable weather (dry, fog, rain, snow) and time of day across all twelve bundled neighbourhoods: Kitsilano and Mount Pleasant (Vancouver), Old Town (Victoria), Beltline (Calgary), Old Strathcona (Edmonton), Downtown & Nutana (Saskatoon), Exchange District (Winnipeg), The Annex (Toronto), Centretown (Ottawa), Le Plateau (Montréal), Saint-Roch (Québec City), and Downtown (Halifax). Map details and custom extracts →

Run locally

The browser demo includes manual driving, Rules, the cautious starter agent, all challenges and road tests, and recorded model replays. Running locally adds live decision models and LLMs, custom JavaScript agents, /arena (side-by-side challenge evaluation), and /bench (seeded benchmarks).

Requires uv (which fetches Python 3.10+ and the single runtime dependency, typesafe-sdk) and a browser with WebGL. All twelve map packs are bundled.

git clone https://github.com/BrendanH18/OpenStreetDrive
cd OpenStreetDrive
uv run openstreetdrive

Open http://localhost:8322. Without an API key, Rules works offline immediately.

Connecting a model

In the driving HUD, click Decision (TypeSafe for Jev, OpenRouter Decisions, SubQ, Liquid AI, Baseten, DeepInfra, Fireworks, or Morph) or LLM (Anthropic, OpenAI, Google Gemini, xAI, Mistral, Groq, SubQ, OpenRouter, Ollama, LM Studio, or any OpenAI-compatible endpoint), paste an API key if needed, pick a model, and click Save and drive.

Keys are saved locally to .env. The server defaults to a $1 budget per run (JEV_FSD_BUDGET_USD) and a shared limit of 240 model calls per minute (JEV_FSD_RPM). See the agent guide for provider details, pricing, and limits.

Writing your own agent

Save a module under static/js/agents/my-driver.js:

export default {
  id: "my-driver",
  label: "My driver",
  create: () => ({
    async decide(snap, eligible) {
      const best = eligible.reduce((a, b) => (b.sim.progress_m > a.sim.progress_m ? b : a));
      return {
        motion: "drive",
        candidateId: best.id,
        meta: { source: "my-driver", model: "my-driver", latency_ms: 0, input_tokens: 0, cost_usd: 0 },
      };
    },
  }),
};

Load /js/agents/my-driver.js from Settings → Local agent module or in the local arena. Full interface and CLI validation (scripts/check_driver.mjs): docs/agents.md.

Controls

Key Action Key Action
W A S D / arrows Drive (takes over from autopilot) C Cycle cameras
Space Brake hard O Photo mode
J Toggle autopilot Drag / scroll Orbit and zoom camera
Q / E Left / right indicator P Pause
H Horn (with sound on) R Reset to lane
1 / 2 / 3 Decision / Rules / LLM driver ? All shortcuts

Gamepads and touch screens are also supported (controls and scoring).

Results

In the November 2026 legacy runs, three models (Jev, Claude Haiku 5.5, and DeepSeek V4.1 Flash) and two hand-written drivers ran all 60 challenges and both road tests. On the guarded track, Jev passed 62/62, while Haiku (on-your-bumper) and DeepSeek (double-parked) each failed one. On Brunswick Avenue in Toronto, Rules got past the double-parked van in 33 seconds, whereas DeepSeek chose "stop" on 577 of 674 calls despite a safe passing manoeuvre being offered at least 55 times, timing out at three minutes.

Unscripted city routes separate drivers much more sharply: on the 12-route dry Kitsilano city suite, Rules passed 12/12, Claude Haiku 5.5 passed 10/12, and Jev passed 7/12 (3 December 2026, suite v2). Their November runs passed 3/12 and 2/12. In most of those failures the models were following a bug in our instructions. In a November 2026 measurement, none of the manoeuvres allowed by the guarded filter at sampled decisions led to a failure within six seconds in 55 of the 60 challenges—meaning guarded challenges mostly test the filter and forward progress, while the open track and city suite test driver judgment.

The generated tables below separate the November 2026 legacy suite from Suite v2, which so far has the Kitsilano city suite for both models and the Rules baselines.

Legacy results

Driver Model Challenges and road tests Open track City suite, Kitsilano: dry · fog · rain · snow City suite, 11 other maps (dry) Own decisions Cost of the challenges
Rules none 62/62 62/62, 0 flagged choices 12/12 · 12/12 · 12/12 · 12/12 22/22 n/a $0
Cautious agent none 62/62 62/62, 0 flagged choices 9/12 · 10/12 · 12/12 · 6/12 17/22 99.98% $0
Jev jev-1.14.0 62/62 62/62, 8 flagged choices 2/12 · – · – · – not run 99.95% $1.26
Claude Haiku 5.5 claude-haiku-5-5 61/62 (failed on-your-bumper) 61/62 (failed flagger), 216 flagged choices 3/12 · – · – · – not run 99.98% $4.07
DeepSeek V4.1 Flash deepseek/deepseek-v4.1-flash-1017 61/62 (failed double-parked) not run not run not run 99.01% $2.55

Built from the committed records (2026-11-11 to 2026-11-21) by scripts/build_results.py, which also writes data/results.json with each row's source files. The leaderboard shows published challenge results and the newest standard benchmark run for each suite version, driver, map, preset, weather, suite size and seed. City runs in this table use suite seed 1, lockstep clock, 40 traffic cars. A driver's runs may come from different dates. On the open track the safety filter flags a manoeuvre that breaks a road rule instead of removing it, so the driver's own judgment decides (how). "Flagged choices" counts how often the driver went on with one. "Own decisions" are the share of the challenge decisions the driver made itself, not answered locally or by a Rules fallback. Model drives are recorded under data/recordings/ and replay without a key. Details, failures and costs: model results and Rules baseline.

Jev, Kitsilano, city preset, dry: In 9 of 10 failed drives the model was repeatedly told to hold at a stop sign the car had already passed, a bug in our instructions fixed on 2026-12-03. Suite v2 has the rerun.

Claude Haiku 5.5, Kitsilano, city preset, dry: In 7 of 9 failed drives the model was repeatedly told to hold at a stop sign the car had already passed, a bug in our instructions fixed on 2026-12-03. Suite v2 has the rerun.

One-challenge pilots: GPT-6 Luna (openai/gpt-6-luna) 1/1 (door-zone); Liquid d1 (liquid/d1-20260930) 1/1 (door-zone); Granite 4.2 3B (granite4.2:3b) 2/2 (dont-splash, left-on-red).

Suite v2

Driver Model Challenges and road tests Open track City suite, Kitsilano: dry · fog · rain · snow City suite, other maps (dry) Own decisions Cost of the challenges
Rules none not run not run 12/12 · 12/12 · 12/12 · 12/12 not run n/a n/a
Jev jev-1.14.0 not run not run 7/12 · – · – · – not run n/a n/a
Claude Haiku 5.5 claude-haiku-5-5 not run not run 10/12 · – · – · – not run n/a n/a

Built from the committed records (2026-11-27 to 2026-12-04) by scripts/build_results.py, which also writes data/results.json with each row's source files. The leaderboard shows published challenge results and the newest standard benchmark run for each suite version, driver, map, preset, weather, suite size and seed. City runs in this table use suite seed 1, lockstep clock, 40 traffic cars. A driver's runs may come from different dates. On the open track the safety filter flags a manoeuvre that breaks a road rule instead of removing it, so the driver's own judgment decides (how). "Flagged choices" counts how often the driver went on with one. "Own decisions" are the share of the challenge decisions the driver made itself, not answered locally or by a Rules fallback. Model drives are recorded under data/recordings/ and replay without a key. Details, failures and costs: model results and Rules baseline.

Jev, Kitsilano, city preset, dry: In 3 of the 5 failed drives (s1-2, s1-5 and s1-7) our instructions kept the car from pulling over for an emergency vehicle. That wording was fixed after this run, and Jev passed all three in a separate check.

Development and contributing

Local street knowledge is the most useful contribution: if a turn restriction, crosswalk, or provincial rule is wrong, open an issue. New challenges, Canadian map extracts, drivers, and accessibility fixes are also welcome. See CONTRIBUTING.md and ROADMAP.md.

uv run python -m unittest discover -s tests                         # Python tests
uv run ruff check && uv run ruff format --check && npm run lint     # Python (Ruff) and JS (Biome) lint
node --experimental-default-type=module scripts/test_drive_lab.mjs  # example Node check (Node 22)
python3 scripts/build_demo.py                                       # build static GitHub Pages demo

Changes to physics, sensing, or planning should compare a seeded /bench run against the Rules baseline. Full testing and tooling notes: docs/reference/development.md.

server.py          local HTTP server and API (stdlib only)
jev/               OSM pipeline, routing, Jev client, decision-model and LLM proxies
static/js/sim/     physics, traffic, pedestrians, signals, scoring
static/js/brain/   sensing, candidate generation, safety filter, drivers
static/js/render/  Three.js scene, sky, weather, cars, buildings, cameras
static/js/ui/      HUD, Connect a model dialog, drive lab, photo mode
static/js/lab/     challenges, road tests, recorder, replay, arena
data/maps/         bundled neighbourhood map packs

Additional documentation lives in docs/reference/README.md and CHANGELOG.md.

Credits and licence

Map data © OpenStreetMap contributors (ODbL). 3D rendering by Three.js (MIT). Inspired by JevPilot.

Released under the MIT License.

About

An open-source 3D driving simulator and benchmark built on OpenStreetMap. Compare rules, decision models, LLMs, and custom agents across twelve neighbourhoods in eleven Canadian cities, or drive the routes yourself.

Topics

Resources

Contributing

Stars

15 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages