You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
this adds an AwakePriority virtual property on Entity, that can be used to change the order that Awake is called, similar to how Depth affects update and render.
thanks to @cloudsbelow for suggesting the virtual property approach (chosen since it doesn't cost memory or performance per entity, while a component or field would)
while I don't believe in a feature necessarily having to supersede a different one, I'm just wondering...
what are your thoughts on the PostAwake event as implemented in #1055?
I'd also appreciate it if you'd review that PR as well - it's been left in the dark for quite a bit
I think having a whole set of 2^32 possible priorities won't be much more beneficial compared to doing two simple pre-awake and post-awake calls. I think that, in general, relying on people to assign numbers without any strict coordination will lead to many sporadic bugs when those priorities get changed: modder A uses the priority 0, modder B uses priority -1 to go before modder A, but then modder A needs to run before priority 0 because modder C has an entity that conflicts with modder A's entity, so modder A switches to priority -1 without ever knowing that modder B relies on modder A using priority 0; furthermore, modder A may set priority to -10 to ensure it always runs before modder C, breaking even more entities that may lie between priority -10 to -1.
And while having pre-awake, awake and post-awake wont really fix that issue, at least it prevents races between modders to assign an even lower and lower priority, and instead encourages modders to coordinate how their entities work and interact.
Finally, doing pre-awake and post-awake allows us to not need to worry about having to sort the toAwake list, only occupies two extra slots in the vtable of every entity subtype, and allows entities to have what would effectively be multiple priorities with the proposed implementation in this PR (doing stuff in pre and post awake).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1: review neededThis PR needs 2 approvals to be merged (bot-managed)
4 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
this adds an
AwakePriorityvirtual property onEntity, that can be used to change the order thatAwakeis called, similar to howDepthaffects update and render.testmod build: microlith57/CelesteTestMod#2 (check inside the workflow run)