-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Camera2D frame delay #46697
Fix Camera2D frame delay #46697
Conversation
Fixes camera frame delay by always doing a scroll update except when smoothing is active.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! As discussed we'll have to do an in-depth review of the (internal) processing logic in this class as it seems to be a bit inconsistent, which can definitely lead to bugs that look like delays.
I don't think we need to add an option to preserve the old behavior. Let's fix it and see if anyone complains about the fix :)
Thanks! |
Yes, processing is enabled wrongly, so this is not a complete fix, it may break during process. |
@lawnjelly Let me get this right. We previously introduced the suggested workaround consisting in applying in the camera's Now with this fix, it sounds like keeping this workaround code would cause calling The above comments sound like there is no clean way out now with a guaranteed 1 call only to "force_update_scroll()", be it manual or internal. What is the suggested path going forward? Maybe it's better for me to forget about all this right away and trust The Engine... :-) |
Haha. I shouldn't worry too much. 😁 With the fixed camera, there should be no need to manually call With smoothing turned on, reduz believes there should be no need for the workaround. Actually we should probably test this in practice just in case, you know what they say about assumption... The only gotcha is that if you had a game where you did like the frame delay behaviour (for cosmetic reasons) it will no longer be present, and you'd have to put it in manually. There could have been an option to emulate the old behaviour but the others didn't think this necessary. |
Fixes camera frame delay by always doing a scroll update except when smoothing is active.
From discussion with reduz we identified the problem of the frame delay comes down to two things:
The solution was to check directly a flag for when smoothing is switched on.
Fixes #28492
Fixes #43800
Notes
_update_process_mode()
it sets the process mode as a one-off depending on whether you have it set toCAMERA2D_PROCESS_IDLE
or not. This could also be the root cause of the bug, because it is not switching this on and off according to whether smoothing is on or off, so causing the logic to fail.