Skip to main content

scheduling Folder

Files Index

filehelios/engine/runtime/spawn/scheduling/_module.ixx

Aggregate module for helios::engine::runtime::spawn::scheduling namespace. More...

fileCyclicSpawnScheduler.ixx

Scheduler that cycles through spawn rules in round-robin order. More...

fileDefaultRuleProcessor.ixx

Default implementation of RuleProcessor for spawn rule evaluation. More...

fileDefaultSpawnScheduler.ixx

Default scheduler that evaluates all spawn rules each frame. More...

fileRuleProcessor.ixx

Abstract interface for processing spawn rules. More...

fileScheduledSpawnPlan.ixx

A spawn plan that has been scheduled for execution. More...

fileSpawnPlan.ixx

Data structure describing a planned spawn operation. More...

fileSpawnScheduler.ixx

Scheduler that evaluates spawn rules and produces spawn plans. More...

Description

helios::engine::runtime::spawn::scheduling

Spawn scheduling and plan management.

Overview

This module provides the scheduling layer for the spawn system. Schedulers evaluate spawn rules and produce ScheduledSpawnPlan instances that are processed by the command pipeline. The architecture separates scheduling strategies from rule processing logic.

Key Classes

ClassPurpose
SpawnSchedulerAbstract base class defining the scheduler interface
DefaultSpawnSchedulerEvaluates all rules every frame
CyclicSpawnScheduler<N>Round-robin evaluation, advances on successful spawn
RuleProcessorAbstract interface for rule evaluation logic
DefaultRuleProcessorStandard rule processing implementation
SpawnPlanData describing a planned spawn (rule, amount)
ScheduledSpawnPlanA plan paired with profile ID and context
RuleConfigConfiguration pairing profile ID with a rule

Architecture

 ┌─────────────────────────────────────────────────────────────────────────┐
 │ SpawnScheduler (abstract) │
 │ ┌───────────────────────────────────────────────────────────────────┐ │
 │ │ evaluate() → Process rules, produce plans │ │
 │ │ drainScheduledPlans() → Return and clear pending plans │ │
 │ │ commit() → Update rule state after spawn │ │
 │ └───────────────────────────────────────────────────────────────────┘ │
 └─────────────────────────────────────────────────────────────────────────┘
  │ │
  ┌───────────┴────────────┐ ┌───────────┴────────────┐
  │ DefaultSpawnScheduler │ │ CyclicSpawnScheduler │
  │ (all rules/frame) │ │ (advance on success) │
  └───────────┬────────────┘ └───────────┬────────────┘
  │ │
  └───────────┬────────────────────┘
 
  ┌───────────┴────────────┐
  │ DefaultRuleProcessor │
  │ (shared logic) │
  └────────────────────────┘

Scheduler Strategies

DefaultSpawnScheduler

Evaluates all registered rules every frame. Best for independent spawn sources that should trigger simultaneously.

 DefaultSpawnScheduler scheduler;
 scheduler
  .addRule(enemyProfileId, std::make_unique<TimerSpawnRule>(ruleA, 2.0f, 3))
  .addRule(pickupProfileId, std::make_unique<TimerSpawnRule>(ruleB, 5.0f, 1));
 
 // Both rules evaluated each frame
 scheduler.evaluate(updateContext, spawnContext);

CyclicSpawnScheduler

Evaluates the current rule each frame and advances to the next rule only after a spawn was successfull committed. The same rule is re-evaluated until its conditions are met. Best for sequential wave patterns where each wave must complete before the next begins.

 CyclicSpawnScheduler<3> scheduler;
 scheduler
  .addRule(wave1ProfileId, std::make_unique<TimerSpawnRule>(rule1, 1.0f, 5))
  .addRule(wave2ProfileId, std::make_unique<TimerSpawnRule>(rule2, 1.0f, 5))
  .addRule(bossProfileId, std::make_unique<TimerSpawnRule>(rule3, 2.0f, 1));
 
 // Evaluates wave1 until spawn occurs, then advances to wave2, etc.
 // Cycle: Wave1 → Wave2 → Boss → Wave1 → ...
 scheduler.evaluate(updateContext, spawnContext);

Workflow

 SpawnRule::evaluate() → SpawnPlan → ScheduledSpawnPlan → Command → SpawnManager

1. Registration: Rules added via addRule() with profile IDs 2. Evaluation: evaluate() called each frame by GameObjectSpawnSystem 3. Processing: RuleProcessor evaluates rules, updates state 4. Scheduling: Rules that pass produce ScheduledSpawnPlans 5. Draining: drainScheduledPlans() returns pending plans 6. Commit: commit() called after spawns to update rule state

Rule Processing

The RuleProcessor abstraction separates evaluation logic from scheduling strategy:

 class RuleProcessor {
 public:
  virtual SpawnPlan processRule(
  const GameWorld& gameWorld,
  const UpdateContext& updateContext,
  const SpawnContext& spawnContext,
  SpawnProfileId spawnProfileId,
  SpawnRule& spawnRule,
  SpawnRuleState& spawnRuleState
  ) noexcept = 0;
 };

DefaultRuleProcessor provides the standard implementation: 1. Retrieve pool snapshot from GameObjectPoolManager 2. Update rule state with delta time 3. Evaluate rule conditions 4. Return SpawnPlan with spawn amount

Related Modules

ModulePurpose
helios.engine.runtime.spawn.policySpawnRule implementations
helios.engine.runtime.spawnSpawnManager, SpawnProfile
helios.engine.runtime.poolingGameObjectPoolManager


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.