Open source · traffic simulation · Go + NATS

A traffic sim that runs a whole city

traffic-sim is an open-source engine in Go. It imports real road networks from OpenStreetMap, down to the stop signs, puts AI driving policies and live human drivers on the same lanes, and reports congestion metrics concrete enough to rank one proposed upgrade against another.

The simulated Chicago street network around the Circle Interchange, with vehicles on every lane.
The simulation, running

The Chicago loop zone, imported from OpenStreetMap: 23,833 lanes and 2,217 signal programs.

Watch how it got built

← 52 minutes, solo screenshare
Build diary thumbnail: how the traffic sim got built
Build diary · Aug 12, 2026 · 52:50

Behind the Scenes: How I Built the Traffic Sim for Episode 3 | MATH vs VIBES

A solo screenshare build diary: no bet, no Thomas, no tally point. Eric walks through how the simulation got built, from the knowledge-base-first LLM workflow to the git hook that refuses to commit until two LLM reviewers sign off, the day Chicago broke the sim, and the distributed-versus-monolith call.

The numbers behind it: 7,468 words typed, 293 prompts, 16.8M output tokens, 2,252 tokens per word typed, and 45% of the output was review.

What the engine is

← the short version
01 · the roads
Real networks, imported

Road networks come in from OpenStreetMap through netconvert, down to junction right-of-way and fixed-time signals. A lane-level road graph, not a toy grid.

02 · the drivers
AI and humans, same roads

A Go kernel owns world state and publishes it over NATS. Controllers in any language, AI policies or live human drivers, subscribe and emit driving intents back as events. A MapLibre client renders vehicles and congestion heatmaps off the same streams.

03 · the comparison
Deterministic replay

JetStream keeps durable event logs, so a scenario rerun with a fixed seed gives back the same world. Scenarios are versioned directories, which is what lets two proposed upgrades be diffed like code and ranked on metrics.

Status is M11, scenario directories, with twelve architecture decision records behind the pieces that are built and tested. The public face is phantomjam.com, an atlas of the imported city networks: LA, SF, Miami, Atlanta, Houston, Dallas, Chicago. The long version, with the full README →

Where the sim gets used

← Chicago, in two parts

Shorts from the sim

← a minute each

Go deeper

← the code and the write-ups, all public
MATH vs. VIBES on YouTube

New builds and episodes land on the channel

Eric builds the model, Thomas trusts his gut, and the whole thing gets settled on camera. The sim work shows up as build diaries between episodes.

▶ Subscribe on YouTube