spawn Folder
Folders Index
| folder | components |
| folder | systems |
Files Index
| file | helios/engine/mechanics/spawn/_module.ixx |
|
Aggregate module for helios::engine::mechanics::spawn namespace. More... | |
| file | mechanics/spawn/registry.ixx |
|
Component registration for spawn module. More... | |
Description
helios::engine::mechanics::spawn
Entity spawning and lifecycle management.
This module provides the infrastructure for spawning and despawning GameObjects at runtime based on configurable conditions and scheduling rules.
Architecture
The spawn system follows a scheduler-based architecture with separation of concerns:
┌─────────────────────┐ ┌─────────────────────┐
│ SpawnCondition │ │ SpawnStrategy │
│ (when to spawn) │ │ (how to spawn) │
└─────────┬───────────┘ └──────────┬──────────┘
│ │
▼ ▼
┌─────────────────────────────────────────────────┐
│ SpawnScheduler │
│ (evaluates rules, produces ScheduledPlans) │
└─────────────────────┬───────────────────────────┘
│
▼
┌─────────────────────────────────────────────────┐
│ GameObjectSpawnSystem │
│ (reads frame events, enqueues SpawnCommands) │
└─────────────────────┬───────────────────────────┘
│
▼
┌─────────────────────────────────────────────────┐
│ ScheduledSpawnPlanCommand │
│ (dispatched to SpawnManager for execution) │
└─────────────────────────────────────────────────┘
Submodules
| Directory | Purpose |
|---|---|
| components/ | Spawn-related components (SpawnedByProfileComponent) |
| systems/ | GameObjectSpawnSystem for game loop integration |
Related Modules
The spawn system integrates with several other modules:
- helios.engine.mechanics.spawn.logic - SpawnScheduler, SpawnCondition, SpawnStrategy
- helios.engine.mechanics.spawn.commands - ScheduledSpawnPlanCommand
- helios.engine.runtime.spawn - SpawnManager, SpawnCommandHandler
- helios.engine.runtime.pooling - GameObjectPoolManager
Usage
// 1 Create spawn rules with conditions
auto scheduler = std::make_unique<SpawnScheduler>();
scheduler->addRule(
SpawnRuleId{1},
std::make_unique<TimerSpawnCondition>(2.0f), // Every 2 seconds
enemyProfileId
);
// 2 Create the spawn system with the scheduler
auto spawnSystem = std::make_unique<GameObjectSpawnSystem>(
std::move(scheduler)
);
// 3 Register with the game loop
gameLoop.phase(PhaseType::Main)
.addPass()
.addSystem(std::move(spawnSystem));
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.