Scene transitions may not start in correct state when fixedUpdateFps is set
https://github.com/excaliburjs/Excalibur/assets/8703090/8557ea64-fabd-4805-8158-f3d2bee210a4
It seems that the first frame of a scene transition may be incorrect when fixedUpdateFps is set to a rate lower than the screen refresh rate. To exaggerate the effect, I've set the fixedUpdateFps to 5 in the video, but it's occasionally noticeable when set to 60fps on a 120hz screen.
It occasionally does something similar on the final frame as well, where it'll flicker back to the beginning of the transition.
Steps to Reproduce
- Set
fixedUpdateFpsto something lower than the screen's refresh rate - Start a game with an inTransition
https://jsfiddle.net/mattjennings/mkL637pz/2/
Expected Result
Should not see a flicker on first frame of transition
Actual Result
It flickers on the first frame
Environment
- browsers and versions: Chrome 122.0.6261.129
- operating system: macOS
- Excalibur versions: 0.29.1
Ack! Good find, fixed update strikes again!
I've done a little poking around, I think there are multiple things going on.
During the fixed update
- The camera is not updating the position transform after scene init so it causes a flicker at that point
- Transitions start a frame late sometimes due to the async/await code, they don't get added to the scene at the right time.
- On the initial transition gets setup as a deferred transition and there is also a timing issue when the game starts
- I think there might be a few more quirks related to the update/draw as well that I haven't yet figured out
All of these seem fixable with some light refactoring, really things that need to happen simultaneously should not be separate await's but a single atomic call because we are at the mercy of browser scheduling (my theory).
This issue hasn't had any recent activity lately and is being marked as stale automatically.