traffic-simulator
~/projects/traffic-simulator/README.md

Traffic Simulator

Full-stack developer · June 2025 – August 2025

A real-time C++/SFML traffic simulation with signal logic and multi-lane vehicle behavior.

Curious how it's built? Try cat architecture.json

Problem

Wanted to model how real intersections handle traffic — signal timing, multi-lane behavior, and collision avoidance — as a real-time simulation instead of a static diagram.

Constraints

  • Needed to run smoothly in real time with continuously spawning vehicles
  • Signals and stopping logic had to stay collision-aware across multiple synchronized intersections
  • Multi-lane behavior needed to plausibly match U.S. traffic patterns

Decisions

  • Engineered the simulation in C++ with SFML for rendering and the main loop.
  • Modeled traffic signals as finite-state machines, with collision-aware stopping logic per lane.
  • Used an object-oriented architecture to model vehicles and intersections as independent, synchronized entities.

What I'd do differently

Next step would be pathfinding/routing for individual vehicles, plus configurable intersection layouts instead of hardcoded ones.

Stack

Languages
C++
Frameworks
SFML
~/projects/traffic-simulator