-
Notifications
You must be signed in to change notification settings - Fork 8
Description
From the docs it says
Systems are added to the output of commitSystems in the order defineSystem is encountered.
It woul be nice if I instead could add something like a priority or order integer as an option upon creating the system. For example:
import polymorph
registerComponents defaultCompOpts:
type
Comp1 = object
Comp2 = object
makeSystem "mySystem3", [Comp1, Comp2], EcsSysOptions(order: 9999):
all:
echo "s3: Comp1: ", item.comp1
makeSystem "mySystem1", EcsSysOptions(order: -1):
all:
echo "s1: Comp1: ", item.comp1
makeSystem "mySystem2", [Comp1, Comp2], EcsSysOptions(order: 10):
all:
echo "s2: Comp1: ", item.comp1
makeEcs()
commitSystems("run") # <- would sort systems on their order/priority upon generating their bodies
run() # <- Would execute systems in order System1, System2, System3 even though they were defined in a different orderI can see some problems though with this approach such as "What to do when a system isn't given an explicit priority?". I do not have a good answer to that. I suppose systems should be primarily sorted by the priority, and if none is given simply when they were defined like how they are now, though I do not know what that would look like in implementation.
This feature would help me if I define systems in different files and don't want to have to create a template each time and make sure the templates are put in place in the correct order.
I was working on my own macro ECS system when I discovered polymorph and you guys have much better performance than what I had managed xP So congrats and thanks for the module! I will switch to using it for my game :)