-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Event-dependent run criteria for systems #1272
Description
What problem does this solve or what need does it fill?
Some systems should only run when there are events to be processed.
This is a common pattern, but annoying
What solution would you like?
A simple run criteria helper function that checks whether an event queue of the specified type is empty.
Because run criteria apply to multiple systems at once, I don't think you can have it automatically inspect the parameters of the systems its modifying.
What alternative(s) have you considered?
Users can write their own run criteria by hand. This is tedious and error-prone.
Event-handling systems can return early if they have no work today. This combines internal logic with scheduling logic, and forces scheduling of a system when it's not needed, possibly blocking other systems' access to archetype-components or resources.
Additional context
This functionality relates to but is distinct from triggered systems, as discussed in #1273. Something morally similar might be helpful as part of a scheduler for a dedicated UI stage.