-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Add systems to sets based on their world accesses #7857
Comments
I'm in favor of this, but we need to be careful not to explode our schedule graph. These sets should be built on an as-needed basis, rather than opportunistically. |
I agree. These sets should only be added if the creator of the component or resources chooses to expose a public |
Via something like Or via like... flags on the derive macro or a trait somehow, in which case it would really only be up to the owner of the component type? |
I was suggesting the latter, but I could see value in allowing outside configuration. |
I think I like the former better: it's annoying as a plugin author to try and predict and respond to all of the needs of your users. I also think that in this case it will be much simpler to implement :) |
From my initial experiments, I think that the opposite is true. The derive macro approach can just build on top of Making it externally configurable means creating a whole API based around access sets (need a better name for this concept), which |
I stand corrected -- it's actually way simpler to do it dynamically after all. Here's what I've got so far: main...JoJoJet:bevy:access-system-sets |
If these sets are automatically populated, they need same or nearly the same usage restrictions as Saying I also expect some users to mistakenly think this accounts for Note that this implementation would need to change to use relations if/when we add them and move to systems being entities (no promises, but trying to do both for 0.11). |
Meaning, no configuration can be done on it? It's only used for ordering other things? Seems reasonable.
Yeah, this is a powerful feature so we'll have to warn about common pitfalls and encourage users to be careful with how this is used. |
|
What problem does this solve or what need does it fill?
Currently, it is difficult to order systems based only on their logical constraints. In cases where you want a system to run after (or before) other systems which access a resource or component, you need to have global knowledge of the schedule and which systems might access that data.
One example of this is for events: if you have a system that reads
AppExit
events, it must run after the system that sends those events -- otherwise the event will be missed forever. Ordering the systems correctly requires knowing which system sends the event and adding a dependency to it, which is difficult to discover. See #7067, which is motivated by this issue.What solution would you like?
Make it possible to automatically assign systems to a set based on their world accesses. An event reader system with proper ordering could look like:
When combined with #7838, transform propagation could be as simple as:
There should be a way of manually opting out of access sets:
What alternative(s) have you considered?
Do nothing, and continue using global reasoning to order systems.
Additional context
A variant of this feature that is restricted to events was originally suggested in #4872.
The text was updated successfully, but these errors were encountered: