What would be the best way to have a fixed timestep update in Phaser 3? I want to make the simulation reproducible (multiple runs of the same initial setup should give the same end result). Note that I’m not only speaking of physics. I also want AI decisions to be made on the same game state with every run.
I’m looking for method similar to update
but which would receive a fixed timestep. I imagine I could implement it myself, e.g.:
- on scene update, accumulate time delta
- partition accumulated time into fixed chunks, e.g. 100ms
- for every elapsed 100ms-chunk go through every object in update list and call
fixedUpdate
on it
Are there better ways in Phaser? Maybe there is something built-in already?
I came across this devlog which reads “v3 will likely ship with 2 game loop implementations: variable (…) and fixed”. But firstly, I found nothing related to fixed loop in Phaser source code (apart from physics engine). Secondly, that would involve also rendering at a fixed rate which is not really what I’m after.
Thanks