Giter VIP home page Giter VIP logo

arch.extended's Introduction

Arch.Extended

Maintenance Nuget License C#

Extensions for Arch with some useful features like Systems, Source Generator and Utils.

  • ๐Ÿ› ๏ธ Productive > Adds some useful tools and features to the main repository!
  • โ˜•๏ธ SIMPLE > Works easily, reliably and understandably!
  • ๐Ÿ’ช MAINTAINED > It's actively being worked on, maintained, and supported!
  • ๐Ÿšข SUPPORT > Supports .NetStandard 2.1, .Net Core 6 and 7 and therefore you may use it with Unity or Godot!

Download the packages and get started today!

dotnet add package Arch.System --version 1.0.2
dotnet add package Arch.System.SourceGenerator --version 1.1.1
dotnet add package Arch.EventBus --version 1.0.2
dotnet add package Arch.LowLevel --version 1.0.9
dotnet add package Arch.Relationships --version 1.0.0
dotnet add package Arch.Persistence --version 1.0.3
dotnet add package Arch.AOT.SourceGenerator --version 1.0.0

Features & Tools

  • โš™๏ธ Systems > By means of systems, it is now easy to organize, reuse and arrange queries.
  • โœ๏ธ Source Generator > Declarative syntax using attributes and source generator, let your queries write themselves!
  • โœ‰๏ธ EventBus > A source generated EventBus, send Events with high-performance!
  • ๐Ÿ‘พ LowLevel > Low-level utils and data structures to get rid of GC pressure!
  • ๐Ÿ’‘ Relationships > Adds simple relationships between entities to arch!
  • ๐Ÿ’พ Persistence > JSON and Binary (de)serialization to persist your Worlds!
  • โŒ› AOT Source Generator > Helps with AOT compatibility and reduces boilerplate code!

Check the links and the Wiki!

Full code sample

With this package you are able to write and group queries and systems for Arch automatically. And all this with the best possible performance.

The tools can be used independently of each other.

// Components ( ignore the formatting, this saves space )
public struct Position{ float X, Y };
public struct Velocity{ float Dx, Dy };

// BaseSystem provides several usefull methods for interacting and structuring systems
public class MovementSystem : BaseSystem<World, float>
{
    public MovementSystem(World world) : base(world) {}
    
    // Generates a query and calls that one automatically on BaseSystem.Update
    [Query]
    public void Move([Data] in float time, ref Position pos, ref Velocity vel)
    {
        pos.X += time * vel.X;
        pos.Y += time * vel.Y;
    }
    
    // Generates and filters a query and calls that one automatically on BaseSystem.Update in order
    [Query]
    [All<Player, Mob>, Any<Idle, Moving>, None<Alive>]  // Attributes also accept non generics :) 
    public void ResetVelocity(ref Velocity vel)
    {
        vel = new Velocity{ X = 0, Y = 0 };
    }
}

public class Game 
{
    public static void Main(string[] args) 
    {     
        var deltaTime = 0.05f; // This is mostly given by engines, frameworks
        
        // Create a world and a group of systems which will be controlled 
        var world = World.Create();
        var _systems = new Group<float>(
            new MovementSystem(world),   // Run in order
            new MyOtherSystem(...),
            ...
        );
      
        _systems.Initialize();                  // Inits all registered systems
        _systems.BeforeUpdate(in deltaTime);    // Calls .BeforeUpdate on all systems ( can be overriden )
        _systems.Update(in deltaTime);          // Calls .Update on all systems ( can be overriden )
        _systems.AfterUpdate(in deltaTime);     // Calls .AfterUpdate on all System ( can be overriden )
        _systems.Dispose();                     // Calls .Dispose on all systems ( can be overriden )
    }
}
```**

arch.extended's People

Contributors

difficulty-in-naming avatar drsmugleaf avatar genaray avatar hertzole avatar iainmckay avatar martindevans avatar reeseschultz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.