RustyDO icon indicating copy to clipboard operation
RustyDO copied to clipboard

Implement an efficient ECS

Open jidoc01 opened this issue 1 year ago • 2 comments

Currently, our ECS is poorly implemented: no parallelism, no systems (handlers), and no cache efficiency. That is because what I wanted was just to imitate a data-oriented structure on a large scale (e.g. an entity with multiple components being added or removed).

Instead of inventing the wheel, we can make use of the existing ECS libraries in rust:

  • legion: https://github.com/amethyst/legion
  • specs: https://github.com/amethyst/specs
  • bevy: https://bevyengine.org/.

Especially, bevy is actively in development, and a popular rust-written Minecraft server uses it (https://github.com/valence-rs/valence). It would be a decent choice to apply bevy to our project.

jidoc01 avatar Jul 10 '23 17:07 jidoc01

I have recently found a new ecs library, evenio (https://github.com/rj00a/evenio). This library seems to be introduced by one of the maintainers of valence-rs.

One of the key ideas in evenio is that it is based on an event mechanism that provides event-handling even for each entity, whereas bevy does not. And the other benefits of using bevy, such as parallelism with rayon and efficient querying system, are still supported in the library. The library is relatively immature compared to bevy but I like the ideas of it.

jidoc01 avatar Mar 08 '24 14:03 jidoc01

Our ECS engine is currently built on evenio, and we may refer to the rewriting process of valence-rs: https://github.com/valence-rs/valence/issues/596

jidoc01 avatar Jun 03 '24 12:06 jidoc01