Traffic Simulator
Tune the light timings and watch the queue clear or grow.
AdvancedWeb appCreative14–28hAI-buildable 3/5no setup
Simulate cars approaching an intersection with configurable light phases and arrival rates. Watching a small timing change cause gridlock is genuinely instructive, and the car-following model is a compact piece of simulation logic.
UI
Logic
Useful
Hosting · Free forever
Deploys free on GitHub Pages, Cloudflare Pages or Vercel Hobby.
Deploy it and share a link.
Core features · 7
- Cars spawn at a configurable rate on each approach
- Traffic lights cycle through phases with adjustable timings
- Cars accelerate, brake and maintain a following distance
- Cars stop for red lights and queue behind each other
- Average wait time and queue length are shown live
- Simulation speed is adjustable and pausable
- Cars don't overlap or pass through each other
The interesting part
- A car-following model that produces realistic queueing
- Collision avoidance at the intersection itself
- Keeping the simulation deterministic and frame-rate independent
Once it works
- Add turning lanes and turn-specific phases
- Add pedestrian crossings
- Add an auto-tuner that searches for optimal timings
Suggested stack
reacttypescripttailwindcanvas-api