Vixen
02b45cc4
csharp
public sealed class SystemRunner

Owns a world's systems and runs them, one phase at a time.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Within a phase, systems run against the dependency graph: each takes the combined handles of the earlier systems it conflicts with, and returns a handle of its own. Nothing waits for anything it does not have to.

A phase is bracketed. The world's version moves on before anything runs, so that everything the phase writes is distinguishable from everything before it; then the systems run; then their work is completed; then the command buffer is played back. Completing before playback is not a detail — a structural change moves rows between chunks, and a job still walking one would be walking memory that has just been overwritten.

The fixed-step accumulator is not here. How many times FixedUpdate runs in a frame is the game loop's decision, and the loop is Vixen.Engine's (see [03](../../../docs/plan/03-core-foundation.md) § GameTime). This runs a phase when asked to.

Fields and properties (4)

  • public World World

    The world the systems operate on.

  • public JobScheduler? Jobs

    The scheduler systems hand work to, or to run inline.

  • public CommandBuffer Commands

    The buffer structural change is recorded into, played back at every phase boundary.

  • public SystemGraph Graph

    The graph, built on first use and rebuilt when a system is added.

Methods (6)

  • public SystemRunner(World world, JobScheduler? jobs = null)

    Creates a runner.

  • public SystemRunner Add(ISystem system)

    Adds a system. Its phase and ordering come from its attributes.

  • public void Initialize(GameTime time = default(GameTime))

    Initialises every system, in the order the graph puts them.

  • public void RunPhase(SystemPhase phase, GameTime time)

    Runs one phase to completion.

  • public void RunFrame(GameTime time)

    Runs every phase once, in order.

  • public void Dispose()

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Used by (5)

  • AnimationSystemsVixen.Animation
  • EngineLoopVixen.Engine
  • EngineLoopTestsVixen.Engine.Tests
  • PhysicsSystemsVixen.Physics
  • SystemTestsVixen.Ecs.Tests