TRAIN SIMULATOR V0.0.1 (DEMO)

Changelog

Notable changes for the legacy branch demo. Dates use YYYY-MM-DD.

Unreleased In progress

Added

  • Loco Controls window (draggable) with detented sliders for reverser, throttle, dynamic brake, independent brake, service brake, plus an emergency toggle.
  • Inspector window (draggable) with tabs: Info / Options / Ops.
  • C hotkey to toggle the Loco Controls window (only when a locomotive is selected). Defaults to bottom-left when opened.
  • Traction cut-out toggle (separate from brake valve cut-out).
  • ui:selectedVehicleChanged event to support UI auto-open behavior when selection changes.

Changed

  • MU/DPU control distribution:
    • MU follows only when directly coupled to the lead.
    • DPU follows when fence matches the lead TX fence.
    • Follower units default to brake-valve cut-out without overriding explicit user changes.
  • Coupling distance threshold relaxed to make manual coupling more forgiving.
  • Left HUD layout now re-lays out each frame to avoid overlapping the menu area.

Fixed

  • Restored air simulation updates by calling stepAirPropagation() each tick (required for BP/BC behavior and gauges).
  • BP/BC analog gauge now updates correctly (air state was not advancing).
  • Inspector tab content now renders reliably after moving the window (mask is world-space and follows the window).
  • Inspector content masking no longer shows as a visible “white panel”.
  • Controls window sliders no longer jump min↔max (pointer coordinates now respect window position).
  • Low-speed HUD speed readout now uses a small deadband to prevent flicker around ~0 km/h.
  • Overlay toggle reliability improved by capturing key input for 1..9 plus I/H.
  • Removed duplicate UI key usage; overlays remapped to 1..9 / Ctrl+1..9.
  • Controls popup now reflects live loco state even when changed via keyboard.
  • Analog instrument toggle (I) is now robust (fallback raw key listener).
  • Ops physics runtime errors in stepOpsSimulation:
    • Reintroduced per-tick working maps (pos/vel/heading/forces) and stable chain ordering via getLinearVehicleOrder.
    • Fixed traction and braking force application to use local forward vectors (hx/hy).

UI Notes

  • Removed the redundant compact speed HUD line (analog instruments + engine HUD remain).
  • Inspector styling unified with other windows (title bar + accent strip + draggable behavior).
  • Inspector options clarified:
    • Removed ambiguous “Air cutout” for cars.
    • Renamed to “Brake valve cut-out” for locomotives.

2026-01-05

Added

  • Performance HUD toggle (F2) with rolling averages (world/ops/render) plus object counts.
  • Coupler debug overlay (F3) showing candidate coupler line + metrics (distance, relative speed, facing).

Fixed

  • Resolved duplicate UI setter methods in WorldScene (kept preferred behavior; removed duplicates to avoid Vite warnings).
  • Added safe coupling debug capture in tryAutoCoupleKnuckles() and a world-space overlay (F3).

Docs

  • Added docs/CONTROLS.md and updated the changelog.

2026-01-04

UI

  • Analog HUD toggle (I) now works reliably by forwarding the keypress from WorldSceneUIScene.
  • Inspector standardized to tabs: Info / Options / Ops (driving controls live only in the Controls window).
  • Left HUD switched to a compact one-line readout (removed redundant full stats box).

Air / Simulation

  • Added explicit erPsi on the lead loco (derived from service handle) so the MR/ER gauge reflects commands.
  • MR drawdown now accounts for both BP and AR charging across the whole train (more noticeable MR dip/recovery).

Performance

  • Train rendering now builds a per-frame vehicle lookup map to avoid repeated O(n) .find() calls (helps large consists).

Roadmap Next Up

High-impact priorities

  1. Coupling + air-line behavior
    • Auto knuckle coupling when pushed together with realistic compression and within coupling distance.
    • Auto air connect when knuckles couple; auto air disconnect when knuckles open/break.
    • Manual uncouple/open should prevent immediate re-couple for a brief cooldown.
  2. Logic pass (realism before gamey, except air-flow)
    • Audit MU/DPU authority edges and keep follower behavior (cut-outs, brake handling) predictable.
    • Re-check air propagation direction with flipped consists and mid-consist power.
    • Sanity-check resistance/tractive-effort tuning against SD40-2 targets.
  3. Performance pass (100+ vehicles)
    • Measure and reduce per-frame allocations in WorldScene + TrainRender.
    • Reduce Graphics redraw cost (more sprite/RtT reuse, fewer geometry rebuilds).
    • Add simple view-culling and update throttling for off-screen vehicles.
  4. UI coherence pass
    • One window theme (title bar accent, drag, close, padding).
    • Input validation + hit areas for all controls.
    • Fix overlap/anchoring on common resolutions.

Backlog / Ideas

  • Add HUD text for the current track speed limit (and, if feasible, the next segment’s speed limit if it differs).
  • Add a build script to update an in-game popup window from docs/CHANGELOG.md.
  • Route planning UI (Inspector Ops tab).
  • Better car art / silhouettes.
  • Render-to-texture caching experiments.
  • More robust coupling UX (auto-snap + clear feedback).
  • Keybind editor / rebinding UI improvements.

Documentation note

  • Keep docs/CONTROLS.md authoritative for key bindings.