Project structure
Every file in the project and what it holds. Anything marked pure imports no renderer and no DOM, which is what lets it be unit tested in Node.
pilot-matter/
├── index.html # Entry point - overlay markup, import map, styles
├── js/
│ ├── main.js # Scene setup, render loop, keys, and overlay state
│ ├── aircraft.js # 3D model, and the frame loop the flight model drives
│ ├── flight-model.js # Pure throttle, speed convergence, the engineless glide, lift and stall math
│ ├── config.js # Pure simulator start state, and the fields it is set through
│ ├── flight-state.js # Pure configured start in the units the model flies in
│ ├── units.js # Pure conversions between world units and readings
│ ├── crash.js # Pure ground rules: impact, landing, and the crash countdown
│ ├── game-modes.js # Pure modes, stages, run state, course, the gate test, the fuel budget, the rescue marker, and the stage clock
│ ├── best-times.js # Pure board of the best each stage has been flown in, and its storage
│ ├── landing-score.js # Pure reading of what a landing was, and the rollout it is held for
│ ├── rings.js # A loop course as the hoops it is drawn with
│ ├── guidance.js # An approach's threshold bar and extended centreline, as the marks they are drawn with
│ ├── marker.js # A search's marker as the mast, head and ground ring it is drawn with
│ ├── world-edge.js # Pure crossing that carries a bounded world round at its edges
│ ├── world-tiles.js # Pure grid the endless ground is laid on, and what is drawn of it
│ ├── world-record.js # Pure record of the world a terrain built, and the ask it is compared against
│ ├── input-map.js # Pure keybinding map and keyboard-to-input-state mapping
│ ├── touch-controls.js # Pure on-screen pad layout for a machine with no keys, and the pads themselves
│ ├── tilt-controls.js # Pure device-orientation-to-input-state mapping, and the sensor behind it
│ ├── pause.js # Pure pause toggle and frozen simulation clock
│ ├── title-screen.js # Pure start rules and the held pre-flight clock
│ ├── menu.js # Pure keyboard and pointer menu, and the list any menu is drawn into
│ ├── settings.js # Pure settings panel state, its options, and their storage
│ ├── element-editor.js # Pure element editor state: the placed elements and their ranges
│ ├── loading.js # Pure start-up progress, and the screen it is drawn on
│ ├── audio.js # Pure engine and wind mix, and the graph it is played through
│ ├── controls-help.js# Pure collapse toggle for the on-screen control list
│ ├── hud-visibility.js # Pure instrument toggle and its stored choice
│ ├── photo.js # Pure photo mode state and filename, and the download
│ ├── terrain-math.js # Pure noise, fBm, height curve, and mountain bump math
│ ├── terrain.js # An assembled environment as scene geometry, tile by tile
│ ├── day-night.js # Pure day cycle: the sky, the light, and the sun's arc
│ ├── water.js # Pure wave, sheen, and the surface animation both use
│ ├── mountains.js # Pure mountain density formula (~10% coverage)
│ ├── environment/
│ │ ├── elements.js # Pure element registry, the field, and every generator
│ │ └── presets.js # Pure assembled environments, and the builder
│ ├── api/
│ │ ├── index.js # The public entry point, re-exporting both halves
│ │ ├── contract.js # Pure option defaults, contract checks, and telemetry
│ │ ├── pilot.js # Pilot API: the aircraft, without the world
│ │ └── matter.js # Matter API: the world, without the aircraft
│ ├── camera-math.js # Pure camera modes and framerate-independent damping
│ ├── camera.js # Chase, cockpit, and orbit cameras
│ ├── sky.js # Lighting, atmospheric fog, the day cycle, and the standalone depth
│ ├── attitude.js # Pure artificial horizon geometry, and its SVG face
│ ├── minimap.js # Pure world-to-chart projection, and its SVG face
│ └── hud.js # On-screen instrument display and warnings
├── docs/
│ ├── index.html # This documentation site
│ ├── assets/ # The site's stylesheet and its one script
│ ├── api.md # The whole API surface, and its stability guarantee
│ └── api-reference.html # The same document as a page, built from it
├── examples/
│ ├── host.html # A host page working both halves of the API side by side
│ └── host.js # The Pilot API over host ground, the Matter API under a host aircraft
├── tools/
│ ├── serve.mjs # Zero-dependency static server behind `npm run serve`
│ └── build-api-reference.mjs # Renders docs/api.md into its page
└── test/ # Zero-dependency node:test unit tests