Skip to main content

pooling Folder

Folders Index

foldercomponents

Files Index

filehelios/engine/runtime/pooling/_module.ixx

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

fileGameObjectPool.ixx

Object pool for efficient GameObject management and recycling. More...

fileGameObjectPoolConfig.ixx

Configuration data for GameObjectPool initialization. More...

fileGameObjectPoolManager.ixx

Manager for GameObject pooling and lifecycle management. More...

fileGameObjectPoolRegistry.ixx

Central registry for managing multiple GameObjectPool instances. More...

fileGameObjectPoolSnapshot.ixx

Read-only snapshot of GameObjectPool state. More...

Description

helios::engine::runtime::pooling

GameObject pooling for efficient object recycling.

Overview

This module provides infrastructure for memory-efficient entity management through object pooling. Pools pre-allocate GameObjects that can be acquired and released during gameplay, avoiding repeated allocation overhead.

Key Classes

ClassPurpose
GameObjectPoolContainer holding pre-allocated GameObject identifiers with O(1) acquire/release
GameObjectPoolConfigConfiguration data for pool initialization (ID, prefab, size)
GameObjectPoolManagerHigh-level manager for pool lifecycle and acquire/release operations
GameObjectPoolRegistryCentral registry mapping pool IDs to pool instances
GameObjectPoolSnapshotRead-only snapshot of pool state (active/inactive counts)

Architecture

The pooling system follows a layered architecture:

1. GameObjectPool: Low-level handle-based tracking (active/inactive lists) 2. GameObjectPoolRegistry: Pool lookup by typed ID 3. GameObjectPoolManager: Integration with GameWorld for prefab cloning and entity lookup 4. GameObjectPoolConfig: Declarative pool configuration

Spawn/despawn request handling has been moved to helios::engine::runtime::spawn.

Usage

 // 1 Create a prefab template
 auto bulletPrefab = GameObjectFactory::gameObject()
  .withMotion([](auto& m) { m.move2D().speed(10.0f); })
  .withRendering([&](auto& r) { r.renderable().shape(circleShape); })
  .make(false); // inactive initially
 
 // 2 Configure and create pool
 GameObjectPoolConfig config{
  .poolId = GameObjectPoolId{1},
  .prefab = bulletPrefab.get(),
  .initialSize = 50
 };
 
 auto poolManager = std::make_unique<GameObjectPoolManager>(&gameWorld);
 poolManager->createPool(config);
 
 // 3 Acquire/Release via SpawnManager (preferred)
 // Or directly via poolManager for low-level access
 auto* bullet = poolManager->acquire(GameObjectPoolId{1});
 bullet->setActive(true);
 
 // Later: release back to pool
 poolManager->release(GameObjectPoolId{1}, bullet->guid());


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.