DistributedSpawnPlacer Class Template
Spawn placer that assigns entities to predefined spawn points. More...
Declaration
Base class
| class | SpawnPlacer |
|
Abstract interface for determining spawn positions. More... | |
Public Constructors Index
template <typename... Args> | |
| DistributedSpawnPlacer (Args &&...args) | |
|
Constructs a DistributedSpawnPlacer with N spawn locations. More... | |
Public Member Functions Index
template <std::size_t N> | |
| helios::math::vec3f | getPosition (const helios::engine::ecs::EntityHandle &entityHandle, const helios::math::aabbf &gameObjectBounds, const helios::math::aabbf &environmentBounds, const SpawnPlanCursor &cursor, const SpawnContext &spawnContext) override |
|
Returns the spawn location for the current entity. More... | |
Private Member Attributes Index
template <std::size_t N> | |
| std::array< helios::math::vec3f, N > | locations_ {} |
|
Fixed array of spawn point locations. More... | |
Description
Spawn placer that assigns entities to predefined spawn points.
DistributedSpawnPlacer uses a fixed-size array of locations to distribute spawned entities. Entities are assigned to locations based on their cursor position within the spawn batch, dividing the batch evenly across all available spawn points.
## Distribution Algorithm
Entities are mapped to locations using: `bin = N * (position / spawnCount)`
This ensures even distribution when spawn count exceeds location count, and direct mapping when spawn count equals location count.
## Use Cases
- **Fixed spawn points:** Enemies spawning at predefined positions
- **Formation patterns:** Entities placed in specific arrangements
- **Level design:** Designer-defined spawn locations
## Usage
```cpp // Create placer with 3 fixed spawn points auto placer = std::make_unique<DistributedSpawnPlacer<3>>( helios::math::vec3f{-50.0f, 100.0f, 0.0f}, helios::math::vec3f{ 0.0f, 100.0f, 0.0f}, helios::math::vec3f{ 50.0f, 100.0f, 0.0f} );
// 3 entities spawn at the 3 locations // 6 entities: 2 per location ```
- Template Parameters
-
N Number of spawn locations.
- See Also
- See Also
Definition at line 67 of file DistributedSpawnPlacer.ixx.
Public Constructors
DistributedSpawnPlacer()
| inline explicit |
Constructs a DistributedSpawnPlacer with N spawn locations.
- Template Parameters
-
Args Types of location arguments (must be vec3f).
- Parameters
-
args Exactly N spawn point locations.
The number of arguments must match template parameter N.
Definition at line 87 of file DistributedSpawnPlacer.ixx.
Public Member Functions
getPosition()
| inline virtual |
Returns the spawn location for the current entity.
Maps the cursor position to one of the predefined locations by dividing the spawn batch evenly across available spawn points.
- Parameters
-
guid Unique identifier of the entity (unused).
gameObjectBounds Bounding box of the entity (unused).
environmentBounds Bounding box of the environment (unused).
cursor Current spawn batch cursor with position and count.
spawnContext Context for the spawn operation (unused).
- Returns
World position from the locations array.
Definition at line 103 of file DistributedSpawnPlacer.ixx.
References helios::engine::runtime::spawn::SpawnPlanCursor::position and helios::engine::runtime::spawn::SpawnPlanCursor::spawnCount.
Private Member Attributes
locations_
|
Fixed array of spawn point locations.
Definition at line 72 of file DistributedSpawnPlacer.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.