jidoc01 / RustyDO

A server emulator for Digimon Online v1.5.
GNU Affero General Public License v3.0
52 stars 12 forks source link

Implement an efficient ECS #10

Open jidoc01 opened 1 year ago

jidoc01 commented 1 year ago

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:

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 commented 4 months ago

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 commented 1 month ago

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