Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experiment with reaction convergence #3

Open
viridia opened this issue Jan 31, 2024 · 0 comments
Open

Experiment with reaction convergence #3

viridia opened this issue Jan 31, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@viridia
Copy link
Owner

viridia commented Jan 31, 2024

Sometimes reactions trigger other reactions, especially in the case of derived signals. However, since we're using Bevy change detection, this will cause a 1-frame delay: when a reaction causes a mutation, we won't see the change until the next frame.

We can avoid this by putting the reactive logic in a separate schedule and running that schedule in a loop. This will need to check for convergence, however: the number of changes should decrease to zero in just a few iterations. We can count how many dependencies change each iteration, and insure that that number generally decreases - it may increase sometimes, but not too often.

Quill had a similar algorithm that used atomic ints, but it should be possible to get this to work with Bevy changes.

@viridia viridia added the enhancement New feature or request label Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant