Giter Club home page Giter Club logo

mach-ecs's Introduction

mach/ecs, an Entity Component System for Zig Hexops logo

mach/ecs is an Entity Component System for Zig built from first-principles.

Experimental

This is an experimental Mach library, according to our stability guarantees:

Experimental libraries may have their APIs change without much notice, and you may have to look at recent changes in order to update your code.

Why this library is not declared stable yet

Design principles:

  • Initially a 100% clean-room implementation, working from first-principles. Later informed by research into how other ECS work, with advice from e.g. Bevy and Flecs authors at different points (thank you!)
  • Solve the problems ECS solves, in a way that is natural to Zig and leverages Zig comptime.
  • Fast. Optimal for CPU caches, multi-threaded, leverage comptime as much as is reasonable.
  • Simple. Small API footprint, should be natural and fun - not like you're writing boilerplate.
  • Enable other libraries to provide tracing, editors, visualizers, profilers, etc.

⚠️ in-development ⚠️

Under heavy development, not ready for use!

As development continues, we're publishing a blog series "Let's build an Entity Component System from scatch".

Join us in developing it, give us advice, etc. on Discord or follow updates on Twitter.

Known issues

There are plenty of known issues, and things that just aren't implemented yet. And certainly many unknown issues, too.

  • Missing multi-threading!
  • Currently only handles entity management, no world management or scheduling. No global data, etc.
  • Lack of API documentation (see "example" test)
  • Missing hooks that would enable visualizing memory usage, # of entities, components, etc. and otherwise enable integration of editors/visualizers/profilers/etc.
  • We have dense and sparse data, but no shared data yet.
  • If many entities are deleted, iteration becomes slower due to needing to skip over entities in the free_slots set, we should add a .compact() method that allows for remediating this.
  • If tons of entities are deleted, even with .compact(), memory would not be free'd / returned to the OS by the underlying components arrays. We could add a .compactAndFree() method to correct this.
  • It would be nicer if there were configuration options for performing .compactAndFree() automatically, e.g. if the number of free entity slots is particularly high or something.
  • Currently we do not expose an API for pre-allocating entities (i.e. allocating capacity up front) but that's very important for perf and memory usage in the real world.
  • When entity is deleted, maybe via systems / an event/callback, need a way to be notified of destruction. Same with updated maybe.

See also the numerous TODOs in main.zig.

mach-ecs's People

Contributors

slimsag avatar alichraghi avatar byteron avatar avokadoen avatar cykrr avatar luexa avatar rofrol avatar thezealousfool avatar iacore avatar

Watchers

 avatar

Forkers

gizlang

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.