-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Add default system sets based on World
accesses
#5388
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
Conversation
EventReader
or EventWriter
EventReader
and EventWriter
Super interesting. Why limit this to events only? Why not define this for all data accesses, which would then encapsulate events? For example, I'd like to to ensure that my character controller system always runs after anything that modifies |
This pattern could also be useful for I definitely agree with that direction, but I wanted feedback from a few members before doing the implementation work. Also, doing that would exacerbate the following concern from #4872:
|
Also, I think that if we make auto-labels ubiquitous, we'll have to consider letting users explicitly opt out of specific auto-labels for their systems. |
Agreed, I think this is essential even here. Probably a anti-label method? |
Bikeshed: I think I prefer |
Even better IMO: make the type name the verb, and the method name the preposition. |
I wonder if we want to invert the logic. Rather than proactively generating labels for each resource used, instead special-case this and generate the dependencies directly to the responsible systems. The former is O(systems * resource_types). The latter is O(systems * resource_types_used), avoiding the scheduler overhead where this feature isn't used. And where it is used, the alternative is manually creating and using these labels, which won't be any faster. With that in place, I'd be more comfortable expanding this out to a bundle and/or component specific version. Likely in another PR for complexity management though. |
Can we avoid all of this complexity by just storing the labels in a |
My first impression is that I'd be fine with that. The weak benchmarks here definitely make me nervous though. We could also store two HashSets, one for "labels" and the other for "labels this system definitely doesn't have", and then check reactively.
IMO eventually we should have a dynamic schedule modification feature flag that's off by default, and just remove all labels after |
It appears that labels already use a Using the fancy new benchmarks at #5410, I added 50 distinct, unused labels to every single system.
10% regression isn't bad, considering that's 10*20*50=10,000 unused labels. We can also see that the performance impact becomes negligible as you add more and more systems. I would say that adding labels doesn't hurt performance, adding dependencies does. |
Thoughts on expanding this to components
|
Yeah, I'm wondering if we can configure the opt-in and opt-out behavior via metadata on the Component / Resource / Event traits. And yes, another point in favor of trying to make commands more transparent. The other thought is that this PR will become dramatically more useful once cross-stage ordering dependencies work. We may want to fix that before merging this. |
EventReader
and EventWriter
World
accesses
This would close #7857, correct? |
If we decide to go with the macro-based approach, then yes :) |
Closing this out, since I don't think the derive macro-based approach is the right way to handle this. |
Objective
Resolve #7857.
Give users more tools to order systems based on logical constraints. Allow automatically grouping systems with specific world accesses or system params into sets, which can be used to specify dependencies.
Solution
Any component, resource, or event can optionally be associated with a
SystemSet
, which will be assigned to any system that accesses that world data.Example: TODO
Changelog
todo
Migration Guide
todo