-
-
Notifications
You must be signed in to change notification settings - Fork 91
Home
Arch is a C# based Archetype Entity Component System (ECS).
Each Archetype stores its entities within 16 KB-sized chunks perfectly fitting into L1 Caches for maximum iteration performance.
This technique has two main advantages, first of all, it provides a great entity allocation speed and second, it lowers the cache misses to the best possible minimum.
It's incredibly fast, especially for well-architectured component structures.
Supports .NetStandard 2.1, .Net Core 6 and 7.
Since .NetStandard is supported, you may also use it with Unity.
Arch is bare minimum, easy to use and efficient. Let's say you want to create some game entities and make them move based on their velocity... sounds complicated? It's not! Arch does everything for you, you only need to define the entities and the logic.
// Components (ignore the formatting, this saves space)
public struct Position { public float X, Y; }
public struct Velocity { public float Dx, Dy; }
public class Game
{
public static void Main(string[] args)
{
// Create world and entities with position and velocity.
var world = World.Create();
for (var index = 0; index < 1000; index++)
world.Create(new Position{ X = 0, Y = 0}, new Velocity{ Dx = 1, Dy = 1});
// Query and modify entities ( There are also alternatives without lambdas ;) )
var query = new QueryDescription().WithAll<Position,Velocity>(); // Targets entities with Position AND Velocity.
world.Query(in query, (ref Position pos, ref Velocity vel) => {
pos.X += vel.Dx;
pos.Y += vel.Dy;
});
}
}
Just start with the quickstart guide to get a first insight into the API, from there you can freely decide where to move next :)
- https://github.com/genaray/Arch/wiki/Quickstart
- https://github.com/genaray/Arch/wiki/Performance-Features
- https://github.com/genaray/Arch/wiki/Utility-Features
- https://github.com/genaray/Arch/wiki/Query-techniques
There's still a lot to come! https://github.com/users/genaray/projects/1
- Templates
- Entity events
- Systems ...