Eventu: Inconsistent Timing with waitSeconds

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.
Moderator: Moderators

Sambo M
Topic author, Count
Count
Avatar
Sambo M
Topic author, Count
Count
Age: 20
Reputation: 13
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: 17
Reputation: 79
Posts: 637
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
Citizen
Citizen
Hoeloe
Citizen
Citizen
Reputation: 0
Posts: 8
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: 1 guest