feather-rs / feather

A Minecraft server implementation in Rust
Apache License 2.0
2.58k stars 143 forks source link

Separate world for events #392

Open Defman opened 3 years ago

Defman commented 3 years ago

Feature Request

Description

A separate world for events.

What problem does this solve? What need does it fill?

Right now spawning an event only causes the system registered after the emitting system to run in the same tick and systems registered before in the next tick.

Describe the solution you'd like

A separate world that will allow us to run all systems(listeners) for every event on the same tick.

caelunshun commented 3 years ago

By a "separate world," do you mean a separate system executor for event handlers or a second ECS for event components?

In the case of the former, events can still go unhandled on the current tick if event handlers recursively trigger events. But delays will happen less frequently, so it's still beneficial. I think introducing a concept of "stages" to the system executor would have a similar effect: stage GAME that runs game logic and stage HANDLERS that runs event handlers.