# nuclearplane787/flight-sim architecture

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

- Interactive diagram: https://gitdiagram.com/nuclearplane787/flight-sim
- Repository: https://github.com/nuclearplane787/flight-sim

## Overview

Flight Sim is a browser-based airliner simulator focused on flights between South Korean airports. The principal workflow is to configure or load a scenario, fly an aircraft through the simulation, manage gate departure and taxi when starting parked, then receive a landing score and logbook entry. The architecture spans flight physics and aircraft-specific systems, cockpit and flight controls, world rendering and weather, and persistent scenarios and scoring. README descriptions preserve major capabilities; several subsystem links below are dashed because the sampled source does not show their runtime wiring.

Main entry points: [`src/main.js`](https://github.com/nuclearplane787/flight-sim/blob/main/src/main.js) (Game runtime), [`src/sim/types.js`](https://github.com/nuclearplane787/flight-sim/blob/main/src/sim/types.js) (Aircraft systems), [`src/sim/sim.js`](https://github.com/nuclearplane787/flight-sim/blob/main/src/sim/sim.js) (Flight simulation), [`src/ground/gate-flow.js`](https://github.com/nuclearplane787/flight-sim/blob/main/src/ground/gate-flow.js) (Gate and taxi flow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_flight["Flight simulation"]
  node_sim["Flight simulation<br/>[sim.js]"]
  node_aircraft_types["Aircraft systems<br/>[types.js]"]
  node_aircraft_data["Aircraft performance data<br/>[a321neo.js]"]
  node_engine_types["Engine registry<br/>[engine-types.js]"]
  node_designs["Aircraft designs<br/>[designs.js]"]
  node_prediction["Path prediction<br/>[predict.js]"]
end

subgraph group_aircraft["Aircraft and cockpit"]
  node_aircraft_model["A321 model<br/>[aircraft.js]"]
  node_widebody_model["Widebody models<br/>[widebody.js]"]
  node_engine_model["Engine geometry<br/>[engine-model.js]"]
  node_cockpit["Cockpit instruments<br/>[cockpit.js]"]
  node_boeing_instruments["Boeing instruments<br/>[pfd.js]"]
  node_controls["Flight controls<br/>[input.js]"]
end

subgraph group_world["World and ground operations"]
  node_world_render["World rendering<br/>[world.js]"]
  node_sky_weather["Sky and weather<br/>[sky.js]"]
  node_airports["Airports and runways<br/>[airports.js]"]
  node_traffic["Parked traffic<br/>[traffic-layout.js]"]
  node_gate_flow["Gate and taxi flow<br/>[gate-flow.js]"]
  node_taxi_routes["Taxi routing<br/>[taxi.js]"]
end

subgraph group_experience["Game experience"]
  node_game["Game runtime<br/>[main.js]"]
  node_scenario_setup["Flight setup<br/>[setup.js]"]
  node_flight_map["Path map<br/>[map.js]"]
  node_weather_controls["Weather controls<br/>[weather-window.js]"]
  node_audio["Sound and callouts<br/>[synth.js]"]
end

subgraph group_records["Scenarios and results"]
  node_scenarios[("Scenario saves<br/>[scenarios.js]")]
  node_scoring["Landing score<br/>[score.js]"]
  node_logbook["Flight logbook<br/>[logbook.js]"]
end

node_pilot(("Pilot"))

node_pilot -.->|"starts and controls"| node_game
node_game -->|"loads and saves"| node_scenarios
node_game -->|"manages gate flow"| node_gate_flow
node_game -.->|"advances flight"| node_sim
node_game -.->|"renders flight"| node_world_render
node_game -->|"records landings"| node_scoring
node_game -->|"opens logbook"| node_logbook
node_game -->|"opens weather"| node_weather_controls
node_game -->|"plays callouts"| node_audio
node_pilot -.->|"configures flight"| node_scenario_setup
node_scenario_setup -.->|"starts scenario"| node_game
node_sim -.->|"uses type systems"| node_aircraft_types
node_aircraft_types -->|"selects performance data"| node_aircraft_data
node_aircraft_types -.->|"selects engine types"| node_engine_types
node_designs -->|"provides aircraft designs"| node_aircraft_types
node_aircraft_model -->|"builds engines"| node_engine_model
node_widebody_model -->|"builds engines"| node_engine_model
node_pilot -.->|"sends inputs"| node_controls
node_game -->|"reads controls"| node_controls
node_sim -.->|"requests predicted path"| node_prediction
node_pilot -.->|"views and changes route"| node_flight_map
node_game -.->|"shows path map"| node_flight_map
node_game -->|"applies weather"| node_sky_weather
node_pilot -.->|"sets conditions"| node_weather_controls
node_gate_flow -->|"plans taxi route"| node_taxi_routes
node_taxi_routes -->|"checks stand obstacles"| node_traffic
node_gate_flow -.->|"uses airport data"| node_airports
node_game -->|"restores flight state"| node_scenarios
node_scoring -.->|"adds flight record"| node_logbook
node_aircraft_types -->|"supplies engine data"| node_boeing_instruments

click node_game "https://github.com/nuclearplane787/flight-sim/blob/main/src/main.js"
click node_sim "https://github.com/nuclearplane787/flight-sim/blob/main/src/sim/sim.js"
click node_aircraft_types "https://github.com/nuclearplane787/flight-sim/blob/main/src/sim/types.js"
click node_aircraft_data "https://github.com/nuclearplane787/flight-sim/blob/main/src/sim/a321neo.js"
click node_engine_types "https://github.com/nuclearplane787/flight-sim/blob/main/src/sim/engine-types.js"
click node_designs "https://github.com/nuclearplane787/flight-sim/blob/main/src/sim/designs.js"
click node_prediction "https://github.com/nuclearplane787/flight-sim/blob/main/src/sim/predict.js"
click node_aircraft_model "https://github.com/nuclearplane787/flight-sim/blob/main/src/aircraft.js"
click node_widebody_model "https://github.com/nuclearplane787/flight-sim/blob/main/src/widebody.js"
click node_engine_model "https://github.com/nuclearplane787/flight-sim/blob/main/src/engine-model.js"
click node_cockpit "https://github.com/nuclearplane787/flight-sim/blob/main/src/cockpit.js"
click node_boeing_instruments "https://github.com/nuclearplane787/flight-sim/blob/main/src/ui/boeing/pfd.js"
click node_controls "https://github.com/nuclearplane787/flight-sim/blob/main/src/input.js"
click node_world_render "https://github.com/nuclearplane787/flight-sim/blob/main/src/world/world.js"
click node_sky_weather "https://github.com/nuclearplane787/flight-sim/blob/main/src/world/sky.js"
click node_airports "https://github.com/nuclearplane787/flight-sim/blob/main/src/world/airports.js"
click node_traffic "https://github.com/nuclearplane787/flight-sim/blob/main/src/world/traffic-layout.js"
click node_gate_flow "https://github.com/nuclearplane787/flight-sim/blob/main/src/ground/gate-flow.js"
click node_taxi_routes "https://github.com/nuclearplane787/flight-sim/blob/main/src/ground/taxi.js"
click node_scenario_setup "https://github.com/nuclearplane787/flight-sim/blob/main/src/ui/setup.js"
click node_flight_map "https://github.com/nuclearplane787/flight-sim/blob/main/src/ui/map.js"
click node_weather_controls "https://github.com/nuclearplane787/flight-sim/blob/main/src/ui/weather-window.js"
click node_scenarios "https://github.com/nuclearplane787/flight-sim/blob/main/src/scenarios.js"
click node_scoring "https://github.com/nuclearplane787/flight-sim/blob/main/src/score.js"
click node_logbook "https://github.com/nuclearplane787/flight-sim/blob/main/src/ui/logbook.js"
click node_audio "https://github.com/nuclearplane787/flight-sim/blob/main/src/audio/synth.js"

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_sim,node_aircraft_types,node_aircraft_data,node_engine_types,node_designs,node_prediction toneBlue
class node_aircraft_model,node_widebody_model,node_engine_model,node_cockpit,node_boeing_instruments,node_controls toneAmber
class node_world_render,node_sky_weather,node_airports,node_traffic,node_gate_flow,node_taxi_routes toneMint
class node_game,node_scenario_setup,node_flight_map,node_weather_controls,node_audio toneRose
class node_scenarios,node_scoring,node_logbook,node_pilot toneIndigo
```

## Components

### Flight simulation

- [Flight simulation](https://github.com/nuclearplane787/flight-sim/blob/main/src/sim/sim.js): `src/sim/sim.js`
- [Aircraft systems](https://github.com/nuclearplane787/flight-sim/blob/main/src/sim/types.js): `src/sim/types.js`
- [Aircraft performance data](https://github.com/nuclearplane787/flight-sim/blob/main/src/sim/a321neo.js): `src/sim/a321neo.js`
- [Engine registry](https://github.com/nuclearplane787/flight-sim/blob/main/src/sim/engine-types.js): `src/sim/engine-types.js`
- [Aircraft designs](https://github.com/nuclearplane787/flight-sim/blob/main/src/sim/designs.js): `src/sim/designs.js`
- [Path prediction](https://github.com/nuclearplane787/flight-sim/blob/main/src/sim/predict.js): `src/sim/predict.js`

### Aircraft and cockpit

- [A321 model](https://github.com/nuclearplane787/flight-sim/blob/main/src/aircraft.js): `src/aircraft.js`
- [Widebody models](https://github.com/nuclearplane787/flight-sim/blob/main/src/widebody.js): `src/widebody.js`
- [Engine geometry](https://github.com/nuclearplane787/flight-sim/blob/main/src/engine-model.js): `src/engine-model.js`
- [Cockpit instruments](https://github.com/nuclearplane787/flight-sim/blob/main/src/cockpit.js): `src/cockpit.js`
- [Boeing instruments](https://github.com/nuclearplane787/flight-sim/blob/main/src/ui/boeing/pfd.js): `src/ui/boeing/pfd.js`
- [Flight controls](https://github.com/nuclearplane787/flight-sim/blob/main/src/input.js): `src/input.js`

### World and ground operations

- [World rendering](https://github.com/nuclearplane787/flight-sim/blob/main/src/world/world.js): `src/world/world.js`
- [Sky and weather](https://github.com/nuclearplane787/flight-sim/blob/main/src/world/sky.js): `src/world/sky.js`
- [Airports and runways](https://github.com/nuclearplane787/flight-sim/blob/main/src/world/airports.js): `src/world/airports.js`
- [Parked traffic](https://github.com/nuclearplane787/flight-sim/blob/main/src/world/traffic-layout.js): `src/world/traffic-layout.js`
- [Gate and taxi flow](https://github.com/nuclearplane787/flight-sim/blob/main/src/ground/gate-flow.js): `src/ground/gate-flow.js`
- [Taxi routing](https://github.com/nuclearplane787/flight-sim/blob/main/src/ground/taxi.js): `src/ground/taxi.js`

### Game experience

- [Game runtime](https://github.com/nuclearplane787/flight-sim/blob/main/src/main.js): `src/main.js`
- [Flight setup](https://github.com/nuclearplane787/flight-sim/blob/main/src/ui/setup.js): `src/ui/setup.js`
- [Path map](https://github.com/nuclearplane787/flight-sim/blob/main/src/ui/map.js): `src/ui/map.js`
- [Weather controls](https://github.com/nuclearplane787/flight-sim/blob/main/src/ui/weather-window.js): `src/ui/weather-window.js`
- [Sound and callouts](https://github.com/nuclearplane787/flight-sim/blob/main/src/audio/synth.js): `src/audio/synth.js`

### Scenarios and results

- [Scenario saves](https://github.com/nuclearplane787/flight-sim/blob/main/src/scenarios.js): `src/scenarios.js`
- [Landing score](https://github.com/nuclearplane787/flight-sim/blob/main/src/score.js): `src/score.js`
- [Flight logbook](https://github.com/nuclearplane787/flight-sim/blob/main/src/ui/logbook.js): `src/ui/logbook.js`

### Other components

- **Pilot**

## Connections

- Pilot → Game runtime: starts and controls
- Game runtime → Scenario saves: loads and saves (evidence: `src/main.js`)
- Game runtime → Gate and taxi flow: manages gate flow (evidence: `src/main.js`)
- Game runtime → Flight simulation: advances flight (evidence: `src/main.js`)
- Game runtime → World rendering: renders flight (evidence: `src/main.js`)
- Game runtime → Landing score: records landings (evidence: `src/main.js`)
- Game runtime → Flight logbook: opens logbook (evidence: `src/main.js`)
- Game runtime → Weather controls: opens weather (evidence: `src/main.js`)
- Game runtime → Sound and callouts: plays callouts (evidence: `src/main.js`)
- Pilot → Flight setup: configures flight
- Flight setup → Game runtime: starts scenario (evidence: `src/main.js`)
- Flight simulation → Aircraft systems: uses type systems
- Aircraft systems → Aircraft performance data: selects performance data (evidence: `src/sim/types.js`)
- Aircraft systems → Engine registry: selects engine types
- Aircraft designs → Aircraft systems: provides aircraft designs (evidence: `src/sim/designs.js`)
- A321 model → Engine geometry: builds engines (evidence: `src/aircraft.js`)
- Widebody models → Engine geometry: builds engines (evidence: `src/widebody.js`)
- Pilot → Flight controls: sends inputs
- Game runtime → Flight controls: reads controls (evidence: `src/main.js`)
- Flight simulation → Path prediction: requests predicted path
- Pilot → Path map: views and changes route
- Game runtime → Path map: shows path map (evidence: `src/main.js`)
- Game runtime → Sky and weather: applies weather
- Pilot → Weather controls: sets conditions
- Gate and taxi flow → Taxi routing: plans taxi route (evidence: `src/ground/gate-flow.js`)
- Taxi routing → Parked traffic: checks stand obstacles (evidence: `src/ground/taxi.js`)
- Gate and taxi flow → Airports and runways: uses airport data
- Game runtime → Scenario saves: restores flight state (evidence: `src/main.js`)
- Landing score → Flight logbook: adds flight record
- Aircraft systems → Boeing instruments: supplies engine data
