Table of Contents

Class SystemBuilder

Namespace
Typhon.Engine
Assembly
Typhon.Engine.dll

Configuration builder for class-based system definitions. Used by CallbackSystem, QuerySystem, and PipelineSystem in their Configure method.

public sealed class SystemBuilder
Inheritance
SystemBuilder
Inherited Members

Remarks

All methods return the builder so calls can chain: b.Name("X").After("Y").Reads<Position>().Writes<Velocity>().

Constructors

SystemBuilder()

public SystemBuilder()

Methods

AdditionalReads<T>()

Declare a read of T beyond the system's primary View input (cross-entity read).

public SystemBuilder AdditionalReads<T>() where T : unmanaged

Returns

SystemBuilder

Type Parameters

T

After(string)

Declare a dependency on another system (this system runs after it).

public SystemBuilder After(string dependency)

Parameters

dependency string

Returns

SystemBuilder

AfterAll(params string[])

Declare dependencies on multiple systems (this system runs after all of them).

public SystemBuilder AfterAll(params string[] dependencies)

Parameters

dependencies string[]

Returns

SystemBuilder

Before(string)

Declare that this system must run before another (mirror of After(string)). Useful for the W×W disambiguation case (RFC 07 / Q5).

public SystemBuilder Before(string dependent)

Parameters

dependent string

Returns

SystemBuilder

CanShed(bool)

Set whether this system can be shed entirely under severe overload.

public SystemBuilder CanShed(bool value)

Parameters

value bool

Returns

SystemBuilder

CellAmortize(int)

