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

Inconsistent delta time from _process() when game window is moved #91548

Open
nicom7 opened this issue May 4, 2024 · 3 comments
Open

Inconsistent delta time from _process() when game window is moved #91548

nicom7 opened this issue May 4, 2024 · 3 comments

Comments

@nicom7
Copy link

nicom7 commented May 4, 2024

Tested versions

  • Reproducible in: v4.2.2.stable.official [15073af], v4.2.1.stable.mono.official [b09f793], v3.5.3.stable.official [6c81413]

System information

Godot v4.2.2.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1070 (NVIDIA; 31.0.15.3623) - Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz (8 Threads)

Issue description

I noticed that the delta value passed in the _process() method in GDScript doesn't always correspond to a manually computed delta (calculated by subtracting current frame and previous frame get_ticks_usec() values). This is particularly noticeable when moving the game window or the mouse cursor while it is running.
Happens both when v-sync is enabled or disabled.

Steps to reproduce

  • Open the MRP and run the scene
  • Notice how the error value (the difference between manual delta and process delta) in the console often gets over 5 ms when moving the game window continuously

Minimal reproduction project (MRP)

bug_process_delta.zip

@huwpascoe
Copy link

There's always going to be accumulated drift with delta time, it's a floating point number that compensates for varying frame rate.

Window movement events are usually costly so it's not surprising to see additional drift there.

The mouse cursor however, that shouldn't be causing the same drift as a window movement. That's weird.

@nicom7
Copy link
Author

nicom7 commented May 4, 2024

Yes indeed it's more pronounced when moving the window than when moving the mouse cursor. So maybe that's not an issue if this is as expected.

@lawnjelly
Copy link
Member

This is expected, the internal delta isn't measured at the same point you are measuring time in your script. It is measured prior to _physics_process() and a bunch of processing.

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

5 participants