Skip to main content

DefaultRuleProcessor Class

Default implementation of RuleProcessor. More...

Declaration

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

Base class

classRuleProcessor

Abstract interface for processing spawn rules into spawn plans. More...

Public Member Functions Index

SpawnPlanprocessRule (const world::GameWorld &gameWorld, const UpdateContext &updateContext, const SpawnContext &spawnContext, const SpawnProfileId spawnProfileId, SpawnRule &spawnRule, SpawnRuleState &spawnRuleState) noexcept override

Processes a spawn rule using standard evaluation logic. More...

Description

Default implementation of RuleProcessor.

DefaultRuleProcessor provides the standard rule processing logic:

1. Retrieves the SpawnProfile from the SpawnManager 2. Gets a pool snapshot from the GameObjectPoolManager 3. Updates the rule state with the current delta time 4. Evaluates the rule and returns the resulting SpawnPlan

This processor is used by both DefaultSpawnScheduler and CyclicSpawnScheduler.

See Also

RuleProcessor

See Also

DefaultSpawnScheduler

See Also

CyclicSpawnScheduler

Definition at line 48 of file DefaultRuleProcessor.ixx.

Public Member Functions

processRule()

SpawnPlan helios::engine::runtime::spawn::scheduling::DefaultRuleProcessor::processRule (const world::GameWorld & gameWorld, const UpdateContext & updateContext, const SpawnContext & spawnContext, const SpawnProfileId spawnProfileId, SpawnRule & spawnRule, SpawnRuleState & spawnRuleState)
inline noexcept virtual

Processes a spawn rule using standard evaluation logic.

Retrieves pool state, updates the rule's timer/state, and evaluates the rule to produce a spawn plan.

Parameters
gameWorld

The game world where the rule is processed.

updateContext

Current frame context.

spawnContext

Context for the spawn operation.

spawnProfileId

Profile ID to look up spawn configuration.

spawnRule

The rule to evaluate.

spawnRuleState

Mutable state tracking timers and counts.

Returns

SpawnPlan indicating how many entities to spawn.

Definition at line 67 of file DefaultRuleProcessor.ixx.

68 const world::GameWorld& gameWorld,
69 const UpdateContext& updateContext,
70 const SpawnContext& spawnContext,
71 const SpawnProfileId spawnProfileId,
72 SpawnRule& spawnRule,
73 SpawnRuleState& spawnRuleState
74 ) noexcept override {
75 const auto* poolManager = gameWorld.tryManager<helios::engine::runtime::pooling::GameObjectPoolManager>();
76 const auto* spawnManager = gameWorld.tryManager<helios::engine::runtime::spawn::SpawnManager>();
77
78 const auto* spawnProfile = spawnManager->spawnProfile(spawnProfileId);
79 assert(spawnProfile != nullptr);
80
81 const auto& [gameObjectPoolId, _, __] = *spawnProfile;
82
83 const auto poolSnapshot = poolManager->poolSnapshot(gameObjectPoolId);
84
85 // tick the rule state
86 spawnRuleState.update(updateContext.deltaTime());
87
88 return spawnRule.evaluate(
89 gameObjectPoolId, poolSnapshot,
90 spawnRuleState,
91 gameWorld,
92 updateContext
93 );
94 }

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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.