Vixen
02b45cc4
csharp
public sealed class EngineLoop

A world, its systems, its behaviours and the clock — one frame at a time.

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

Remarks

Every step is public and every phase can be run on its own, so an editor's play mode, a determinism test and the application host all drive the same loop rather than three near-copies of it. That is [17](../../../docs/plan/17-app-heads-and-shipping.md)'s rule that nothing in the boot path is inaccessible, applied one layer up.

The loop owns no clock of its own. Frame is told how much time passed, which is what makes a fixed-step replay from an input log possible at all — the same sequence of deltas produces the same sequence of frames, with no reference to a wall clock anywhere.

Fields and properties (7)

  • public World World

    The world everything operates on.

  • public SystemRunner Systems

    The systems, in their phases.

  • public BehaviorStore Behaviors

    The behaviours attached to this world's entities.

  • public CoroutineScheduler Coroutines

    Where suspended coroutines wait.

  • public FixedStepAccumulator FixedStep

    How the frame delta is turned into whole simulation steps.

  • public GameTime Time

    The clock, as of the last frame.

  • public int LastFixedSteps

    How many fixed steps the last frame ran.

Methods (4)

  • public EngineLoop(World? world = null, JobScheduler? jobs = null, FixedStepAccumulator? fixedStep = null, bool registerDefaultSystems = true)

    Creates a loop.

  • public EngineLoop Add(ISystem system)

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

  • public void Frame(TimeSpan elapsed, float timeScale = 1)

    Runs one frame: every phase in order, with fixed update run as many times as it is owed.

  • public void Dispose()

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

Used by (23)

  • ArenaThirdPersonShooter
  • PlayerRigThirdPersonShooter
  • ProgramEcsStressTest
  • AnimationSystemsVixen.Animation
  • AppBuilderVixen.App.Hosting
  • AppGraphicsVixen.App.Hosting
  • AppServicesVixen.App.Hosting
  • BehaviorTestsVixen.Engine.Tests
  • CameraDirectorTestsVixen.Engine.Tests
  • CoroutineTestsVixen.Engine.Tests
  • DebugDrawTestsVixen.Engine.Tests
  • EngineLoopTestsVixen.Engine.Tests
  • GizmoTestsVixen.Animation.Tests
  • PhysicsSceneTestsVixen.Physics.Tests
  • PhysicsSystemsVixen.Physics
  • SpawnerVixen.Engine.Tests
  • VixenApplicationVixen.App.Hosting
  • WorldRendererVixen.Engine.Renderer
  • WorldRendererTestsVixen.Engine.Renderer.Tests
  • HostedEngineTestsVixen.App.Tests
  • HostedRendererTestsVixen.App.Tests
  • OrderingGameVixen.App.Tests
  • StartupSceneTestsVixen.App.Tests