-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Resolve ambiguous system order bugs in default systems #1466
Comments
This script could be handy to get shorter, prettier system names as part of the process: https://github.com/jakobhellermann/pretty-type-name/blob/main/src/lib.rs |
In order to solve this we'll want very basic explicit ambiguities, in order to reduce the noise produced by the ambiguity checker. Pairwise ambiguities will be required as part of any solution, and are the most general tool, so I recommend we implement those. This should be pretty simple, hook into the system descriptor code, add another field for a vec of I'm generally not sure I love having these be defined on a per-system basis (which one do you put it on?), but it's consistent with the |
Ideally, this should be done after #1423.
I think we want that even if we have resolved the issue. The fact that pre-#1144 Bevy worked at all means that we probably don't have an unbreakable cycle of systems relying on each other's changes being detected via this mechanism, so we should still be able to form a valid graph. |
I took a look at how many stages we really need, and I think a single update stage might be enough. The only engine system that uses commands inside the main game loop is the hierarchy maintanence system, and there are only three exclusive systems that can't be replaced with |
With the current stages, the question of where user systems should go relative to engine systems is solved and straightforward: user systems go in UPDATE by default, which means they get sandwiched between engine systems in prior stages (PRE_UPDATE, etc.) and later stages (POST_UPDATE, etc.). If we go "stageless" (have only one engine stage as you suggest), we will need to come up with some new solution to this problem. We need a mechanism to ensure that user systems are (by default) added in a way that makes sense, relative to all the engine systems. |
There are major performance benefits to doing things with fewer stages, but yes, we'll need a way to create sane defaults for adding systems. |
#1469 should help. |
Automatic labeling plus thoughts about archetype invariants (from @aevyrie and @TheRawMeatball) should go a long way here. The engine could specify that everything with component A gets a particular label, which ensures that it runs in a sensible order relative to the default systems. Not feasible for 0.5 though since it relies on the many-to-many labels. |
As a stop gap for this, I think we should have three main stages for 0.5. All of the stuff that user systems should usually run before should live in |
This is a power concept, but it would also make order extremely hard to reason about as a user.
Yeah I think this is a solid goal. Its worth attempting that and changing course if / when we hit a wall. |
Agreed. I'd be pretty firmly against adding this until we have some form of schedule visualization. |
Important use case to test for:
This should not just break with "no system with that label is found". And ideally it shouldn't force the user to reconstruct the plugins from scratch to work around this. The latter suggestion is also terrible, because you actually may not even be able to manually reproduce what a plugin is doing, since not all of its members will be We can avoid this by making the plugin-external labels that each plugin depends on publicly visible and configurable (i.e. As a follow-up to that idea: we should extend |
Or we don't hard crash on missing labels and simply report that, while algorithms continue to evaluate the graph as if that dependency didn't exist. Maybe also a way to remove references to a particular label, as an escape hatch for silencing those errors. Related, when removing systems from the schedule, the label of that system should be cleanly removed from everywhere; naturally, removal method should come with a matching replace/"override" that doesn't touch the labels. We don't have any way to remove systems yet, but I don't think there are any obstacles to that. |
Done as part of #1576. |
Partially resolved by #1606. Current solution for ambiguity checker noisiness is "let it scream" - something more satisfying will require better tools, most likely some form of mass ambiguity set assignment. |
I think the "bugs" have been resolved at this point. Whether or not we resolve the "non-bug ambiguities" is an open question, but not something I think we need to block 0.5 on. Thoughts? Edit: im calling this out because this issue is in the 0.5 milestone |
This is correct IMO; this can be closed and we can make a new issue for broader interop questions as it comes up. |
Implicit dependencies were replaced with explicit ones in #1144. While this is a great choice, it's resulted in numerous flaky behaviors in the engine due to ambiguous system ordering.
So, I think we can probably get away with 6 (PreUpdate, Update and PostUpdate + the startup stage equivalent) core stages total for 0.5 honestly.
You only need more stages when you need to process chains of systems that rely on command processing to work, and I would be surprised if we have very long chains of that anywhere yet.
So, as an overall strategy:
0. Label all of the systems.
The text was updated successfully, but these errors were encountered: