Skip to content

E2 — Simulation core (ticks, command bus, contexts) #134

@fredboy

Description

@fredboy

Goal: the authoritative simulation loop and the single-writer model.

Scope / deliverables:

  • engine:sim: fixed 20 TPS tick + Box2D subticks (e.g. 3×1/60) inside each tick; render interpolation via partialTick.
  • TickScheduler: scheduled tile ticks (delay+priority) + random ticks (randomTickSpeed).
  • Command bus — the only way to mutate world/ECS (single writer).
  • Context parameters: WorldContext (read), CommandContext (write), ClockContext{gameTick, partialTick, seeded random}, EcsContext.
  • SessionScope on coroutines; heavy pure work off-thread returning commands.
  • Migrate the old *ControllerTask periodics here as tick phases / scheduled / random ticks.

Definition of Done: deterministic tick; mutations only via commands; golden tests of tick/scheduler behavior; determinism test (same seed+commands → same snapshot).

Depends on: E1

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:simSimulation core: ticks, command bus, contextsepicUmbrella / tracking issue

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions