v0.52.0 — fixed world clock at 24x (1h = 1 day): no time skip, background tick, idle-pause (#117) #121

Merged
kamilkrzywda merged 2 commits from feat/fixed-world-clock into master 2026-09-22 16:13:42 +02:00
Owner

Closes #117

Decision from the #101 multiplayer brainstorm: no player-facing time controls. World runs fixed 24x (1 real hour = 1 sim day), advances via a server background tick even with nobody in the browser, and freezes only when nothing is flying or repairing. Fresh worlds start at year 2000.

  • New lib/worldClock.ts: WORLD_TIME_SCALE=24 single source of truth; instrumentation.ts starts the 1 s background tick (nodejs runtime)
  • engine.ts: exported pure shouldAdvanceTime(planes) → {advance, flying, repairing} (false only when all grounded); idle ticks update lastRealTickMs without advancing clock (no catch-up jump on resume); ISS-057 landing auto-slowdown + applyTimeControls/clamp removed
  • POST /api/sim deleted (OpenAPI 13→12 paths, e2e/api.spec.ts updated); new FLIGHT_TEST_HOOKS-gated /api/test/set-timescale (1..100k) — all e2e setScale helpers rewritten onto it; slow-on-landing.spec.ts deleted, sim/panes/two-planes reworked for the fixed-rate world
  • seed: STARTING_CLOCK_MS = 2000-01-01T00:00Z (existing saves untouched — game resets at multiplayer cutover per user decision)
  • Client: LeftPane Time section is clock-only; useSimClock extrapolates at fixed rate, frozen while idle

Local: tsc clean · vitest 355/355 (30 files) · playwright --list 57 tests in 14 files. E2e verified by CI only.

Closes #117 Decision from the #101 multiplayer brainstorm: no player-facing time controls. World runs fixed 24x (1 real hour = 1 sim day), advances via a server background tick even with nobody in the browser, and freezes only when nothing is flying or repairing. Fresh worlds start at year 2000. - New lib/worldClock.ts: WORLD_TIME_SCALE=24 single source of truth; instrumentation.ts starts the 1 s background tick (nodejs runtime) - engine.ts: exported pure shouldAdvanceTime(planes) → {advance, flying, repairing} (false only when all grounded); idle ticks update lastRealTickMs without advancing clock (no catch-up jump on resume); ISS-057 landing auto-slowdown + applyTimeControls/clamp removed - POST /api/sim deleted (OpenAPI 13→12 paths, e2e/api.spec.ts updated); new FLIGHT_TEST_HOOKS-gated /api/test/set-timescale (1..100k) — all e2e setScale helpers rewritten onto it; slow-on-landing.spec.ts deleted, sim/panes/two-planes reworked for the fixed-rate world - seed: STARTING_CLOCK_MS = 2000-01-01T00:00Z (existing saves untouched — game resets at multiplayer cutover per user decision) - Client: LeftPane Time section is clock-only; useSimClock extrapolates at fixed rate, frozen while idle Local: tsc clean · vitest 355/355 (30 files) · playwright --list 57 tests in 14 files. E2e verified by CI only.
kamilkrzywda added 1 commit 2026-09-22 12:53:53 +02:00
Fixed world clock: no player time controls (ISS-117)
CI / build + unit + e2e (pull_request) Failing after 12m10s
a0560ec767
The world always runs at WORLD_TIME_SCALE = 24 (lib/worldClock.ts). A server
background tick (instrumentation.ts -> startBackgroundTick, 1 s interval)
advances the sim with no open browser; idle-pause freezes the clock exactly
while no plane is flying or in repair. Fresh worlds start year 2000
(STARTING_CLOCK_MS in seed.ts).

- Removed: POST /api/sim + OpenAPI entry, applyTimeControls/clampTimeScale,
  lib/timeScale.ts, LeftPane pause button + scale slider machinery,
  ISS-057 slow-on-landing/resume in flyPlane.
- Snapshot simState is now { clockMs } only; client extrapolates at the fixed
  rate between polls and freezes while idle (useSimClock).
- New test-only hook POST /api/test/set-timescale behind FLIGHT_TEST_HOOKS=1
  (sibling of set-health); all e2e setScale helpers call it, afterEach restores
  the world rate. E2E pause tests replaced by idle-pause assertions; sim.spec.ts
  activates the world via set-health + /repair for advance/expiry tests.
kamilkrzywda scheduled this pull request to auto merge when all checks succeed 2026-09-22 13:02:48 +02:00
kamilkrzywda added 1 commit 2026-09-22 16:00:54 +02:00
kamilkrzywda merged commit 23896b2cc4 into master 2026-09-22 16:13:42 +02:00
Sign in to join this conversation.