Skip to main content

dispatcher Folder

Files Index

filehelios/engine/runtime/spawn/dispatcher/_module.ixx

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

fileDespawnCommandDispatcher.ixx

Dispatcher for routing DespawnCommands to the SpawnManager. More...

fileScheduledSpawnPlanCommandDispatcher.ixx

Dispatcher for routing ScheduledSpawnPlanCommands to the SpawnManager. More...

fileSpawnCommandDispatcher.ixx

Dispatcher for routing SpawnCommands to the SpawnManager. More...

Description

helios::engine::runtime::spawn::dispatcher

Command dispatchers for spawn operations.

Overview

This module contains dispatchers that route spawn and despawn commands to the appropriate managers for processing. Dispatchers implement the visitor pattern, allowing the CommandBuffer to route commands without knowing their concrete types.

Key Classes

DispatcherHandlesPurpose
SpawnCommandDispatcherSpawnCommandRoutes spawn commands to SpawnManager
DespawnCommandDispatcherDespawnCommandRoutes despawn commands to SpawnManager
ScheduledSpawnPlanCommandDispatcherScheduledSpawnPlanCommandRoutes scheduled plans to SpawnManager

Architecture

 ┌─────────────────┐ ┌───────────────┐ ┌──────────────────────────────────┐
 │ CommandBuffer │ │ Dispatcher │ │ SpawnCommandHandler │
 │ │ │ │ │ (SpawnManager) │
 │ flush() │────>│ dispatchTyped │────>│ submit(SpawnCommand) │
 │ │ │ │ │ submit(DespawnCommand) │
 │ │ │ │ │ submit(ScheduledSpawnPlanCommand)│
 └─────────────────┘ └───────────────┘ └──────────────────────────────────┘

Dispatchers are registered with the CommandBuffer during game initialization:

 commandBuffer.addDispatcher<SpawnCommandDispatcher>();
 commandBuffer.addDispatcher<DespawnCommandDispatcher>();
 commandBuffer.addDispatcher<ScheduledSpawnPlanCommandDispatcher>();

Usage

Commands are added to the buffer by systems and automatically routed during flush:

 // In a system
 commandBuffer.add<SpawnCommand>(profileId, spawnContext, count);
 commandBuffer.add<DespawnCommand>(entityGuid, profileId);
 
 // During flush, dispatchers route commands to handlers
 commandBuffer.flush(gameWorld);


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.