-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Observer ordering/scheduling #14890
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
Comments
I have two ideas on what the API side can look like:
|
This is needed in #12365 as well. |
We definitely want this, just figuring out the architecture and API here is tricky. I'd really like to not be blocked on systems-as-entities and a relationship-powered schedule graph, so a decent temporary solution would be nice here. |
I experimented with this idea a little today and there's definitely some non-trivial design constraints we need to consider. Initially I thought the most obvious answer would be to store observers in a
Unfortunately, I don't have any affirmative ideas on how we should pursue this feature, just the above findings on a way we probably shouldn't do it. It's a shame events need to propagate (it's non negotiable, too important for UI), because the other two concerns might be counteracted by the new-found ability to run observers in parallel, rather than one-by-one in a single-threaded for-loop (as they currently are). Might be worth changing how |
Amdahl's Law is gonna bite you there :) Observers almost always do tiny bits of work: it's unlikely that parallelizing them is worth the overhead. |
The fact that Some unclear parts:
|
Just want to mention my situation relating to this. I'm trying to use observers as a way to represent passive abilities on cards. Each card can have a number of abilities and the user might want the abilities to run in a specific order for synergy or math reasons (of course it would only matter if they have the same triggers) . So i can imagine a list of these, with arrows to be able to move them up or down in that list which would control the order of the abilities. When i first looked into the ObservedBy component, i assumed that changing the Vec inside it would be the way to do it. But I didnt even try it cus i was told early on in the discord that it wasnt going to work. So I think maybe thats another thing to consider if ur thinking about the API for this. I personally would not benefit too much from the before/after API, but thats with respect to my specific situation. I can see that API being useful in other situations so an API that allows for both would be cool. I dont think it matters that it happens specifically in ObservedBy , but that was the first place i looked so maybe its not a bad idea to put it there. |
I have a win-condition observer that I would like to run after several other observers. Would like to have these observers in a systemset-like set so I can run the win-condition after the set. Would be nice. |
What problem does this solve or what need does it fill?
Sometimes an observer can rely on things added by other observers. But it is currently not possible to explicitly order the observers.
What solution would you like?
I would like the ability to mark an observer as having to run after or before another one.
The text was updated successfully, but these errors were encountered: