Pilot Matter Docs Play

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 built from a plane's recipe, the plane flown and its figures, and the frame loop the flight model drives - a touch on an object standing on the ground a crash at any speed
│   ├── 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, and whether a world put in force is a new flight
│   ├── units.js        # Pure conversions between world units and readings
│   ├── crash.js        # Pure ground rules: impact, landing, the crash countdown, and the height an aircraft is put back at over ground that changed under it
│   ├── game-modes.js   # Pure modes, stages, run state, course, the gate test, the fuel budget, the rescue marker, and the stage clock
│   ├── pattern.js      # Pure traffic circuit laid off a strip, and the mark each leg is held to
│   ├── corridor.js     # Pure canyon corridor, and whether a step crossed a cut inside the walls and under the lid
│   ├── survey.js       # Pure landmark list, and the height, range and heading window each shot is caught through
│   ├── 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, a survey's landmarks and a circuit's turns, as the masts and ground rings they are drawn with
│   ├── walls.js        # A canyon corridor as the posts and beams each cut 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
│   ├── key-bindings.js # Pure map of which key works which control, and its storage
│   ├── 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, the row that opens the builder's settings, and their storage
│   ├── control-settings.js # Pure control settings panel: the axes, the tilt, the attitude bound, what ends a level off, the keys, and their storage
│   ├── builder-settings.js # Pure builder settings screen: auto accept's moments with ALL over them, the camera speed, the reset, where it was opened from, and their storage - read by the editor, never by generation
│   ├── element-editor.js # Pure element editor state: the placed elements and their ranges, what the builder kept laid over them, and the world a free flight is drawn on
│   ├── properties-panel.js # Pure properties panel: the one row builder every panel of declared ranges is drawn from, its kinds and its gates, a colour's swatches, picker and hex figure, the rows read as a percentage, and the coarse step `shift` makes of a press
│   ├── build-mode.js   # Pure build session: whether the builder is open, what opened it, which screen is showing, the live tool, the one way out and the two confirms it asks, the draft in hand, a click that drops one, a template Insert Runway places or moves at a click, a stroke laid into its batch - an erase stroke the other way cut out of it - and the stroke tools' panel values, Free Paint's DEFAULT and the eye dropper it and an extrusion's surfaces share, an extrusion's stages, the surface a click chose and the BACK that drops what was changed there, the camera held from inside a tool, the tool suspended under the builder's settings, auto accept's moments - the next press that draws, the way out and another tool - and a stroke it keeps joined to the one kept before it, the popup a right click on the selection opens, the placement picked with Select, the selection the lasso drew and the tool that drew it, a shape drawn into it, and what has been committed
│   ├── shapes.js       # Pure shape vocabulary: every shape a pointer draws on the ground, the kind of region and the gesture each is, and what a drag or a click per vertex comes to, written once for the lasso and Extrude to offer
│   ├── lasso.js        # Pure lasso: the ten shapes it offers in the art's rows, and when a shape closes; how a shape meets the selection by the key held at its press, a figure reshaped by its fields, and shift in a drag squaring it
│   ├── extrude.js      # Pure Extrude: the seven shapes it offers in the art's rows, cut from its panel's art, and the stages an extrusion goes through - drawing, extruding, surfaces - with the one button they share, its two surfaces and which one a point is, and the rows a surface clicked narrows the panel to
│   ├── build-tools.js  # Pure tool registry: the tour's twelve and the palette art's later three in palette order, the built ones the palette draws, the SAVE / LOAD bar across its foot, what each insert, load or save section is declared to do, the placement a click drops, and the stroke tools - the cover tool, Free Paint and Erase, each brush in screen pixels and the stamp a stroke is laid with
│   ├── mode-types.js   # Pure mode types: what a section does as a verb, a kind and a subject - Insert asset<runway>, Load data<file> - written and read back
│   ├── environment-file.js # Pure environment file: a built world written as one JSON document and read back, refused whole with its first problem named, every range it sets held to its bounds
│   ├── environment-io.js # An environment file written through the browser's save dialog or downloaded, and one chosen in the file dialog and read
│   ├── loaded-world.js # Pure loaded world: the last world a file brought, kept by the browser as the file's text and listed by the settings under its name
│   ├── prefabs.js      # Pure prefabs: buildings and roads as recipes of boxes, cylinders, cones, wedges and ribbons in their own frame, merged into coloured triangles wound outward, their bounds, the catalogue of 34 - skylines, factories, homes, shops, infrastructure and parks - and its categories, and a recipe read back from a file whole or refused
│   ├── objects.js      # Pure objects on the ground: a prefab placed with its recipe copied in, its footprint turned to its heading, standing on the highest ground under it over a plinth to the lowest on every tile, taken whole by an erase over its middle, a road laid over the ground corner by corner, and the top the aircraft hits
│   ├── asset-fit.js    # Pure loaded assets: the formats read and their limits, what a glTF names outside itself - a GLB's own JSON chunk included - a model's size through its scale, up and facing, which insert menus it fits and why not, the step after loading, a building or a runway placed from one, and an asset carried in a file as base64, known by the SHA-256 of its bytes
│   ├── asset-loader.js # A loaded model read by three's own loaders in the page - a glTF only when it carries everything, a plan extruded and never put into the page - and kept by its asset's id, handed out as copies stood or anchored as its step said
│   ├── asset-store.js  # The loaded assets the browser keeps in IndexedDB, every call answering rather than throwing
│   ├── roads.js        # Pure roads: a road piece's connectors where its heading and scale put them, which are open, and the move and turn that snap a piece end to end to the nearest open one within 30 metres
│   ├── planes.js       # Pure planes: the five a world can be flown in - trainer, bush plane, twin, jet and biplane - each a recipe of boxes, cylinders and cones with the figures it flies on, and the chase distance its size calls for
│   ├── start-point.js  # Pure start point: where on a world a flight begins, which way and how high above the ground, held to the world, written out as Insert Plane's rows in the settings' altitude unit, and opened as a flying start
│   ├── templates.js    # Pure runway templates: the cards Insert Runway offers - two runways and two airports - a template placed as one group of the registry's own elements, an airport's apron and buildings laid out as lots from its strip's paving, and the group expanded, turned and kept on the canvas when the ground is built
│   ├── build-picker.js # Pure picker: the six canvases a session can start from, and which is chosen
│   ├── build-camera.js # Pure orbit camera over a canvas: the hold, every gesture, the air cleared over it, the ground a screen pixel spans, and the bearing the view looks along
│   ├── build-picking.js # Pure ground picking: where the ray through the pointer first meets the canvas's ground
│   ├── build-select.js # Pure selection: which built placement a point of the canvas is in, through each one's reach - a placed runway's by its strips - and whether a press was a click
│   ├── build-overlay.js # Pure outlines and gumball: a placement's reach traced as a contour, a region's own edge stood on the ground for the selection and a shape being drawn, a combined selection's edge traced and chained into runs, a stroke tool's brush and the region a stroke being laid will cover, an extrusion's top or wall traced at the weights a click reads them at, projected onto the screen and stroked over the canvas, and the gumball drawn in the art's colours, and the start point's green disc, heading arrow and knob
│   ├── build-palette.js # Pure palette fold: whether the tools are folded away, and the stored choice; the gear's mark and name
│   ├── gumball.js      # Pure gumball: the two handle sets the art declares, what each handle is bound to - a batch of strokes by its frame, a placed runway by its heading and its strip's size, an extrusion's height by the blue arrow - what a drag writes, and where each handle lies on the screen
│   ├── build-panel.js  # Pure dock: what the panel down the right of a canvas shows - Select's camera with the pick or the world's own elements beneath it, or the cover tool's own panel, Free Paint's three sections, Erase's, or Insert Runway's cards, with DESELECT on each while something is selected - and what the canvas is drawn from
│   ├── panel-view.js   # The one renderer the dock is drawn with: rows, a colour chosen at its swatches, picker, eye dropper and hex field, a slider, sections that fold or carry tiles, the slides, the answers, and what was done to them
│   ├── typed-value.js  # Pure keypad both number-holding panels read a typed figure through
│   ├── 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 lists, the flight's and a canvas's, the rows they are written from, and a canvas's lines as the input and action the docs carry
│   ├── 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, the objects each tile stands on its own ground, the top of whatever stands over a point, and the strip a flight opens on
│   ├── object-mesh.js  # A tile's objects as one instanced mesh to a recipe, lit and fogged as the ground is, over plinths where the ground falls away, and its roads laid over its ground as one mesh
│   ├── ground-material.js # Pure shader edit holding the ground's interpolated colour to 0 and 1, so the fog reaches a saturated paint seen from far off
│   ├── 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
│   ├── weather-math.js # Pure conditions, cloud drift, rain field, and strike timing
│   ├── mountains.js    # Pure mountain density formula (~10% coverage)
│   ├── environment/
│   │   ├── erase.js    # Pure erase batches: what a batch can take, whether it reaches a placement, and every batch resolved into the cut it makes in the placements laid before it
│   │   ├── elements.js # Pure element registry, the field and the water line it carries, every generator - drawn water and drawn snow, a strip placed where it was asked for, and paint, which lays a colour and no height, among them - the clumps a ground cover's density breaks it into, and the tint that keeps the ground's lightness under a colour
│   │   ├── footprints.js # Pure region on a placement: the seven kinds a pointer draws, regular figures and curves among them, two regions combined into one, a region set down in a frame of its own, and how much of one covers a point, repeating across the canvas's edges
│   │   ├── footprinted.js # Pure compositing of an element drawn on a copy of the field back through its footprint and the selection it was clipped to, what a footprint settles from the ground under it - a ground cover's band, drawn water's line at the lowest bank across its strokes, drawn snow's line and depth - the drawn line carried back, what the erase batches cutting a placement leave of it, a strip taken whole, and the stream a seeded placement draws from
│   │   └── presets.js  # Pure assembled environments, and the builder, which expands a placed template into its members and resolves erase batches into what they cut
│   ├── 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, the chase stood back by the size of the plane flown
│   ├── sky.js          # Lighting, atmospheric fog, the day cycle, and the standalone depth
│   ├── weather.js      # The cloud deck, the rain, the lightning, and the sky body
│   ├── 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
├── assets/
│   └── builder/        # The builder's art: the tool marks, the folded palette's tab, the picker's thumbnails - tracked, and the only place the page takes art from
├── 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
├── schemas/
│   └── environment.schema.json # The environment file as JSON Schema 2020-12, held to js/environment-file.js by its tests
├── 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
│   └── sync-builder-assets.mjs # Copies the builder's art into assets/builder/ from an explicit list, renaming on the way in, and names the marks drawn in the repository instead; run where the art is drawn, never in CI
└── test/               # Zero-dependency node:test unit tests