Implementing a new performant Entity Component System (ECS). (Please request the features you want)

Julia provides a good compile-time dispatch, however, when a run-time dispatch is required, Julia is not so fast. While Overseer provides a possible solution, it is about updating an entire system at a time, and while it may be performant for similar algorithms, getting all entities in, for example, a || b && c requires some union/intersection. In contrast, this library will focus on determining the behavior of individual entities with a complex combination of traits in a performant manner.

So, here’s how this ECS will work.
It will store traits as 64-bit integers (Higher than this and it will error out. 64 is a hard limit because of the number of bits in a 64-bits integer.) It will mask out the irrelevant bits in each lookup and then perform a perfect hash to look up the result from a lookup table. The result could be a wrapped function from FunctionWrappers, a boolean, a number for if/else (for a small number of choices), a function parameter, a callable object, a 3x3 matrix, etc…

Basic features such as looking up individual bits will be implemented. There are several tricks you can do with this technique such as joining traits from different entities using “OR” instruction and so on. Request your feature here as I am implementing it.
The implementation is here and is still incomplete.
Please make a feature request here so I can improve it.


What’s an ECS?


It’s a software architectural pattern called Entity Component System.


Progress coming now! This project should now be at least 20% complete.

Feel free to review my code.


Update: This package is finished.


I would like to play around with this a bit but I don’t understand how the package works. What takes the role of an entity, component and system here? I’m guessing @trait defines a component, @traitpool defines something like Overseers ledger, @make_traitpool defines a name for an entity, @settraits sets values for an entity and @lookup is related to systems? Or maybe @subpool? Adding more documentation and example that shows off a minimal setup would be very helpful.

A comparison between this and Overseer could also be quite useful. What are the things this does better? What’s worse? How does the syntax compare?

You’re missing an import + dependency on Random btw, and one of the macros seems to be doubly defined:

WARNING: Method definition @subpool(LineNumberNode, Module, Any, Any) in module Arceus at .../Arceus/src/trait_pool.jl:20 overwritten at .../Arceus/src/subpool.jl:80.

Fixed the random dependency. I will add more documentation later. Thank you for your nice feedback. This is my first package and I believe I would’ve done it much better if I had done it again.