Skip to main content

SpawnScheduler Class

Abstract base class for spawn schedulers. More...

Declaration

class helios::engine::runtime::spawn::scheduling::SpawnScheduler { ... }

Derived Classes

classCyclicSpawnScheduler<N>

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

classDefaultSpawnScheduler

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

voidevaluate (const helios::engine::runtime::world::UpdateContext &updateContext, const helios::engine::runtime::spawn::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...

voidcommit (const helios::engine::core::data::SpawnRuleId spawnRuleId, const size_t spawnCount) noexcept=0

Commits a completed spawn operation to update rule state. 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

DefaultSpawnScheduler

See Also

CyclicSpawnScheduler

See Also

ScheduledSpawnPlan

Definition at line 52 of file SpawnScheduler.ixx.

Public Constructors

SpawnScheduler()

helios::engine::runtime::spawn::scheduling::SpawnScheduler::SpawnScheduler ()
default

Default constructor.

Definition at line 71 of file SpawnScheduler.ixx.

Public Destructor

~SpawnScheduler()

virtual helios::engine::runtime::spawn::scheduling::SpawnScheduler::~SpawnScheduler ()
virtual default

Virtual destructor for proper cleanup.

Definition at line 66 of file SpawnScheduler.ixx.

Public Member Functions

commit()

virtual void helios::engine::runtime::spawn::scheduling::SpawnScheduler::commit (const helios::engine::core::data::SpawnRuleId spawnRuleId, const size_t spawnCount)
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 121 of file SpawnScheduler.ixx.

drainScheduledPlans()

std::vector< ScheduledSpawnPlan > helios::engine::runtime::spawn::scheduling::SpawnScheduler::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 105 of file SpawnScheduler.ixx.

105 [[nodiscard]] std::vector<ScheduledSpawnPlan> drainScheduledPlans() {
106 std::vector<ScheduledSpawnPlan> plans{};
107 plans.swap(scheduledSpawnPlans_);
108 return plans;
109 }

Reference scheduledSpawnPlans_.

evaluate()

virtual void helios::engine::runtime::spawn::scheduling::SpawnScheduler::evaluate (const helios::engine::runtime::world::UpdateContext & updateContext, const helios::engine::runtime::spawn::SpawnContext & spawnContext={})
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
updateContext

Current frame context with delta time and world.

spawnContext

Optional spawn context for the operation.

Definition at line 83 of file SpawnScheduler.ixx.

scheduledPlans()

std::span< const ScheduledSpawnPlan > helios::engine::runtime::spawn::scheduling::SpawnScheduler::scheduledPlans ()
inline nodiscard

Returns a read-only view of scheduled spawn plans.

Returns

Span of currently scheduled plans.

Definition at line 93 of file SpawnScheduler.ixx.

93 [[nodiscard]] std::span<const ScheduledSpawnPlan> scheduledPlans() {
95 }

Reference scheduledSpawnPlans_.

Protected Member Attributes

scheduledSpawnPlans_

std::vector<ScheduledSpawnPlan> helios::engine::runtime::spawn::scheduling::SpawnScheduler::scheduledSpawnPlans_
protected

The documentation for this class was generated from the following file:


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.