A real-time, multi-threaded Air Traffic Control simulator with a live graphical dashboard built on Raylib. Features priority-aware runway scheduling, automated violation detection (AVN), payment processing, and live performance metrics.
- Features
- Architecture
- Project Structure
- Prerequisites
- Build & Run
- Controls & Commands
- Flight Priority System
- AVN System
- Performance Metrics
- Contributing
| Feature | Description |
|---|---|
| Multi-threaded Simulation | Separate threads for the scheduler, radar (AVN detection), and user input โ all synchronized via std::mutex |
| Priority Runway Scheduling | Emergency > Medical/Military > Cargo > Commercial, with preemption support |
| Live Raylib Dashboard | Real-time KPI cards, animated aircraft glyphs, event feed, and runway occupancy display |
| AVN Issuance & Payment | Speed violations trigger Air-traffic Violation Notices with fines; manageable through CLI commands |
| Ground Fault Simulation | Random ground faults during Taxi/Gate phases clear runways and log incidents |
| Deterministic Replay | Pass --seed <N> for fully reproducible simulation runs |
| Live Metrics Overlay | Press M at any time for runway utilisation, queue depth, AVN rate, and emergency response time |
Different runtime scenarios including runway allocation, live traffic management, and metrics overlays.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ main.cpp โ
โ Launches sim thread โ drives Renderer loop โ
โโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโ
โ โ
โโโโโโโโโโผโโโโโโโโโโโ โโโโโโโโโโผโโโโโโโโโโโ
โ Simulator โ โ Renderer โ
โ (scheduler core) โ โ (Raylib dashboard)โ
โโโโฌโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโผโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโ
โ AirlinePortal โ โ PaymentGateway โ
โ AVN lookup & โโโโโ Fine submission & โ
โ auth โ โ transaction โ
โโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโ
| Thread | Role |
|---|---|
| Main | Raylib render loop at 30 FPS |
| simThread | Tick loop โ scheduling, phase advance, allocation (1 tick / sec) |
| radarThread | Speed-violation scan every 500 ms, issues AVNs |
| inputThread | Reads stdin for CLI commands |
AirControlX/
โ
โโโ CMakeLists.txt # Build configuration (auto-fetches Raylib if needed)
โ
โโโ include/ # Public headers โ one per module
โ โโโ types.h # Shared enums, structs (AVN, Flight, Runway, EventEntry)
โ โโโ airline_portal.h # AVN lookup & payment recording interface
โ โโโ payment_gateway.h # Fine payment processing interface
โ โโโ simulator.h # Core scheduling engine interface
โ โโโ renderer.h # Raylib dashboard interface
โ
โโโ src/ # Implementations
โ โโโ main.cpp # Entry point
โ โโโ airline_portal.cpp # Portal implementation
โ โโโ payment_gateway.cpp # Gateway implementation
โ โโโ simulator.cpp # Scheduler + radar + AVN logic
โ โโโ renderer.cpp # All Raylib drawing code
โ
โโโ screenshots/ # UI previews for documentation
โโโ dashboard.png
- CMake โฅ 3.16
- C++17 compiler (GCC 9+, Clang 10+, MSVC 2019+)
- Git (for FetchContent fallback)
sudo apt update
sudo apt install -y cmake g++ git \
libgl1-mesa-dev libx11-dev libxrandr-dev libxinerama-dev \
libxcursor-dev libxi-dev libxext-devbrew install cmake
# Xcode Command Line Tools provide the compiler:
xcode-select --install- Install CMake and Visual Studio 2022 (with C++ workload)
- Or use MSYS2 with
mingw-w64
Raylib is fetched automatically from GitHub if not found on your system. No manual installation required.
git clone https://github.com/<your-username>/AirControlX.git
cd AirControlXcmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallelOn first build, CMake will download and compile Raylib (~1โ2 min). Subsequent builds are fast.
# Random seed (different every run)
./build/AirControlX
# Deterministic / reproducible run
./build/AirControlX --seed 42cmake -B build
cmake --build build --config Release
.\build\Release\AirControlX.exe --seed 42cmake --install build --prefix /usr/local
aircontrolx| Key | Action |
|---|---|
M |
Toggle live performance metrics overlay |
ESC |
Exit the simulator |
VIEW <flightID> <YYYY-MM-DD>
Example:
VIEW PIA-412 2025-05-14
PAY <avnID> <flightID> <flightType#> <amount> <paymentMethod>
Flight type numbers: 0=Commercial, 1=Cargo, 2=Emergency, 3=Medical, 4=Military
Example:
PAY AVN-3 PIA-412 0 575000.00 CreditCard
Response: OK TX:847291 or FAIL: <reason>
Runway allocation follows a strict priority ladder:
EMERGENCY โโโบ Any free runway (immediate); preempts Commercial/Cargo if needed
MEDICAL โโโบ RWY-C preferred, then any free
MILITARY โโโบ RWY-C preferred, then any free
CARGO โโโบ RWY-C preferred, then any free
COMMERCIAL โโโบ RWY-A (arrivals) / RWY-B (departures)
Preemption: If an Emergency flight is waiting and all runways are occupied by Commercial or Cargo flights, the lowest-priority occupied runway is cleared and the occupant is re-queued.
| Runway | Primary role | Colour |
|---|---|---|
| RWY-A | Arrivals | Blue |
| RWY-B | Departures | Green |
| RWY-C | Priority / Cargo / Overflow | Orange |
Speeds are validated against per-phase limits:
| Phase | Min (kph) | Max (kph) |
|---|---|---|
| Holding | 400 | 600 |
| Approach | 240 | 290 |
| Landing | 30 | 240 |
| Taxi | 15 | 30 |
| At Gate | 0 | 5 |
| Takeoff Roll | 0 | 290 |
| Climb | 250 | 463 |
Fine schedule:
- Commercial flights: PKR 500,000 base + 15% service charge = PKR 575,000
- Other types: PKR 700,000 base + 15% = PKR 805,000
- Payment due within 72 hours of issuance
Press M during the simulation or wait for the end-of-run summary:
| Metric | Description |
|---|---|
| Avg wait time | Mean seconds a flight waited in queue before runway assignment |
| Peak queue depth | Maximum number of flights simultaneously waiting |
| RWY-A/B/C utilisation | Percentage of sim ticks each runway was occupied |
| AVN rate | Violations issued per simulated hour |
| Avg emergency response | Mean ticks from EMERGENCY arrival to runway assignment |
- Fork the repository
- Create a feature branch:
git checkout -b feature/my-feature - Commit your changes:
git commit -m "feat: add my feature" - Push:
git push origin feature/my-feature - Open a Pull Request
Please keep code style consistent with the existing codebase (C++17, no external dependencies beyond Raylib).
This project is licensed under the MIT License. See LICENSE for details.



