Skip to main content

spawn Folder

Folders Index

folderbehavior
foldercommands
folderevents
folderpolicy
folderscheduling
foldertypes

Files Index

filehelios/engine/runtime/spawn/_module.ixx

Aggregate module for helios::engine::runtime::spawn namespace. More...

fileSpawnManager.ixx

Manager for processing spawn and despawn commands from pools. More...

Description

helios::engine::runtime::spawn

Entity spawning infrastructure for the helios engine.

Overview

This module provides a complete spawning pipeline for managing entity lifecycle at runtime. It separates concerns into scheduling (when/how many), behavior (where/how), and execution (pool integration).

Architecture

 ┌─────────────────────────────────────────────────────────────────────┐
 │ SPAWN PIPELINE │
 ├─────────────────────────────────────────────────────────────────────┤
 │ │
 │ POLICY LAYER (when/how many) │
 │ ┌─────────────┐ ┌─────────────┐ ┌──────────────┐ │
 │ │ SpawnRule │───>│SpawnCondition───>│AmountProvider│ │
 │ └─────────────┘ └─────────────┘ └──────────────┘ │
 │ │ │
 │ ▼ │
 │ SCHEDULING LAYER │
 │ ┌─────────────────────────────────────────┐ │
 │ │ SpawnScheduler │ │
 │ │ (evaluates rules, produces plans) │ │
 │ └────────────────────┬────────────────────┘ │
 │ │ │
 │ ▼ │
 │ COMMAND LAYER │
 │ ┌─────────────────────────────────────────┐ │
 │ │ ScheduledSpawnPlanCommand │ │
 │ └────────────────────┬────────────────────┘ │
 │ │ │
 │ ▼ │
 │ EXECUTION LAYER │
 │ ┌─────────────────────────────────────────┐ │
 │ │ SpawnManager │ │
 │ │ ┌───────────┐ ┌───────────┐ │ │
 │ │ │SpawnPlacer│ │Initializer│ │ │
 │ │ └───────────┘ └───────────┘ │ │
 │ └─────────────────────────────────────────┘ │
 │ │
 └─────────────────────────────────────────────────────────────────────┘

Submodules

DirectoryPurpose
behavior/SpawnPlacer and SpawnInitializer interfaces with implementations
commands/Spawn and despawn commands for deferred execution
events/Frame-level events for spawn confirmation
policy/Spawn rules, conditions, and amount providers
scheduling/SpawnScheduler and SpawnPlan management

Key Classes

ClassPurpose
SpawnManagerManager processing spawn/despawn requests via pools
SpawnProfileConfiguration bundling pool ID, placer, and initializer
SpawnSchedulerEvaluates rules and produces scheduled spawn plans
SpawnContextContext passed to placers/initializers during spawn
EmitterContextSource entity state for emitter-relative spawning

Usage

 // 1 Create spawn profile with behaviors
 auto profile = std::make_unique<SpawnProfile>(SpawnProfile{
  .gameObjectPoolId = bulletPoolId,
  .spawnPlacer = std::make_unique<EmitterSpawnPlacer>(),
  .spawnInitializer = std::make_unique<EmitterInitializer>()
 });
 
 // 2 Register profile with spawn manager
 spawnManager.addSpawnProfile(bulletProfileId, std::move(profile));
 
 // 3 Create scheduler with rules
 auto scheduler = std::make_unique<SpawnScheduler>();
 scheduler->addRule(bulletProfileId, std::make_unique<SpawnRule>(
  std::make_unique<TimerSpawnCondition>(0.1f),
  std::make_unique<FixedSpawnAmount>(1),
  SpawnRuleId{1}
 ));
 
 // 4 Add spawn system to game loop
 gameLoop.phase(PhaseType::Main).addPass()
  .addSystem<GameObjectSpawnSystem>(std::move(scheduler));


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.