Start
Last updated
Last updated
friflo ECS is an archetype based ECS - Entity Component System. The design goals of this library are performance and simplicity.
A common ECS provide the basic features listed bellow. To solve other common use-cases not covered by basic implementations this ECS provide the listed extensions.
An ECS acts like an in-memory database and stores entities in an EntityStore aka World. An Entity is a value type - aka
struct
- with a uniqueId
.
Data is stored in Components added to entities. Components are stored highly packed in continuous memory.
The major strength of an archetype based ECS is efficient and performant Query execution. Query filters are used to reduce the amount of components returned by the query result.
Support Events to subscribe entity changes like adding or removing components. Event handlers can be added to a single
Entity
or the entireEntityStore
.
Index / Search to enable lookup entities with specific component values. v3.0.0 A lookup for a specific component value - aka search - executes in O(1) ~ 4 ns. Possibly the first and only ECS that supports indexing.
Relationships to create links between entities. v3.0.0 A link is directed and bidirectional. Deleting source or target entity removes a link.
Relations to add multiple "components" to an entity. v3.0.0 Relations are not implemented as components to avoid archetype fragmentation.
Systems are optional. They are used to group queries or custom operations. They support logging / monitoring of execution times and memory allocations in realtime.
Hierarchy / Scene tree used to setup a child/parent relationship between entities. An entity in the hierarchy provide direct access to its children and parent.
JSON Serialization to serialize entities or the entire EntityStore as JSON.
100% verifiably safe 🔒 C#. No unsafe code or native bindings. This prevents segmentation faults or access violations crashing a process instantaneously.
Minimal heap allocations. After internal buffers grown large enough no heap allocation will occur. At this point no garbage collection will be executed. This avoids frame stuttering / lagging caused by GC runs. Especially no allocation when
Creating or deleting entities
Adding or removing components / tags
Adding or removing relations or relationships
Emitting events
Changes in entity hierarchy
Query or system execution
Release Notes - document all nuget releases.
Library describes assembly specific characteristics.
Unity Extension with ECS integration in Unity Editor.
GitHub: https://github.com/friflo/Friflo.Engine.ECS
Discord: friflo ECS
Benchmark: C# ECS Benchmarks
💖 In case you like this project? Leave a ⭐ on GitHub ⋅ friflo/Friflo.Engine.ECS