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

Input lag after switching between multiple game instances #92954

Closed
MichaelDawe opened this issue Jun 9, 2024 · 5 comments
Closed

Input lag after switching between multiple game instances #92954

MichaelDawe opened this issue Jun 9, 2024 · 5 comments

Comments

@MichaelDawe
Copy link

Tested versions

Reproducible in 4.3.beta1
Not reproducible in 4.3.dev6, 4.2.2.stable

System information

Godot v4.3.beta1 - Windows 10.0.22000 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3060 Ti (NVIDIA; 31.0.15.5222) - 11th Gen Intel(R) Core(TM) i5-11400 @ 2.60GHz (12 Threads)

Issue description

When running heavy code in a node's _process() function the input response is lagging well below FPS after switching between multiple local instances. This applies to all input methods, both those captured in custom code and built-in systems.

Expected behavior: Input should not lag significantly below FPS.

Notes:
Exporting the project and running the executables reduces the effect but it is still present.
This is not affected by the renderer used.
The issue may be affected by the power of the system its run on, change the loopmax variable in the script and experiment.
While this won't be an issue for most users, those who are developing and testing multiplayer games on local machines will be affected.

Steps to reproduce

Create a project with any form of input and feedback to the user, UI buttons will suffice.
Add heavy code to the _process() function, a loop will suffice.
Launch 2 instances (open a second editor instance and run the game from the launcher, just launching a second instance of the editor will suffice).
Hover over the buttons, then switch between windows and hover over them again, now there is significant lag.

Minimal reproduction project (MRP)

new-game-project.zip

@Avantir-Chaosfire
Copy link
Contributor

Do you know how long the code in your _process loop is taking? A measurement in milliseconds would be helpful.

@MichaelDawe
Copy link
Author

Do you know how long the code in your _process loop is taking? A measurement in milliseconds would be helpful.

Barely noticeable at 10ms, UI becomes basically unusable at 20ms.

Replace the while loop in the script with OS.delay_msec(15) and change the value.

This is a much better approach than my original while loop in any case, thanks for your comment!

@matheusmdx
Copy link
Contributor

matheusmdx commented Jun 10, 2024

This looks very similar to #92759 and #92307. Can you download the artifacts from pr #92742 and confirm if your issue is already solved?

image

@MichaelDawe
Copy link
Author

Yes, the issue doesn't occur in that version!

@matheusmdx
Copy link
Contributor

Great, in this case you can close the issue, the 4.3 beta 2 will come with this fix applied

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

No branches or pull requests

4 participants