iacobson / ecspanse

Entity Component System (ECS) library for Elixir, offering a suite of features including: flexible queries with multiple filters, dynamic bidirectional relationships, versatile tagging capabilities, system event subscriptions, or asynchronous system execution.
https://hexdocs.pm/ecspanse
Apache License 2.0
63 stars 7 forks source link

Projections should be consistent #9

Closed iacobson closed 1 year ago

iacobson commented 1 year ago

For performance reasons, projections were implemented to run in parallel with the systems, on every frame. However, this offers no guarantee on the state of the components, as some systems may have run already, while others did not.

The solution is to move the projections update at the end of the frame after all systems are executed.

also, the on_change callback should receive both the new projection state, but also the previous.