Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a trial at integrating some kind of reactivity into the current ECS framework.
As discussed in #11 there are a couple of ways to implement this. For now I've chosen to go for the change tracking component idea. I.e. upon any mutating operation performed, the flag
changed
will be put totrue
. In combination with thein_components
function thatSystems
can define, upon callingupdate_reactive(ledger)
, all changed components will be found, and the systems which have them asin_components
will be updated in the same order as they were specified in theledger
.This will be done recursively so that any updates will flow through the systems pipeline (if I didn't make mistakes).
Couple further thoughts:
entity
buffer that tracks whichEntities
have actually been changed, which could then be used in the "reactive" system through@changed_entities
. I think this would be an elegant and flexible way to solve the Reactivity, while still being true to the ECS philosophy (system acting on components rather than single entities).Pinging @ffreyer for some more input on this. Let me know what you think!
Cheers