Skip to content

@modoki/engine / index / Time

Variable: Time

const Time: Trait<{ delta: number; elapsed: number; frame: number; smoothedDelta: number; smoothedElapsed: number; timeScale: number; }>

Time resource — singleton entity updated each frame before pipeline runs.

Two concerns are deliberately separated (see docs/verification-harness.md "Phase 1 — Time-system redesign"):

  • Smoothing (jitter absorption) lives in smoothedDelta — an EMA of the real frame cadence, independent of game-time control.
  • Time control lives in timeScale — pause/slow-mo/bullet-time/time-stop are all this one knob (pause = 0). It is applied AFTER smoothing, so a time-stop is instant (smooth × 0 = 0) instead of coasting to a halt.

Consumers should read via the accessors getSimDelta (gameplay: raw × scale) and getVisualDelta (presentation: smoothed × scale), NOT the raw fields.

Built with Modoki.