Skip to content

Overview

Brine2D

Brine2D.ECS Namespace

Classes
Behavior Base class for behaviors — logic that operates on a single entity. Each entity gets its own behavior instance with constructor injection support.
Component Base class for all components - pure data containers. For logic, use Behavior or Systems.
ComponentPool<T> Stores all components of a specific type for a single scene-scoped EntityWorld. All access is game-thread-only via EntityWorld; no synchronization is required. Provides ArrayPool-based snapshots for zero-allocation iteration.
DeferredList<T> A list that defers add/remove operations until ProcessChanges() is called. Safe for queueing structural changes during iteration.
DeferredOperationQueue<T> Queue for deferring operations until safe to apply. Used internally by EntityWorld to batch structural changes.
ECSOptions Configuration for the hybrid ECS: entity capacity, parallelism, and fixed-timestep tuning.
Entity Base class for entities in the ECS. Supports hybrid approach: can be used as a component container (data-oriented) or as a behavior host (object-oriented) by overriding lifecycle methods.
EntityPrefab A reusable entity template that can be instantiated multiple times. Think of it like a "class" for entities.
EntityWorld Default implementation of IEntityWorld. Uses a deferred operations pattern. Structural changes (create/destroy) are queued during frame execution and applied at frame boundaries. Targets 1,000-10,000+ entities with a straightforward mental model.
PrefabLibrary Manages a collection of entity prefabs. Registered as a singleton service.
ServiceProviderActivator Default IActivator backed by Microsoft.Extensions.DependencyInjection.ActivatorUtilities. Registered as scoped so each scene scope resolves from the correct DI scope.
SystemBase Base class for systems with common functionality. Provides default implementation of IsEnabled property.
Interfaces
IActivator Abstracts DI-backed instance creation so EntityWorld does not need to hold a direct reference to System.IServiceProvider.
IComponentPool Interface for component pools (type-erased for storage in dictionary).
IEntityWorld Interface for the entity world that manages all entities and systems.
IRenderSystem Interface for systems that process entities during the render phase. Render systems run before behaviors during EntityWorld.Render().
ISystem Interface for systems that process entities in the ECS. Systems run before behaviors during EntityWorld.Update().
IUpdateSystem Interface for systems that process entities during the update phase. Systems run before behaviors during EntityWorld.Update().