Eventu: Inconsistent Timing with waitSeconds

Description: Archive discussion
============================
Original description:
Official subforum for LunaLua - an extension framework for SMBX Engine Version 1.3 (which a core of SMBX 2.0). Share your creations that require the use of LunaLUA. You may also share info/tutorials on how to use LunaLUA.

Sambo M
Topic author, Count
Count
Avatar
Sambo M
Topic author, Count
Count
Age: 26
Reputation: 15
Posts: 264
Joined: 27 Jun 2014

Post #1by Sambo » 25 Mar 2016, 6:54

The timing with the waitSeconds function isn't consistent. I moved multiple layers, at the same speed, for the same amount of time, and they weren't aligned afterward. Also, I tried waitSeconds(1) and waitFrames(65) at the same time, and they weren't aligned afterward. These wait times should be equivalent.

waitFrames is accurate.
Image
Current Project:
Image

Yoshi021 M
Moderator
Moderator
Avatar
Yoshi021 M
Moderator
Moderator
Age: 23
Reputation: 170
Posts: 693
Joined: 15 Feb 2016
Location: Yoshi's Island

Post #2by Yoshi021 » 9 May 2016, 4:59

The reason is because the game does not run at exactly 65 fps. Its actually. Its actually a decimal (65.XX). So waitFrame ends up being more precise.
Links
ImageImageImage
Image
Image
"Going to University is FUN!" :pardon:

Hoeloe F
Nice citizen
Nice citizen
Hoeloe F
Nice citizen
Nice citizen
Reputation: 5
Posts: 16
Joined: 3 Nov 2014

Post #3by Hoeloe » 26 Jun 2016, 22:39

Also, waitSeconds IS accurate, but in terms of the number of physical seconds taken. The waitSeconds function takes into account the time between frames, which means it will always take the same physical time regardless of any lag. For this reason, waitSeconds is not suitable for moving layers.


Return to “LunaLua - Extension Framework”

Who is online (over the past 5 minutes)

Users browsing this forum: 3 guests