SpawnManager Class
Manager for processing spawn and despawn requests. More...
Declaration
Base classes
| class | Manager |
|
Abstract base class for managers that process deferred operations. More... | |
| class | PoolRequestHandler |
|
Interface for handlers that process spawn and despawn requests for a pool. More... | |
Public Constructors Index
| SpawnManager (helios::engine::core::data::GameObjectPoolId gameObjectPoolId, std::unique_ptr< helios::engine::runtime::factory::GameObjectFactory > gameObjectFactory) | |
|
Constructs a SpawnManager for a specific pool. More... | |
Public Member Functions Index
| bool | submit (const helios::engine::mechanics::spawn::requests::SpawnRequest request) noexcept override |
|
Submits a spawn request for deferred processing. More... | |
| bool | submit (const helios::engine::mechanics::spawn::requests::DespawnRequest request) noexcept override |
|
Submits a despawn request for deferred processing. More... | |
| void | flush (helios::engine::runtime::world::GameWorld &gameWorld, helios::engine::runtime::world::UpdateContext &updateContext) noexcept override |
|
Flushes pending requests, processing despawns then spawns. More... | |
| void | init (helios::engine::runtime::world::GameWorld &gameWorld) noexcept |
|
Initializes the manager, populating the pool. More... | |
Private Member Functions Index
| void | prepareSpawn (const helios::engine::mechanics::spawn::requests::SpawnRequest &spawnRequest) const noexcept |
|
Prepares a spawn request before execution. More... | |
| void | spawnObjects (std::span< helios::engine::mechanics::spawn::requests::SpawnRequest > requests, helios::engine::runtime::world::GameWorld &gameWorld, helios::engine::runtime::world::UpdateContext &updateContext) |
|
Processes spawn requests, acquiring and initializing objects. More... | |
| void | despawnObjects (std::span< helios::engine::mechanics::spawn::requests::DespawnRequest > requests, helios::engine::runtime::world::GameWorld &gameWorld, helios::engine::runtime::world::UpdateContext &updateContext) |
|
Processes despawn requests, releasing objects back to pools. More... | |
Private Member Attributes Index
| helios::engine::core::data::GameObjectPoolId | gameObjectPoolId_ |
|
The pool ID this manager is responsible for. More... | |
| helios::engine::runtime::pooling::GameObjectPool * | gameObjectPool_ |
|
Pointer to the managed pool. More... | |
| std::vector< helios::engine::mechanics::spawn::requests::SpawnRequest > | spawnRequests_ |
|
Queue of pending spawn requests. More... | |
| std::vector< helios::engine::mechanics::spawn::requests::DespawnRequest > | despawnRequests_ |
|
Queue of pending despawn requests. More... | |
| std::shared_ptr< helios::engine::runtime::factory::GameObjectFactory > | gameObjectFactory_ |
|
Factory for creating and populating pool objects. More... | |
| helios::engine::runtime::pooling::GameObjectPoolFacade | gameObjectPoolFacade_ {} |
|
Facade for pool acquire/release operations. More... | |
Description
Manager for processing spawn and despawn requests.
SpawnManager is a Manager that handles the lifecycle of pooled GameObjects. It receives SpawnRequest and DespawnRequest instances, queues them, and processes them during the manager flush phase.
During flush: 1. Despawn requests are processed first, returning entities to their pools. 2. Spawn requests are then processed, acquiring entities and initializing them.
The manager uses a GameObjectFactory to populate the pool initially and a GameObjectPoolFacade for acquire/release operations.
SpawnManager also implements PoolRequestHandler, allowing it to be registered with a GameWorld for a specific pool ID.
- See Also
SpawnRequest
- See Also
DespawnRequest
- See Also
GameObjectFactory
- See Also
PoolRequestHandler
Definition at line 65 of file SpawnManager.ixx.
Public Constructors
SpawnManager()
| inline explicit |
Constructs a SpawnManager for a specific pool.
- Parameters
-
gameObjectPoolId The ID of the pool to manage.
gameObjectFactory Factory for populating the pool with objects.
Definition at line 176 of file SpawnManager.ixx.
Public Member Functions
flush()
| inline noexcept virtual |
Flushes pending requests, processing despawns then spawns.
- Parameters
-
gameWorld The game world.
updateContext The current update context.
Definition at line 214 of file SpawnManager.ixx.
init()
| inline noexcept virtual |
Initializes the manager, populating the pool.
Retrieves the pool from the GameWorld, uses the factory to fill it with objects, and registers this manager as the pool's request handler.
- Parameters
-
gameWorld The game world containing the pool.
Definition at line 238 of file SpawnManager.ixx.
References helios::engine::runtime::world::GameWorld::pool and helios::engine::runtime::world::GameWorld::registerPoolRequestHandler.
submit()
| inline noexcept virtual |
Submits a spawn request for deferred processing.
- Parameters
-
request The spawn request to queue.
- Returns
Always returns true.
Definition at line 191 of file SpawnManager.ixx.
submit()
| inline noexcept virtual |
Submits a despawn request for deferred processing.
- Parameters
-
request The despawn request to queue.
- Returns
Always returns true.
Definition at line 203 of file SpawnManager.ixx.
Private Member Functions
despawnObjects()
| inline |
Processes despawn requests, releasing objects back to pools.
- Parameters
-
requests Span of despawn requests to process.
gameWorld The game world.
updateContext The current update context.
Definition at line 155 of file SpawnManager.ixx.
prepareSpawn()
| inline noexcept |
Prepares a spawn request before execution.
- Parameters
-
spawnRequest The request to prepare.
Definition at line 102 of file SpawnManager.ixx.
spawnObjects()
| inline |
Processes spawn requests, acquiring and initializing objects.
- Parameters
-
requests Span of spawn requests to process.
gameWorld The game world.
updateContext The current update context.
Definition at line 115 of file SpawnManager.ixx.
Private Member Attributes
despawnRequests_
|
Queue of pending despawn requests.
Definition at line 85 of file SpawnManager.ixx.
gameObjectFactory_
|
Factory for creating and populating pool objects.
Definition at line 90 of file SpawnManager.ixx.
gameObjectPool_
|
Pointer to the managed pool.
Definition at line 75 of file SpawnManager.ixx.
gameObjectPoolFacade_
|
Facade for pool acquire/release operations.
Definition at line 95 of file SpawnManager.ixx.
gameObjectPoolId_
|
The pool ID this manager is responsible for.
Definition at line 70 of file SpawnManager.ixx.
spawnRequests_
|
Queue of pending spawn requests.
Definition at line 80 of file SpawnManager.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.