TickContext
In one line: what a system's
Executereceives each tick — its transaction, its read accessor, its entities, the frame's delta time, and the escape hatches.
A system never creates a unit of work or calls Commit — it is handed a TickContext and works through it. The context exposes: Transaction (the system's own per-tick transaction, committed for you by the scheduler); Accessor (a per-worker EntityAccessor for a parallel QuerySystem that writes no Versioned component — Open/OpenMut without per-entity dictionary lookups; null otherwise); Entities (the view's matched set, for a QuerySystem); DeltaTime (seconds since the last tick); SpatialGrid (assign a SimTier per cell, read tier budgets); and Commands (a per-worker-slot handle for queuing deferred spawns and destroys from inside a parallel chunk).
It also carries the escape hatches from the one-transaction-per-tick default: typed event queues for inter-system signalling, and side transactions — ctx.CreateSideTransaction(DurabilityMode.Immediate, CommitDiscipline.Commit) opens an independent transaction mid-tick for an immediate, ACID write (a player purchase, a teleport) that must not ride the tick's shared commit.
How it relates
- System — receives a
TickContextinExecute; it is the system's window on the world. - Tick — one context per system per tick; side transactions and event queues are how you step outside the default.
- Transaction —
ctx.Transactionis the system's;ctx.CreateSideTransactionopens another. - EntityAccessor —
ctx.Accessor, for parallel chunks that write noVersionedcomponent.
In the API
TickContext—Transaction/Accessor/Entities/DeltaTime/SpatialGrid/Commands.TickContext.CreateSideTransaction(DurabilityMode, CommitDiscipline)— an independent mid-tick transaction.- Typed
EventQueue<T>— multi-producer inter-system signalling, drained per tick. Produce throughctx.Writer(queue), which binds the calling worker's own segment.
Learn & use
- Feature detail: Tick-based execution engine · side-transactions · typed event queues
- Narrative: Guide ch.5 — systems