EasyEcs documentation
Start here. What EasyEcs is, how to install it, a first system in a dozen lines, and the order to read the guide in.
EasyEcs is an open-source, allocation-free archetype Entity Component System (ECS) for C# and .NET 10 servers.
You write plain data and [ForEach] methods. A source generator turns them into inlined struct jobs, an analyzer
catches design mistakes at compile time, and a full server tick of 100,000 entities takes
1.72 ms and allocates 0 B.
New to the pattern itself? Read What is an ECS? first.
Save 10,000 entities and load them back, vs DefaultEcs
30×faster- EasyEcs146 μs
- DefaultEcs4.33 ms
Head-to-head benchmarks it is faster in
24/ 37One server tick
1.72msAllocated per tick
0BBenchmarkDotNet 0.15.2, .NET 10.0.13, Intel Xeon Processor 2.10GHz, 4 cores, Ubuntu 24.04.5 LTS.
Install
dotnet add package EasyEcsThe package targets net10.0 and brings the source generator, the analyzer and its code fixes with it. There is
nothing to register.
A first system
using EasyEcs;
using var world = new World();
world.AddSystem<MovementSystem>();
world.CreateEntity(new Position(0, 0), new Velocity(1, 0));
world.Update(); // Position is now (1, 0)
public record struct Position(float X, float Y) : IComponent;
public record struct Velocity(float X, float Y) : IComponent;
public class MovementSystem : EcsSystem
{
[ForEach]
static void Move(ref Position p, in Velocity v) => p = new(p.X + v.X, p.Y + v.Y);
}ref marks what the system writes and in what it only reads. The generator reads those two words to build the
loop, to decide which systems may run in parallel, and to tell change tracking
which rows were written.
Where to start
What is an ECS?
Entities, components and systems, archetype and sparse-set storage, and when an ECS fits.
Features
Every feature on one page: what it does, when to use it, what it costs.
Getting started
Build a small simulation step by step, from the world to the update loop.
Example: a battle server
Every feature in one world: the code of the battle server benchmark.
Reading order
Guide
The guide has one page per concept, in the order you need them.
Structuring a real project
Where components, systems, the host loop and the tests go, as dotnet new easyecs lays them out.
Entities and components
Handles, ids, tags and the generated members.
Queries and filters
Query, Count, Any, QueryFilter, struct jobs and entity.Run on one entity.
Systems
[ForEach] methods, ordering, groups, cadence and errors.
Change tracking
Visit only the rows written or removed since a system last ran.
Threading
One owner thread per world, parallel systems and parallel [ForEach].
Common mistakes
What goes wrong first, and the rule or analyzer error that catches it.
The rest of the guide covers singletons, structural changes, ref and await, dynamic buffers, indexes and
relations, hierarchies, groups, cleanup and disable, prefabs, bulk changes, snapshots, saves,
migration and unloading, hosting, testing,
debugging and diagnostics, troubleshooting, and every
analyzer rule.
Compare
Performance
Which API to use when, do's and don'ts, the benchmarks and how to measure.
Comparison
EasyEcs against Friflo.Engine.ECS, Arch and DefaultEcs, feature by feature and measured.
Coming from another ECS? See EasyEcs against Arch, Friflo, DefaultEcs and Unity Entities, and the migration pages for Arch, Friflo and DefaultEcs.
Reference
API reference
Every public type and member, generated from the source.
API and complexity
Every public API with its complexity.
Architecture
Storage, entity lifecycle, the query cache, systems, generators and threads.
FAQ
Production use, allocations, threads, Unity, saves, hot reload, Native AOT.
AI assistants
llms.txt, Markdown copies and a rules file for your project.
Changelog
What changed in each release.
Why it is built this way: the design decisions; what comes next: the roadmap. Upgrading from an earlier version? The migration guide covers every step from v2 to v3, v3 to v4 and between the 4.x releases.
Last updated on
How is this guide?