-
Notifications
You must be signed in to change notification settings - Fork 42
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
Avoid triggering Added
and Changed
queries on all rollbacks?
#39
Comments
This one could be quite tricky, and maybe infeasible. This is a similar issue to using Here's one idea. We'd have to make a trait that adds a I think that could fix the But we'd also have to have a way to revert the latest change tick on a component ( which is not a part of local state ) when we restore an older snapshot. I don't know if Bevy has a publicly exposed way to mutate those component change ticks, though. |
I looked into this issue and wanted to understand exactly what was wrong with doing The problem is not with For instance, the There is a pr for adding remove functionality to |
Relevant bevy pr implementing change detection bypass: bevyengine/bevy#5635 |
Since the bevy PR is now merged, we should be able to use it now, right? |
If i remember correctly, we can't do the nicest fix, since reflect apply is imo still broken. But perhaps we might get a decent workaround with change detection bypass. This will probably all be irrelevant after the rewrite, though? |
When a rollback is triggered,
bevy_ggrs
restores a saved world snapshot. It updates components by first removing them, and then adding them again. This triggers all queries withAdded<Component>
orChanged<Component>
in it, regardless of whether the component was already there and whether it changed.bevy_ggrs/src/world_snapshot.rs
Line 177 in b730a0b
Sometimes systems have queries that react to other components being added or changed, triggering changes on every rollback. Sometimes, this just causes a small performance hit, other times, it leads to buggy behavior because setup code runs multiple times.
Describe the solution you'd like
Perhaps it's possible to only update the component if it's different?
Additional context
In regular game code, this is usually quite easy to fix or work around, but sometimes the affected code belongs to 3rd party crates, which are a lot harder to solve.
The text was updated successfully, but these errors were encountered: