Skip to content
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

iOS input delay on exports from 3.2.3 #42164

Closed
mtk4000 opened this issue Sep 18, 2020 · 24 comments · Fixed by #42454
Closed

iOS input delay on exports from 3.2.3 #42164

mtk4000 opened this issue Sep 18, 2020 · 24 comments · Fixed by #42454

Comments

@mtk4000
Copy link

mtk4000 commented Sep 18, 2020

Godot version:

3.2.3.stable.official

OS/device including version:

Issue is present on two devices I've tested:

  • iPhone X, iOS 14.0
  • iPad 6th generation, iPadOS 13.6.1

Issue description:

There is a noticeable delay (~250ms) between the time the screen is tapped and the time _input(event) fires.

Steps to reproduce:

  1. Download Multitouch View Demo from Asset Library
  2. Export to iOS using 3.2.3.stable export template
  3. Install and run on iOS device
@Calinou
Copy link
Member

Calinou commented Sep 18, 2020

See also #41452. Can you reproduce this on Godot 3.2.2?

@mtk4000
Copy link
Author

mtk4000 commented Sep 18, 2020

No; I just exported the same Multitouch View Demo project using 3.2.2 and it ran perfectly on both devices. I'll try 3.2.3-rc4 to see if it's related to #41452.

Edit: Delay occurs in 3.2.3-rc4 as well.

@naithar
Copy link
Contributor

naithar commented Sep 27, 2020

The delay is 150ms same as iOS's delay for some native views.
It will also fire immediately on touch movement or touch being released.

Related code is in: https://github.com/godotengine/godot/blob/3.2/platform/iphone/gl_view_gesture_recognizer.m

The issue linked above (#41452) also has the discussion on why it's working this way now and why the problem from that issue occurred.

The delay could probably be lowered a little, but this would require testing with project from initial issue.

@mtk4000
Copy link
Author

mtk4000 commented Sep 27, 2020

Thanks for your response. I'm not sure I understand though. Is there really no way to detect an iOS tap before 150ms have passed? It seems like this would break the responsiveness of a lot of games. It's very noticeable. Is there any workaround to get iOS input faster?

@naithar
Copy link
Contributor

naithar commented Sep 27, 2020

As I previously said, if you release the touch before 150ms delay, touch events would fire immediately, so 150ms delay basically has no effect on input.
And tap, which is essentially a press and fast release, should be working correctly as before.
Also in PR and issue that was fixed with it I've mentioned why this fix was introduced. Basically on newest phones iOS fires moved events even if no movement happened.

I haven't found any issue with my iOS project with this implementation. With 3.2.2 I had to make a workarounds so game would correctly handle taps.
And the problem from #41452 was happening only because iOS queues input events instead of firing them when they happen, like Android does.

@mtk4000
Copy link
Author

mtk4000 commented Sep 27, 2020

Sorry, maybe "tap" was the wrong word. I have a project where you press and hold to move. There's no gesture or release to trigger further input, so I relied on the initial event. Worked great in 3.2.2, but now with the delay I need to find a workaround.

@naithar
Copy link
Contributor

naithar commented Sep 27, 2020

It's more like press and hold then. :)
Moving delay value into project settings should probably give more control over the input for cases like yours, but If you would need to have both "tap" and "hold" it could be an issue.
You can probably try changing kGLGestureDelayInterval value to see if it helps

@naithar
Copy link
Contributor

naithar commented Sep 27, 2020

@mtk4000 I've made some modifications in this branch - https://github.com/naithar/godot/tree/feature/ios-delay-in-settings. You'll have to build both iOS library and Engine Editor.
You can change default delay in ProjectSettings at Input Devices -> Pointing. Changing delay to 0.005 seems to be fixing your case.

@mtk4000
Copy link
Author

mtk4000 commented Sep 28, 2020

Works great. Thank you very much for your help.

@naithar
Copy link
Contributor

naithar commented Sep 28, 2020

That's great. I'll try to make PR soon, so this would make into 3.2.4.

@Joseaay
Copy link

Joseaay commented Oct 5, 2020

Having the same issue here since I moved to 3.2.3, how can I solve that without needing to re-compile the engine?
Is there any way I can modify that delay parameter without needing to touch Godot's internals?

@naithar
Copy link
Contributor

naithar commented Oct 5, 2020

No, you can't, for now you have to rebuild the engine. You can wait for Godot 3.2.4 beta or RC1 and migrate to it once it's out.

@Joseaay
Copy link

Joseaay commented Oct 5, 2020

Will do, thanks!

@fadexmusic
Copy link

I get this problem as well, also don't have the experience to rebuild the engine. Any idea when the RC is gonna be released? I get an error when exporting to iOS from the 3.2.4 beta (AOT Compilation exited with code 134), but I need this issue fixed asap.

@naithar
Copy link
Contributor

naithar commented Oct 24, 2020

I get this problem as well, also don't have the experience to rebuild the engine. Any idea when the RC is gonna be released? I get an error when exporting to iOS from the 3.2.4 beta (AOT Compilation exited with code 134), but I need this issue fixed asap.

Are you using Mono build with C#?

@fadexmusic
Copy link

fadexmusic commented Oct 24, 2020

Yes @naithar, on MacOS.

@naithar
Copy link
Contributor

naithar commented Oct 24, 2020

Well, the fix for this issue is merged and should be in beta, but I can't help you with Mono build.
I think you should make another issue for your case or find the one already addressing it. As far as I know Godot Mono for iOS sometimes have issues, so making a correct bug report could help contributors find and fix the problem.

@akien-mga
Copy link
Member

akien-mga commented Oct 24, 2020

Any idea when the RC is gonna be released? I get an error when exporting to iOS from the 3.2.4 beta (AOT Compilation exited with code 134), but I need this issue fixed asap.

A RC can't be released right after a beta which apparently doesn't work ;)

