Add a stagger()
option to systems to spread iterations over multiple world
ticks.
#1490
LouChiSoft
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
The biggest challenge with staggering updates is that it's difficult to guarantee that each entity is updated the same number of times, if you also want to allow for adding and removing components dynamically. It would be possible to do this application side though, either by manually maintaining a list of entities, or using some trick like doing a % on the entity id. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Apologies if this has been brought up anywhere else, I had a search and didn't seem to find anything that matched.
This idea came from wanting to make a horde shooter style of game. You could have 100s maybe even low 1000s of enemies all needing to do navigation calculations. You obviously don't want to be recalculating their navigation every frame, so the first thing you will probably do is put it on a timer to only run maybe once a second, this solves having to calculate all the navigations paths every frame, but still leaves you with a computation spike every second when that system gets triggered.
My proposal would be to add a
Stagger()
option to theworld.system()
call which takes the query conditions and splits it up over several frames to more evenly spread out the computational work load. Some example numbers: 600 enemies, each updating their navigation once a second, in a locked 60 FPS game could be reduced down to 10 enemies per tick. If you have a lot of systems that can benefit from this I could see it being a much smoother experience.There are some caveats I can think of that I am not immediately sure what would be the best way to handle. e.g:
Would love to hear some feedback
Beta Was this translation helpful? Give feedback.
All reactions