Skip to content

EffectInstancePool ​

Inherits: RefCounted

Global pool manager for EffectInstance objects and Projectile instances Handles creation, pooling, and recycling of both EffectInstance and BaseProjectileInstance objects This is an autoload singleton - add to Project Settings > Autoload as "EffectInstancePool"

Variables ​

GameHost.SystemHubsystem_hub

Methods ​

EffectInstanceget_effect_instance( effect_def: Effect, originator: Variant = null, target: Variant = null )
voidreturn_effect_instance( instance: EffectInstance )
PhysicalProjectileInstanceget_physical_projectile()
NonPhysicalProjectileInstanceget_non_physical_projectile()
voidreturn_physical_projectile( projectile: PhysicalProjectileInstance )
voidreturn_non_physical_projectile( projectile: NonPhysicalProjectileInstance )

Constants ​

  • int MAX_POOL_SIZE = 500 # Maximum instances to keep in pool - ========== CONFIGURATION ==========
  • int INITIAL_POOL_SIZE = 50 - Pre-allocated instances
  • int MAX_PROJECTILE_POOL_SIZE = 400 - Maximum projectiles per VFX type
  • int PROJECTILE_POOL_CLEANUP_THRESHOLD = 500 - Clean up when total projectiles exceed this

Variable descriptions ​

GameHost.SystemHub system_hub ​

The hub of the game systems.

Method descriptions ​

EffectInstance get_effect_instance( effect_def: Effect, originator: Variant = null, target: Variant = null ) ​

Get an EffectInstance from the pool (or create new if pool empty)

void return_effect_instance( instance: EffectInstance ) ​

Return an EffectInstance to the pool for reuse

PhysicalProjectileInstance get_physical_projectile() ​

Get a physical projectile from the pool

NonPhysicalProjectileInstance get_non_physical_projectile() ​

Get a non-physical projectile from the pool

void return_physical_projectile( projectile: PhysicalProjectileInstance ) ​

Return a physical projectile to the pool

void return_non_physical_projectile( projectile: NonPhysicalProjectileInstance ) ​

Return a non-physical projectile to the pool