Skip to content

TickRunner

Defined in: src/tick-runner.ts:75

Drives the per-tick ceremony in response to a TickSource. Consolidates the sequence that every per-tick consumer would otherwise hand-roll:

  1. ctx = contextFactory(info)
  2. scheduler.run(ctx)
  3. onBeforeFlush?.(ctx, info) — emit tick-boundary events here
  4. getEvents?.(ctx).flush() — skipped when there is no event bus
  5. world.flushCommands()
  6. world.lifecycle.flush()
  7. onTickComplete?.(ctx, info)

A tick is an atomic simulation step: one world from build-to-flush. Consumers that need a world swap (level transition, scene change, restart) queue the swap from inside a system and perform it between ticks — never mid-tick.

The runner is deliberately narrow — it knows nothing about turn numbers, input actions, rendering, or game state. Those are consumer concerns and live in contextFactory, onBeforeFlush, and onTickComplete.

TCtx

new TickRunner<TCtx>(opts): TickRunner<TCtx>

Defined in: src/tick-runner.ts:79

TickRunnerOptions<TCtx>

TickRunner<TCtx>

start(): void

Defined in: src/tick-runner.ts:99

void


stop(): void

Defined in: src/tick-runner.ts:106

void