Please open an issue about this AOT compilation failure.
Edit: Ah nevermind, you did already: #43065.

@yokaishogun
Copy link

I'm having this issue on 3.2.3-stable-release. I can't use v3.2.4 rc3 because I'm using a few plugins that may not be compatible with it. Game crashes if I use prebuilt versions of the plugins and some are not compiling for v3.2.4 rc3. I was trying to find the "ios-delay-in-settings" branch, but it's missing. Is there any way I can have access to it or at least the changes I need to make to add this feature? Thanks.

@naithar
Copy link
Contributor

naithar commented Feb 26, 2021

The PR that's linked to this issue #42457 has the changes you need.

@BimDav
Copy link
Contributor

BimDav commented Oct 28, 2022

The problem is still present in 3.5.1, at least for systems that use InputDefault, such as TouchScreenButton. If I understand the current solution correctly, for short taps it will fire the presses at the same time (just before) the releases. So for something using InputDefault, action_press() will be called just before action_release(), and then Input.is_action_pressed() will always return false for presses shorter than 0.15s, which is very long.

@elinfame
Copy link

Also confirming that this is still in issue in 3.5.3. Is there any path forward here or is this a hard platform limitation?

@elinfame
Copy link

elinfame commented Aug 26, 2024

Nevermind, I set the input_devices/pointing/ios/touch_delay project setting to 0, and all works well! Out of curiosity, why have this setting at all, or at least, why not set it to 0 by default? Even using NSTimer to delay it by 0 seconds causes it to not be dispatched immediately, but rather, schedule it for the next run of the event queue (which is still in practice fast enough for the user not to notice, but still). It's a strange default since (to noobs like me) it makes it seem like there's something wrong with Godot or the system making it feel laggy even in a simple scene, which is off putting.

@Calinou
Copy link
Member

Calinou commented Aug 26, 2024

Out of curiosity, why have this setting at all, or at least, why not set it to 0 by default

To my knowledge, the default touch delay is in place so that double-taps can be recognized. Setting it to 0 by default would prevent double-taps from registering.

Also, changing a default project setting's value would break compatibility with existing projects, so the change would have to be applied to newly created projects only by modifying the project.godot file written by the project manager.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants