# vk22006/syntraq architecture

> Architecture diagram of the GitHub repository vk22006/syntraq, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vk22006/syntraq
- Repository: https://github.com/vk22006/syntraq

## Overview

SyntraQ is a C++ urban traffic simulator. The main workflow loads configuration, then runs either a headless simulation or a windowed fixed-timestep loop; in windowed mode, the renderer presents simulation state and returns UI actions that the entry point applies to the simulation. The domain includes a directed road network, vehicle spawning and routing, vehicle movement, and fixed-time intersection signals. Rendering also provides camera controls and debug visualizations. Some subsystem call details are not shown in the excerpts, so uncertain links are omitted or marked unverified.

Main entry points: [`src/main.cpp`](https://github.com/vk22006/syntraq/blob/main/src/main.cpp) (App Entry), [`src/simulation/simulation.cpp`](https://github.com/vk22006/syntraq/blob/main/src/simulation/simulation.cpp) (Simulation Loop), [`src/world/road_network.cpp`](https://github.com/vk22006/syntraq/blob/main/src/world/road_network.cpp) (Road Network), [`src/rendering/renderer.cpp`](https://github.com/vk22006/syntraq/blob/main/src/rendering/renderer.cpp) (Renderer and UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_entry["App Entry<br/>[main.cpp]"]
  node_config["Configuration<br/>[config.cpp]"]
end

subgraph group_world["Road World"]
  node_network[("Road Network<br/>[road_network.cpp]")]
  node_intersection["Intersections<br/>[intersection.h]"]
  node_road["Road Segments<br/>[road.h]"]
  node_ids["World IDs<br/>[ids.h]"]
end

subgraph group_traffic["Traffic Simulation"]
  node_simulation["Simulation Loop<br/>[simulation.cpp]"]
  node_simstate["Simulation State<br/>[simulation.h]"]
  node_spawner["Vehicle Spawner"]
  node_route["Route Provider<br/>[route_provider.cpp]"]
  node_vehicle["Vehicle Model<br/>[vehicle.h]"]
  node_movement["Vehicle Movement"]
  node_signalcontroller["Signal Controller"]
  node_signalphase["Signal Phases<br/>[signal_phase.h]"]
  node_light["Traffic Lights<br/>[traffic_light.cpp]"]
end

subgraph group_view["Visualization"]
  node_renderer["Renderer and UI<br/>[renderer.cpp]"]
end

node_user(("User"))

node_user -.->|"starts"| node_entry
node_entry -->|"loads"| node_config
node_entry -->|"creates"| node_simulation
node_entry -->|"creates"| node_renderer
node_entry -->|"advances"| node_simulation
node_entry -->|"passes state"| node_renderer
node_renderer -->|"returns actions"| node_entry
node_entry -->|"applies controls"| node_simulation
node_simulation -->|"uses"| node_network
node_simulation -.->|"dispatches"| node_spawner
node_simulation -.->|"dispatches"| node_movement
node_simulation -.->|"updates"| node_signalcontroller
node_spawner -->|"requests routes"| node_route
node_spawner -->|"reads"| node_network
node_spawner -->|"creates"| node_vehicle
node_movement -->|"reads"| node_network
node_movement -->|"updates"| node_vehicle
node_movement -->|"checks signals"| node_signalcontroller
node_signalcontroller -->|"uses phases"| node_signalphase
node_signalcontroller -->|"updates lights"| node_light
node_signalcontroller -->|"reads topology"| node_network
node_network -->|"stores"| node_intersection
node_network -->|"stores"| node_road
node_renderer -->|"renders"| node_simstate
node_renderer -->|"draws"| node_network
node_renderer -->|"draws"| node_vehicle

click node_entry "https://github.com/vk22006/syntraq/blob/main/src/main.cpp"
click node_config "https://github.com/vk22006/syntraq/blob/main/src/core/config.cpp"
click node_simulation "https://github.com/vk22006/syntraq/blob/main/src/simulation/simulation.cpp"
click node_simstate "https://github.com/vk22006/syntraq/blob/main/include/syntraq/simulation/simulation.h"
click node_network "https://github.com/vk22006/syntraq/blob/main/src/world/road_network.cpp"
click node_intersection "https://github.com/vk22006/syntraq/blob/main/include/syntraq/world/intersection.h"
click node_road "https://github.com/vk22006/syntraq/blob/main/include/syntraq/world/road.h"
click node_ids "https://github.com/vk22006/syntraq/blob/main/include/syntraq/world/ids.h"
click node_spawner "https://github.com/vk22006/syntraq/blob/main/src/vehicles/vehicle_spawner.cpp"
click node_route "https://github.com/vk22006/syntraq/blob/main/src/vehicles/route_provider.cpp"
click node_vehicle "https://github.com/vk22006/syntraq/blob/main/include/syntraq/vehicles/vehicle.h"
click node_movement "https://github.com/vk22006/syntraq/blob/main/src/vehicles/vehicle_movement_system.cpp"
click node_signalcontroller "https://github.com/vk22006/syntraq/blob/main/src/signals/traffic_signal_controller.cpp"
click node_signalphase "https://github.com/vk22006/syntraq/blob/main/include/syntraq/signals/signal_phase.h"
click node_light "https://github.com/vk22006/syntraq/blob/main/src/signals/traffic_light.cpp"
click node_renderer "https://github.com/vk22006/syntraq/blob/main/src/rendering/renderer.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_config,node_user toneBlue
class node_network,node_intersection,node_road,node_ids toneAmber
class node_simulation,node_simstate,node_spawner,node_route,node_vehicle,node_movement,node_signalcontroller,node_signalphase,node_light toneMint
class node_renderer toneRose
```

## Components

### Application

- [App Entry](https://github.com/vk22006/syntraq/blob/main/src/main.cpp): `src/main.cpp`
- [Configuration](https://github.com/vk22006/syntraq/blob/main/src/core/config.cpp): `src/core/config.cpp`

### Road World

- [Road Network](https://github.com/vk22006/syntraq/blob/main/src/world/road_network.cpp): `src/world/road_network.cpp`
- [Intersections](https://github.com/vk22006/syntraq/blob/main/include/syntraq/world/intersection.h): `include/syntraq/world/intersection.h`
- [Road Segments](https://github.com/vk22006/syntraq/blob/main/include/syntraq/world/road.h): `include/syntraq/world/road.h`
- [World IDs](https://github.com/vk22006/syntraq/blob/main/include/syntraq/world/ids.h): `include/syntraq/world/ids.h`

### Traffic Simulation

- [Simulation Loop](https://github.com/vk22006/syntraq/blob/main/src/simulation/simulation.cpp): `src/simulation/simulation.cpp`
- [Simulation State](https://github.com/vk22006/syntraq/blob/main/include/syntraq/simulation/simulation.h): `include/syntraq/simulation/simulation.h`
- [Vehicle Spawner](https://github.com/vk22006/syntraq/blob/main/src/vehicles/vehicle_spawner.cpp): `src/vehicles/vehicle_spawner.cpp`
- [Route Provider](https://github.com/vk22006/syntraq/blob/main/src/vehicles/route_provider.cpp): `src/vehicles/route_provider.cpp`
- [Vehicle Model](https://github.com/vk22006/syntraq/blob/main/include/syntraq/vehicles/vehicle.h): `include/syntraq/vehicles/vehicle.h`
- [Vehicle Movement](https://github.com/vk22006/syntraq/blob/main/src/vehicles/vehicle_movement_system.cpp): `src/vehicles/vehicle_movement_system.cpp`
- [Signal Controller](https://github.com/vk22006/syntraq/blob/main/src/signals/traffic_signal_controller.cpp): `src/signals/traffic_signal_controller.cpp`
- [Signal Phases](https://github.com/vk22006/syntraq/blob/main/include/syntraq/signals/signal_phase.h): `include/syntraq/signals/signal_phase.h`
- [Traffic Lights](https://github.com/vk22006/syntraq/blob/main/src/signals/traffic_light.cpp): `src/signals/traffic_light.cpp`

### Visualization

- [Renderer and UI](https://github.com/vk22006/syntraq/blob/main/src/rendering/renderer.cpp): `src/rendering/renderer.cpp`

### Other components

- **User**

## Connections

- User → App Entry: starts
- App Entry → Configuration: loads (evidence: `src/main.cpp`)
- App Entry → Simulation Loop: creates (evidence: `src/main.cpp`)
- App Entry → Renderer and UI: creates (evidence: `src/main.cpp`)
- App Entry → Simulation Loop: advances (evidence: `src/main.cpp`)
- App Entry → Renderer and UI: passes state (evidence: `src/main.cpp`)
- Renderer and UI → App Entry: returns actions (evidence: `src/main.cpp`)
- App Entry → Simulation Loop: applies controls (evidence: `src/main.cpp`)
- Simulation Loop → Road Network: uses (evidence: `src/simulation/simulation.cpp`)
- Simulation Loop → Vehicle Spawner: dispatches
- Simulation Loop → Vehicle Movement: dispatches
- Simulation Loop → Signal Controller: updates
- Vehicle Spawner → Route Provider: requests routes
- Vehicle Spawner → Road Network: reads
- Vehicle Spawner → Vehicle Model: creates
- Vehicle Movement → Road Network: reads
- Vehicle Movement → Vehicle Model: updates
- Vehicle Movement → Signal Controller: checks signals
- Signal Controller → Signal Phases: uses phases
- Signal Controller → Traffic Lights: updates lights (evidence: `src/signals/traffic_signal_controller.cpp`)
- Signal Controller → Road Network: reads topology (evidence: `src/signals/traffic_signal_controller.cpp`)
- Road Network → Intersections: stores
- Road Network → Road Segments: stores
- Renderer and UI → Simulation State: renders
- Renderer and UI → Road Network: draws
- Renderer and UI → Vehicle Model: draws
