You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Code Sample
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)publicstructPosition{publicfloatX,Y;}publicstructVelocity{publicfloatDx,Dy;}publicclassGame{publicstaticvoidMain(string[]args){// Create world and entities with position and velocity.varworld=World.Create();for(varindex=0;index<1000;index++)world.Create(newPosition{X=0,Y=0},newVelocity{Dx=1,Dy=1});// Query and modify entities ( There are also alternatives without lambdas ;) ) varquery=newQueryDescription().WithAll<Position,Velocity>();// Targets entities with Position AND Velocity.world.Query(inquery,(refPositionpos,refVelocityvel)=>{pos.X+=vel.Dx;pos.Y+=vel.Dy;});}}
What's next?
Just start with the quickstart guide to get a first insight into the API, from there you can freely decide where to move next :)