-
-
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
[3.6.beta1] Physics frame rate below idle frame rate on selected iOS devices #76645
Comments
One reason could be that v-sync does not work on iOS or said device so your frame rate is not really capped and process runs more often. Never assume a working frame rate cap for your game logic. On highend hardware with not-so-demanding scenes
I can not comment more on maybe iOS specific issues but that ungodly mix of frame depending With this input logic you will have situations where your entire game input logic breaks depending on how well your game runs on the device or if whatever frame rate cap you are using is working or even enabled by the user. If your game can not run without bugs with uncapped frame rate that is what you need to fix. Especially on desktop users regularly disable e.g. v-sync in external hardware drivers so always assume that your game runs without issues without any frame rate cap. In general your axiom is not correct as even if v-sync or any other "software cap" is working there is never a guarantee that your physics tickrate and your frame rate will stay perfectly in sync or one below the other. Instead, it should be an axiom in this day and age that frame rate depending game and especially input logic is not allowed to exist ... but what can I say ... even triple-AAA studios fail at this quite regularly in glorious fashion. |
Assuming you are correct, it does not explain why the same code works flawlessly on previous versions of Godot on the said devices. |
Just to be clear, what is the exact code in Are you setting jump to true, then another frame happening before physics process, and jump being set to jump_trigger (false)? Pattern should be (if you want to do input in process) e.g.:
not
(There are also some input bugs currently that are being worked on, especially on Android but these could possibly be affecting iOS too. See #76400 ) |
Regardless the fact that I have reported a design bug pointed out by @smix8 :-), the problem is that The exact code in
and the |
PS: The puzzling bit here is that this occurs (repeatedly) on specific iOS devices only and not on others. I can't say whether it is Godot or Apple iOS version related, but it is clearly a difference in timing (or indeed a difference in threading) issue. We don't see a difference on Windows or on Android, but that may be misleading. |
Yes, whatever else bugs there are, don't reset your input in It's very possible that you will get e.g. double frames before a physics tick (this is largely down to the platform, and not our code, and you need to program with this in mind). |
Google also suggests iPad Pro 3rd gen seems to have 120hz refresh rate. This means it is even more likely there will be 2 frames rendered before a physics frame, and hit the logic bug in the script. This may be part of the reason for the problem occurring more in more up to date hardware (which is more likely to refresh faster). There is also likely some interaction with the input bug (which may occur more with buffered input on mobile, causing maybe a stall and two rendered frames before a tick), but I don't think these are necessarily the direct cause of the issue, more that they expose the error in the script logic. If @oeleo1 can confirm that fixing the logic in the script fixes the bug, we should probably close this issue. Even when input is fixed, it would not be the correct fix for (or close) the user script logic bug in this issue. There are already existing issues open for the input bug. |
Indeed, the proper logic to process the input in |
Godot version
3.6.beta1
System information
iOS 14, GLES2
Issue description
Spawning a new issue from #76425 which arguably deals with a different problem.
Hi,
We have a similar obscurity with 3.6beta1 on recent iOS devices only. The abnormal behavior doesn't happen on Android, Windows or when using 3.5.2. Only on recent iOS hardware.
What we see is that our player character is being triggered to jump, but it jumps 1/3rd of the time. The touch logic is in a touch controller which arms a
jump_trigger
and the player logic basically sets a variablejump
in_process()
to true based on the trigger, then_physics_process()
reads that variable to alter the velocity. It's a classic:What we see on the high-end iOS devices is that the
jump
variable is read as false in_physics_process()
despite being set to true in_process()
. This is very odd and happens sporadically.It basically shows that either:
_process()
is executed more often than_physics_process()
In the 1. case, the axiom of having at most 1 idle frame per physics frame is broken (we are at the default 60fps without bumping refresh rates). This means that
_process()
is executed more often than_physics_process()
. Could this ever happen? In any case, this works as intended in 3.5.2 on those devices, so it is really 3.6beta1 specific. Or is someone triggering internally a_process()
call in 3.6beta1 under circumstances?In the 2. case, all bets are off.
Unfortunately, we couldn't reproduce this with a stripped down version of an MRP so 2. is also a possibility.
PS: Some more debugging reveals that 1. is the cause of the problem: The logs show:
In our case,
jump
is being written twice, at first to true then to false, without_physics_process()
noticing the change.So it boils down to why
_process()
is being executed more often than_physics_process()
or, in other words, how come the physics frame rate is being slowed down below the idle frame rate.PPS: This occurs on an iPad Pro 3rd gen, iPhone 12 (i.e. fast devices) but does not occur on iPad Pro 1st gen.
Steps to reproduce
It's a tough call. We haven't been able to strip down a minimal version of the above exhibiting the problem on those iOS devices. It is unclear what the cause it in order to reproduce the issue, so for now we just log the problem.
Minimal reproduction project
See steps to reproduce.
The text was updated successfully, but these errors were encountered: