Is the wait function frame independent?

Hello! I have a simple question: Is the “Wait for X seconds” function already frame independent, or will i have to multiply X by TimeDelta?

1 Like

I’d like to know too!

If i remember correctly it is

Your response would be more useful if you could provide sources.
Can you please provide sources?

The wait function is frame independent for the time, but the actions after the wait will still trigger only when the next frame hits.

So waiting0.000001 seconds is no different than 0.016 seconds in a 60fps game since the actions still won’t happen until the next frame.

Note that if the entire game is running below mininum fps it will slow down, this includes timers. Time Deltas, and waits.

Sources are arthuro, the person who made waits. How to animate a loop so it doesn't freeze - #6 by arthuro555

2 Likes

Like i wrote above
IF I REMEMBER CORRECTLY

Where i can be wrong
MAYBE i confuse it with tweens being able to play while time scale is 0?

BUT

I set my project to 20 FPS
Seems it is still 1 sec

1 Like

Waits are just like timers:

  • They are framerate independent
  • They are affected by the timescale
  • They are not precise - they trigger when the time they measure has been exceeded, but will never trigger exactly when that moment arises, only at the next time the timer will get checked by the game loop. You cannot create a real-time clock using them to count seconds or something alike, as they will inevitably go out of sync as it will always trigger a tiny bit later than the exact time it measures.
2 Likes

You can use the search at the top of this page.

https://docs.gdevelop.io/GDJS%20Runtime%20Documentation/modules/gdjs.html

Even if you don’t understand Javascript, the code is commented. I find it useful from time to time.

1 Like