Set the cell-level amortization denominator (issue #231). When greater than 0, the system processes 1/N of the tier's clusters per tick, and AmortizedDeltaTime becomes DeltaTime × N. Requires a non-All Tier(SimTier).

public SystemBuilder CellAmortize(int denominator)

Parameters

denominator int

Returns

SystemBuilder

ChangeFilter(params Type[])

Set the component types for change-filtered reactive input. OR logic: entity included if any filtered component was written.

public SystemBuilder ChangeFilter(params Type[] componentTypes)

Parameters

componentTypes Type[]

Returns

SystemBuilder

Checkerboard()

Enable two-phase checkerboard dispatch (issue #234). Requires Parallel(). Clusters are split into Red/Black sets based on cell coordinates — no two adjacent cells are processed simultaneously.

public SystemBuilder Checkerboard()

Returns

SystemBuilder

ChunkedParallel(int)

Enable chunk-parallel execution for a CallbackSystem with an explicit chunk count, independent of any entity input. The system's Execute is invoked chunkCount times in parallel across workers; each invocation receives ChunkIndex and ChunkCount so the implementation can offset its data accordingly.

Designed for non-entity-iterating work that's naturally chunkable — e.g. SIMD sweeps over flat arrays, image downsamples, parallel reductions. Skips all entity-prep infrastructure (Accessor, Entities, per-chunk Transaction): the TickContext passed in carries only tick metadata + ChunkIndex/ChunkCount.

Incompatible with Input(Func<ViewBase>), ChangeFilter(params Type[]), WritesVersioned(), Tier(SimTier), CellAmortize(int), Checkerboard(), and ChunksPerWorker(float) — all of those are entity-context concepts.

public SystemBuilder ChunkedParallel(int chunkCount)

Parameters

chunkCount int

Returns

SystemBuilder

ChunksPerWorker(float)

Oversubscription factor for parallel chunk dispatch. The effective worker-cap on chunk count becomes round(WorkerCount × factor) instead of WorkerCount. Default 1.0f.

Use values above 1.0 (e.g. 1.5, 2.0) when a parallel system shows poor worker efficiency because one slow chunk holds back the critical path — extra chunks let fast workers steal more work via the dynamic dispatch loop. Final chunk count is still capped by ceil(entityCount / ParallelQueryMinChunkSize), so small populations don't proliferate chunks.

Validated at Build(IResource, ILogger): must be in [1.0, 64.0], and rejected on non-parallel systems where it has no effect.
public SystemBuilder ChunksPerWorker(float factor)

Parameters

factor float

Returns

SystemBuilder

ExclusivePhase()

Mark this system as having exclusive control of its phase — no other system in the same phase may run concurrently. Use sparingly for systems that own the tick boundary (e.g. archetype cleanup, spatial-index update).

public SystemBuilder ExclusivePhase()

Returns

SystemBuilder

Input(Func<ViewBase>)

Set the View factory providing the system's entity input.

public SystemBuilder Input(Func<ViewBase> viewFactory)

Parameters

viewFactory Func<ViewBase>

Returns

SystemBuilder

Name(string)

Set the system's unique name in the DAG.

public SystemBuilder Name(string name)

Parameters

name string

Returns

SystemBuilder

Parallel()

Enable automatic chunk-parallel execution across workers. QuerySystem only.

public SystemBuilder Parallel()

Returns

SystemBuilder

Phase(Phase)

Assign this system to a phase (RFC 07 / Q3). Phases form a DAG-local total order declared via Phases(params Phase[]) — all systems in phase N complete before any system in phase N+1 of the same DAG. The phase must be one declared on the owning DAG. If not called, the system lands in the DAG's default phase.

public SystemBuilder Phase(Phase phase)

Parameters

phase Phase

Returns

SystemBuilder

Priority(SystemPriority)

Set the system's overload priority.

public SystemBuilder Priority(SystemPriority priority)

Parameters

priority SystemPriority

Returns

SystemBuilder

ReadsEvents(EventQueueBase)

Declare that this system consumes from the given event queue.

public SystemBuilder ReadsEvents(EventQueueBase queue)

Parameters

queue EventQueueBase

Returns

SystemBuilder

ReadsFresh<T>()

Declare that this system reads component T and must be ordered AFTER any same-phase writer of T (sees this-tick value).

public SystemBuilder ReadsFresh<T>() where T : unmanaged

Returns

SystemBuilder

Type Parameters

T

ReadsFresh<T1, T2>()

Batch form of ReadsFresh<T>(): declares fresh reads (each ordered after any same-phase writer) of all listed component types.

public SystemBuilder ReadsFresh<T1, T2>() where T1 : unmanaged where T2 : unmanaged

Returns

SystemBuilder

Type Parameters

T1
T2

ReadsFresh<T1, T2, T3>()

Batch form of ReadsFresh<T>(): declares fresh reads (each ordered after any same-phase writer) of all listed component types.

public SystemBuilder ReadsFresh<T1, T2, T3>() where T1 : unmanaged where T2 : unmanaged where T3 : unmanaged

Returns

SystemBuilder

Type Parameters

T1
T2
T3

ReadsFresh<T1, T2, T3, T4>()

Batch form of ReadsFresh<T>(): declares fresh reads (each ordered after any same-phase writer) of all listed component types.

public SystemBuilder ReadsFresh<T1, T2, T3, T4>() where T1 : unmanaged where T2 : unmanaged where T3 : unmanaged where T4 : unmanaged

Returns

SystemBuilder

Type Parameters

T1
T2
T3
T4

ReadsFresh<T1, T2, T3, T4, T5>()

Batch form of ReadsFresh<T>(): declares fresh reads (each ordered after any same-phase writer) of all listed component types.

public SystemBuilder ReadsFresh<T1, T2, T3, T4, T5>() where T1 : unmanaged where T2 : unmanaged where T3 : unmanaged where T4 : unmanaged where T5 : unmanaged

Returns

SystemBuilder

Type Parameters

T1
T2
T3
T4
T5

ReadsFresh<T1, T2, T3, T4, T5, T6>()

Batch form of ReadsFresh<T>(): declares fresh reads (each ordered after any same-phase writer) of all listed component types.

public SystemBuilder ReadsFresh<T1, T2, T3, T4, T5, T6>() where T1 : unmanaged where T2 : unmanaged where T3 : unmanaged where T4 : unmanaged where T5 : unmanaged where T6 : unmanaged

Returns

SystemBuilder

Type Parameters

T1
T2
T3
T4
T5
T6

ReadsResource(string)

Declare that this system reads a named resource.

public SystemBuilder ReadsResource(string name)

Parameters

name string

Returns

SystemBuilder

ReadsSnapshot<T>()

Declare that this system reads component T and must be ordered BEFORE any same-phase writer of T (sees previous-tick value, enables parallelism with the writer).

public SystemBuilder ReadsSnapshot<T>() where T : unmanaged

Returns

SystemBuilder

Type Parameters

T

ReadsSnapshot<T1, T2>()

Batch form of ReadsSnapshot<T>(): declares snapshot reads (each ordered before any same-phase writer) of all listed component types.

public SystemBuilder ReadsSnapshot<T1, T2>() where T1 : unmanaged where T2 : unmanaged

Returns

SystemBuilder

Type Parameters

T1
T2

ReadsSnapshot<T1, T2, T3>()

Batch form of ReadsSnapshot<T>(): declares snapshot reads (each ordered before any same-phase writer) of all listed component types.

public SystemBuilder ReadsSnapshot<T1, T2, T3>() where T1 : unmanaged where T2 : unmanaged where T3 : unmanaged

Returns

SystemBuilder

Type Parameters

T1
T2
T3

ReadsSnapshot<T1, T2, T3, T4>()

Batch form of ReadsSnapshot<T>(): declares snapshot reads (each ordered before any same-phase writer) of all listed component types.

public SystemBuilder ReadsSnapshot<T1, T2, T3, T4>() where T1 : unmanaged where T2 : unmanaged where T3 : unmanaged where T4 : unmanaged

Returns

SystemBuilder

Type Parameters

T1
T2
T3
T4

ReadsSnapshot<T1, T2, T3, T4, T5>()

Batch form of ReadsSnapshot<T>(): declares snapshot reads (each ordered before any same-phase writer) of all listed component types.

public SystemBuilder ReadsSnapshot<T1, T2, T3, T4, T5>() where T1 : unmanaged where T2 : unmanaged where T3 : unmanaged where T4 : unmanaged where T5 : unmanaged

Returns

SystemBuilder

Type Parameters

T1
T2
T3
T4
T5

ReadsSnapshot<T1, T2, T3, T4, T5, T6>()

Batch form of ReadsSnapshot<T>(): declares snapshot reads (each ordered before any same-phase writer) of all listed component types.

public SystemBuilder ReadsSnapshot<T1, T2, T3, T4, T5, T6>() where T1 : unmanaged where T2 : unmanaged where T3 : unmanaged where T4 : unmanaged where T5 : unmanaged where T6 : unmanaged

Returns

SystemBuilder

Type Parameters

T1
T2
T3
T4
T5
T6

Reads<T>()

Declare that this system reads component T. Unit 3 errors at Build() if a same-phase writer of T exists — upgrade to ReadsFresh<T>() or ReadsSnapshot<T>().

public SystemBuilder Reads<T>() where T : unmanaged

Returns

SystemBuilder

Type Parameters

T

Reads<T1, T2>()

Batch form of Reads<T>(): declares reads of all listed component types.

public SystemBuilder Reads<T1, T2>() where T1 : unmanaged where T2 : unmanaged

Returns

SystemBuilder

Type Parameters

T1
T2

Reads<T1, T2, T3>()

Batch form of Reads<T>(): declares reads of all listed component types.

public SystemBuilder Reads<T1, T2, T3>() where T1 : unmanaged where T2 : unmanaged where T3 : unmanaged

Returns

SystemBuilder

Type Parameters

T1
T2
T3

Reads<T1, T2, T3, T4>()

Batch form of Reads<T>(): declares reads of all listed component types.

public SystemBuilder Reads<T1, T2, T3, T4>() where T1 : unmanaged where T2 : unmanaged where T3 : unmanaged where T4 : unmanaged

Returns

SystemBuilder

Type Parameters

T1
T2
T3
T4

Reads<T1, T2, T3, T4, T5>()

Batch form of Reads<T>(): declares reads of all listed component types.

public SystemBuilder Reads<T1, T2, T3, T4, T5>() where T1 : unmanaged where T2 : unmanaged where T3 : unmanaged where T4 : unmanaged where T5 : unmanaged

Returns

SystemBuilder

Type Parameters

T1
T2
T3
T4
T5

Reads<T1, T2, T3, T4, T5, T6>()

Batch form of Reads<T>(): declares reads of all listed component types.

public SystemBuilder Reads<T1, T2, T3, T4, T5, T6>() where T1 : unmanaged where T2 : unmanaged where T3 : unmanaged where T4 : unmanaged where T5 : unmanaged where T6 : unmanaged

Returns

SystemBuilder

Type Parameters

T1
T2
T3
T4
T5
T6

ShouldRun(Func<bool>)

Set a predicate that must return true for the system to execute. Evaluated before any input processing.

public SystemBuilder ShouldRun(Func<bool> predicate)

Parameters

predicate Func<bool>

Returns

SystemBuilder

SideWrites<T>()

Declare that this system writes T via a side-transaction (Immediate). Surfaced in tooling but does NOT affect scheduler ordering.

public SystemBuilder SideWrites<T>() where T : unmanaged

Returns

SystemBuilder

Type Parameters

T

ThrottledTickDivisor(int)

Set the throttled tick divisor (system runs every Nth tick under overload).

public SystemBuilder ThrottledTickDivisor(int divisor)

Parameters

divisor int

Returns

SystemBuilder

TickDivisor(int)

Set the tick divisor (system runs every Nth tick at normal load).

public SystemBuilder TickDivisor(int divisor)

Parameters

divisor int

Returns

SystemBuilder

Tier(SimTier)

Set the simulation-tier dispatch filter (issue #231). Default All matches pre-#231 behaviour (all clusters dispatched). Single-tier (e.g. Tier0) or multi-tier flag combinations (Near, Active) are both supported.

public SystemBuilder Tier(SimTier tier)

Parameters

tier SimTier

Returns

SystemBuilder

WritesEvents(EventQueueBase)

Declare that this system publishes to the given event queue. Unit 3 derives a producer→consumer edge from this against any matching ReadsEvents(EventQueueBase) in the same phase.

public SystemBuilder WritesEvents(EventQueueBase queue)

Parameters

queue EventQueueBase

Returns

SystemBuilder

WritesResource(string)

Declare that this system mutates a named resource (e.g., a shared physics-world handle that isn't a component).

public SystemBuilder WritesResource(string name)

Parameters

name string

Returns

SystemBuilder

WritesVersioned()

Declare that this parallel QuerySystem writes Versioned components. Forces per-chunk Transaction fallback instead of the optimized PointInTimeAccessor path.

public SystemBuilder WritesVersioned()

Returns

SystemBuilder

Writes<T>()

Declare that this system mutates component T via EntityRef.Write<T>(). Unit 3 errors at Build() if another system in the same phase also declares Writes<T> without an explicit After(string)/Before(string).

public SystemBuilder Writes<T>() where T : unmanaged

Returns

SystemBuilder

Type Parameters

T

Writes<T1, T2>()

Batch form of Writes<T>(): declares writes of all listed component types.

public SystemBuilder Writes<T1, T2>() where T1 : unmanaged where T2 : unmanaged

Returns

SystemBuilder

Type Parameters

T1
T2

Writes<T1, T2, T3>()

Batch form of Writes<T>(): declares writes of all listed component types.

public SystemBuilder Writes<T1, T2, T3>() where T1 : unmanaged where T2 : unmanaged where T3 : unmanaged

Returns

SystemBuilder

Type Parameters

T1
T2
T3

Writes<T1, T2, T3, T4>()

Batch form of Writes<T>(): declares writes of all listed component types.

public SystemBuilder Writes<T1, T2, T3, T4>() where T1 : unmanaged where T2 : unmanaged where T3 : unmanaged where T4 : unmanaged

Returns

SystemBuilder

Type Parameters

T1
T2
T3
T4

Writes<T1, T2, T3, T4, T5>()

Batch form of Writes<T>(): declares writes of all listed component types.

public SystemBuilder Writes<T1, T2, T3, T4, T5>() where T1 : unmanaged where T2 : unmanaged where T3 : unmanaged where T4 : unmanaged where T5 : unmanaged

Returns

SystemBuilder

Type Parameters

T1
T2
T3
T4
T5

Writes<T1, T2, T3, T4, T5, T6>()

Batch form of Writes<T>(): declares writes of all listed component types.

public SystemBuilder Writes<T1, T2, T3, T4, T5, T6>() where T1 : unmanaged where T2 : unmanaged where T3 : unmanaged where T4 : unmanaged where T5 : unmanaged where T6 : unmanaged

Returns

SystemBuilder

Type Parameters

T1
T2
T3
T4
T5
T6