Files
retro-flight-sim/TODO.md
T

4.8 KiB
Raw Blame History

TODO — Wings of the 90s

Working notes from the 6 Oct 2026 audit. Everything below was measured by running the code, not inferred from the README. Upstream: mac-ai-playground/retro-flight-sim (read-only for kevinhermes); work happens in this fork.

Status check (verified)

  • npm install + npm run build — clean, 13 modules, 512 kB bundle, 581 ms.
  • npm test — passes, but see T4: it only counts braces.
  • Terrain is deterministic across instances (getHeightAt(317,-812) identical in two separate Terrain objects) — the "persistent world" claim holds.
  • Rendering not visually verified: the audit box has no GPU and SwiftShader crashes the page. Needs a run on real hardware.

T1 — Takeoff does not work (highest priority)

Simulated 40 s at full throttle against the real Terrain heightmap:

t (s) knots alt (ft) onGround
0 0.3 19.7 false
1 23.2 2.8 false
2 49.3 0 true
6 340.2 12.2 false
9 542.5 105.2 false
10 564.6 0 true
39 2,543.3 0 true

The aircraft becomes briefly airborne, then never leaves the ground and accelerates to Mach 4.1. Causes:

  • js/flight-model.js:77 — ground friction is -hSpeed * 20, i.e. 20 N per m/s, against maxThrust = 50000 N on a 1200 kg airframe. Friction loses every argument.
  • js/flight-model.js:60-64 — lift is applied while onGround, scaled only by GROUND_LIFT_REDUCTION, so the plane floats off the runway at arbitrary speed and then the ground-collision clamp at :95 slams it back down.
  • No weight-on-wheels state: onGround is a position test, not a contact state, so there is no normal force and no way to model a proper rotation/tail-up.
  • PITCH_LIMIT = 85° and the auto-levelling at :134-135 (x *= 0.995, z *= 0.985) fight the player continuously.

Acceptance criteria: full throttle from rest → airborne within a plausible takeoff roll (order 200–400 m), climb sustained, stall if nose raised too high, and speed bounded near a sane VMO instead of 2,500 kt.

T2 — No WebGL fallback

js/main.js:36-43 constructs THREE.WebGLRenderer with no try/catch. On a machine without WebGL the page throws an uncaught Error creating WebGL context and the loading screen never advances — a blank screen with no message.

Fix: wrap renderer init, show a period-appropriate failure card ("GRAPHICS CARD NOT DETECTED"), and keep the loading/menu screens usable without 3D.

T3 — Stall speed is defined but unused

STALL_SPEED = 25 (js/flight-model.js:4) is used only to scale lift. Nothing in hud.js or sound.js references stalling. A period-accurate sim of this era should shove a warning in your face.

Fix: stall flag on the flight model → HUD warning + stick shaker / audio cue.

T4 — The test suite is theatre

scripts/check-syntax.js checks that each file is >10 chars and that { and } counts match. It cannot catch T1. CI (.gitea/workflows/*.yml) runs it on every push, so the green tick currently means nothing.

Fix: real unit tests on FlightModel (takeoff profile, stall, ground contact) and Terrain (determinism, airport flattening radius). Node has node:test built in — no new dependency needed. Add a headless smoke test that asserts the game reaches the FLIGHT state.

T5 — No LICENSE

README and repo carry no licence. Decide one (MIT matches the sibling wings88) and add the file.

T6 — No save/load

The sibling project's brief promised persistent worlds. There is no persistence here — no localStorage, no world seed stored. Terrain is deterministic per process, which is not the same thing.

Fix: persist the world seed + aircraft state; add a save/load menu entry.

T7 — Minor / housekeeping

  • index.html requests /favicon.ico → 404 on every load. Add one, or drop the request.
  • Bundle is 512 kB (132 kB gzipped); Vite warns about the 500 kB chunk. Fine for now, worth a manualChunks split if it grows.
  • package-lock.json is 31 kB for a two-dependency project — expected, just noting it.
  • No FPS cap. The README brags about a retro feel; wings88's design notes suggest a configurable 20 FPS cap, which would be cheap to add and very on-theme.

Suggested order

T1 → T4 (tests first would be better, but T1 is the reason the project is worth keeping) → T2 → T3 → T5 → T6 → T7.

Notes on provenance

Two commits, both authored by mac-container-dev on 5 May 2026. Not a fork of wings88 (fork: false, no cross-references in code) — an independent take on the same brief. wings88 has 214 source lines and no Three.js usage at all; its useful parts are the Jest/Playwright setup and the design guidelines (16–32 colour palette, no anti-aliasing, 20 FPS cap), which would slot in here.