Strata - v1.4.10
    Preparing search index...

    Function createSystemScheduler

    • Creates a new system scheduler for managing ECS systems.

      Factory function for creating a system scheduler. The scheduler manages multiple systems, executes them in priority order, and uses a dirty flag optimization to avoid re-sorting on every frame.

      Type Parameters

      Returns SystemScheduler<T>

      A SystemScheduler instance with registration and execution methods.

      interface GameEntity extends BaseEntity {
      position?: { x: number; y: number };
      velocity?: { x: number; y: number };
      }

      const scheduler = createSystemScheduler<GameEntity>();

      // Movement system
      scheduler.register({
      name: 'movement',
      priority: 0,
      fn: (world, dt) => {
      for (const e of world.query('position', 'velocity')) {
      e.position.x += e.velocity.x * dt;
      e.position.y += e.velocity.y * dt;
      }
      }
      });