Skip to content

ECSOptions Class

Definition

Namespace: Brine2D.ECS

Configuration for the hybrid ECS: entity capacity, parallelism, and fixed-timestep tuning.

C#
public class ECSOptions

Inheritance System.Object → ECSOptions

Properties
EnableMultiThreading When true, systems execute in parallel across worker threads.
FixedTimeStepMs Fixed timestep in milliseconds for IFixedUpdateSystem and FixedUpdate\(GameTime\). Default \(~16\.667ms\) gives 60 steps/s.
InitialEntityCapacity Pre-allocated entity slot count. Avoids resizing during gameplay.
MaxFixedStepsPerFrame Maximum fixed steps per frame. Caps the catch-up loop after long frames \(debugger pauses, heavy loads\) so the game doesn't freeze. Excess time is discarded.
ParallelEntityThreshold Entity count below which parallel processing falls back to sequential. Lower = more aggressive parallelism \(good for CPU\-heavy logic\); higher = less thread overhead \(good for lightweight components\).
WorkerThreadCount Worker thread count for parallel execution. null \(default\) uses System.Environment.ProcessorCount. Only applies when EnableMultiThreading is true.
Methods
GetParallelOptions() Returns a cached System.Threading.Tasks.ParallelOptions instance derived from WorkerThreadCount. The cached instance is automatically invalidated when WorkerThreadCount changes.