Deepslate.Ecs is a Entity Component System (ECS) library implemented in C#. It is designed to be fast, flexible and easy to use.
warning: This library is still in development and is far from being ready for production.
-
Entity
struct with just 64 bits representing your entities -
IComponentData
interface for tagging components -
ISystemExecutor
interface for defining systems that run every tick -
Query
for iterating over entities with specific components- Generic
QueryBuilder
for strongly typed query configuration - Generic
Query
for explicit query requirements - Generic enumerator for generic query results
- Source generator for generating query configuration code
- Generic
-
Archetype
for storing entities and components- Managed and unmanaged component storage
-
ArchetypeBuilder
for strongly typed archetype configuration -
ArchetypeCommand
for limitary access to entities
-
World
for managing entities, components and systems-
WorldBuilder
for fluent world configuration
-
-
Scheduler
for running systems in parallel-
Stage
for grouping systems - Automatic parallelization of systems with no conflicting queries
- Execution of deferred command created by
EntityCommand
-
-
EntityCommand
for creating, destroying and modifying entities and components in tick -
GlobalCommand
for creating, destroying and modifying entities and components out of tick -
Resource
for global data - Reactive systems for handling events
With
prefix for methods that add or overwrite something, if the arguments of multiple calls are the same or partially the same.Add
prefix for methods that may add something multiple times, even if the arguments are the same.- Additional arguments for
build
methods of builders mean that the arguments are not optional and must be provided.
- .NET 8.0 SDK
- .NET Compiler Platform SDK (Roslyn)
Just open the solution and build it. You may need to execute the t4 templates manually.
Run the build script in the root directory of the repository.
./build.ps1
If you run this script in visual studio developer powershell, the "TextTransform.exe" will be used to execute the t4 templates. Otherwise, "dotnet-t4" will be installed as a local tool and do the job.
Here are some benchmarks comparing Deepslate.Ecs with traditional OOP implementations.
Create 256, 1024, 4096 entities with single component.
Modify single component of 256, 1024, 4096 entities.
Modify two components of 256, 1024, 4096 entities in parallel. Auto parallelization in Deepslate.Ecs and manual parallelization in OOP.