Fixed world clock at 24x (1h = 1 day): remove time skip, background tick, idle-pause #117

Closed
opened 2026-09-22 10:45:47 +02:00 by kamilkrzywda · 1 comment
Owner

Decision from the #101 multiplayer brainstorm (replaces step 9 / #113's open question).

  • Remove ALL player-facing time controls: the speed ladder (1x–1000x) and pause go away; no UI sets scale anymore.
  • World runs at a fixed WORLD_TIME_SCALE = 24 (1 real hour = 1 sim day), single-player and multiplayer alike.
  • Server background tick: a setInterval (~1 s) advances the clock through the existing locked tick path even when no client is polling, so time continues with nobody in the browser; honors the same per-tick clamp as today's tick-on-read.
  • New exported pure function (engine): takes plane states, returns info on whether time should advance — false ONLY when there are zero planes 'flying' AND zero planes 'repairing' (everything grounded). Background tick skips advancement while it says no. Unit-tested directly.
  • Remove the ISS-057 landing auto-slowdown to 1x (meaningless at fixed scale); verify nothing else depends on a variable timeScale.
  • E2e/test override: behind FLIGHT_TEST_HOOKS, tests may set a high time scale via a test hook (repair tests may use up to 100k x); the background tick must honor the override too. Watch for e2e specs that assumed tick-on-read-only advancement — with the background timer, time now advances even without polls.
  • Fresh worlds start at year 2000 (proposed 2000-01-01T00:00Z). Existing saves: per user decision the game will be RESET when multiplayer ships — no migration needed now; the current single-player save keeps running until that cutover.
  • Follow-up (separate issue): fleet period check — e175 / atr72-600 postdate year 2000, crj900 borderline; swap-or-later-start decision pending user.
Decision from the #101 multiplayer brainstorm (replaces step 9 / #113's open question). - Remove ALL player-facing time controls: the speed ladder (1x–1000x) and pause go away; no UI sets scale anymore. - World runs at a fixed WORLD_TIME_SCALE = 24 (1 real hour = 1 sim day), single-player and multiplayer alike. - Server background tick: a setInterval (~1 s) advances the clock through the existing locked tick path even when no client is polling, so time continues with nobody in the browser; honors the same per-tick clamp as today's tick-on-read. - New exported pure function (engine): takes plane states, returns info on whether time should advance — false ONLY when there are zero planes 'flying' AND zero planes 'repairing' (everything grounded). Background tick skips advancement while it says no. Unit-tested directly. - Remove the ISS-057 landing auto-slowdown to 1x (meaningless at fixed scale); verify nothing else depends on a variable timeScale. - E2e/test override: behind FLIGHT_TEST_HOOKS, tests may set a high time scale via a test hook (repair tests may use up to 100k x); the background tick must honor the override too. Watch for e2e specs that assumed tick-on-read-only advancement — with the background timer, time now advances even without polls. - Fresh worlds start at year 2000 (proposed 2000-01-01T00:00Z). Existing saves: per user decision the game will be RESET when multiplayer ships — no migration needed now; the current single-player save keeps running until that cutover. - Follow-up (separate issue): fleet period check — e175 / atr72-600 postdate year 2000, crj900 borderline; swap-or-later-start decision pending user.
Author
Owner

Shipped in v0.52.0 — PR #121, merged to master as 23896b2.

  • No player-facing time controls: world runs fixed 24x (1 real hour = 1 sim day) via a server-side 1 s background tick (lib/worldClock.ts + instrumentation.ts)
  • Idle-pause: clock freezes only when every plane is grounded and not repairing; idle ticks record lastRealTickMs so there is no catch-up jump on resume
  • POST /api/sim deleted (OpenAPI 13→12 paths); new FLIGHT_TEST_HOOKS-gated /api/test/set-timescale for e2e
  • Fresh worlds start at 2000-01-01T00:00Z; existing saves untouched
  • Client LeftPane Time section is clock-only; useSimClock extrapolates at the fixed rate, frozen while idle

Deployed to https://flight.dev.kkhost.pl (verified /api/version = 0.52.0).

Shipped in **v0.52.0** — PR #121, merged to master as `23896b2`. - No player-facing time controls: world runs fixed 24x (1 real hour = 1 sim day) via a server-side 1 s background tick (`lib/worldClock.ts` + `instrumentation.ts`) - Idle-pause: clock freezes only when every plane is grounded and not repairing; idle ticks record `lastRealTickMs` so there is no catch-up jump on resume - `POST /api/sim` deleted (OpenAPI 13→12 paths); new FLIGHT_TEST_HOOKS-gated `/api/test/set-timescale` for e2e - Fresh worlds start at 2000-01-01T00:00Z; existing saves untouched - Client LeftPane Time section is clock-only; `useSimClock` extrapolates at the fixed rate, frozen while idle Deployed to https://flight.dev.kkhost.pl (verified `/api/version` = 0.52.0).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: OpenCode/Flight-Ops#117