SpawnScheduler Class
Abstract base class for spawn schedulers. More...
Declaration
Derived Classes
| class | CyclicSpawnScheduler<N> |
|
Scheduler that cycles through spawn rules in round-robin order. More... | |
| class | DefaultSpawnScheduler |
|
Scheduler that evaluates spawn rules and produces spawn plans. More... | |
Public Constructors Index
| SpawnScheduler ()=default | |
|
Default constructor. More... | |
Public Destructor Index
| ~SpawnScheduler ()=default | |
|
Virtual destructor for proper cleanup. More... | |
Public Member Functions Index
| void | evaluate (const GameWorld &gameWorld, const UpdateContext &updateContext, const SpawnContext &spawnContext={}) noexcept=0 |
|
Evaluates spawn rules and schedules spawn plans. More... | |
| std::span< const ScheduledSpawnPlan > | scheduledPlans () |
|
Returns a read-only view of scheduled spawn plans. More... | |
| std::vector< ScheduledSpawnPlan > | drainScheduledPlans () |
|
Drains and returns all scheduled spawn plans. More... | |
| void | commit (SpawnRuleId spawnRuleId, const size_t spawnCount) noexcept=0 |
|
Commits a completed spawn operation to update rule state. More... | |
| void | reset () noexcept=0 |
|
Resets all rule states to their initial values. More... | |
Protected Member Attributes Index
| std::vector< ScheduledSpawnPlan > | scheduledSpawnPlans_ |
|
Buffer for scheduled spawn plans awaiting processing. More... | |
Description
Abstract base class for spawn schedulers.
SpawnScheduler defines the interface for evaluating spawn rules and producing scheduled spawn plans. Concrete implementations determine the evaluation strategy (all rules vs. cyclic, priority-based, etc.).
## Responsibilities
- Maintain a buffer of scheduled spawn plans
- Provide `evaluate()` for rule processing
- Provide `drainScheduledPlans()` for retrieving pending spawns
- Provide `commit()` for post-spawn state updates
## Implementations
| Class | Strategy | |-------|----------| | `DefaultSpawnScheduler` | Evaluates all rules each frame | | `CyclicSpawnScheduler` | Round-robin evaluation, advances on successful spawn |
- See Also
- See Also
- See Also
Definition at line 54 of file SpawnScheduler.ixx.
Public Constructors
SpawnScheduler()
| default |
Default constructor.
Definition at line 73 of file SpawnScheduler.ixx.
Public Destructor
~SpawnScheduler()
| virtual default |
Virtual destructor for proper cleanup.
Definition at line 68 of file SpawnScheduler.ixx.
Public Member Functions
commit()
| noexcept |
Commits a completed spawn operation to update rule state.
Called when a spawn request has been executed to update the associated rule's state (e.g., reset timers, update counts).
- Parameters
-
spawnRuleId The rule that triggered the spawn.
spawnCount The number of entities actually spawned.
Definition at line 125 of file SpawnScheduler.ixx.
drainScheduledPlans()
| inline nodiscard |
Drains and returns all scheduled spawn plans.
Moves all pending plans out of the scheduler and returns them. The internal buffer is left empty.
- Returns
Vector of scheduled spawn plans.
Definition at line 109 of file SpawnScheduler.ixx.
Reference scheduledSpawnPlans_.
evaluate()
| noexcept |
Evaluates spawn rules and schedules spawn plans.
Processes registered spawn rules according to the scheduler's strategy. Produces ScheduledSpawnPlan instances for rules whose conditions are met.
- Parameters
-
gameWorld The game world where evaluation takes place.
updateContext Current frame context with delta time and world.
spawnContext Optional spawn context for the operation.
Definition at line 86 of file SpawnScheduler.ixx.
reset()
| noexcept |
Resets all rule states to their initial values.
Called during level transitions or game restarts.
Definition at line 132 of file SpawnScheduler.ixx.
scheduledPlans()
| inline nodiscard |
Returns a read-only view of scheduled spawn plans.
- Returns
Span of currently scheduled plans.
Definition at line 97 of file SpawnScheduler.ixx.
Reference scheduledSpawnPlans_.
Protected Member Attributes
scheduledSpawnPlans_
| protected |
Buffer for scheduled spawn plans awaiting processing.
Definition at line 61 of file SpawnScheduler.ixx.
Referenced by helios::engine::runtime::spawn::scheduling::DefaultSpawnScheduler::DefaultSpawnScheduler, drainScheduledPlans, helios::engine::runtime::spawn::scheduling::CyclicSpawnScheduler< N >::evaluate, helios::engine::runtime::spawn::scheduling::DefaultSpawnScheduler::evaluate and scheduledPlans.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.