Arch.System

Arch.System, a basis for nesting logic in systems.

With Arch.System you can organize your queries in Systems and call and reuse them at will.

Example

public class MovementSystem : BaseSystem<World, float>
{
    private QueryDescription _desc = new QueryDescription().WithAll<Position, Velocity>();
    public MovementSystem(World world) : base(world) {}
    
    // Can be called once per frame
    public override void Update(in float deltaTime)
    {
        // Run query, can also run multiple queries inside the update method
        World.Query(in _desc, (ref Position pos, ref Velocity vel) => {
            pos.X += vel.X;
            pos.Y += vel.Y;
        });  
    }
}

The example above is of course kept simple. You can simply put anything you want to group into such a System, e.g. a System for everything that moves your creatures... another System that contains everything that causes your creatures to suffer damage and heals them etc. There is no limit to your imagination!

Now we already have a MovementSystem, a System that groups everything that makes our Entities move. But how do we integrate this now?

A Group<T> can also contain other Group<T>. BeforeUpdate, Update and AfterUpdate should be called at will to update the systems and queries.

And we have already divided our Systems into Group<T>s to bring order into it. What more could you want?

Last updated

Was this helpful?