Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [BUG] Tweens don't play at a consistent rate

Author
Message
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 14th Mar 2017 17:01
I have created some large chains of tweens (15 chains, 56 tweens) and then spent a long time producing a sound effect that synched with the chains.
It plays beautifully, with each movement perfectly in sync with the sound effects until I tried it on a different machine. Then the tweens played at a different rate and it threw the sound effects way off!

I knocked up this test:


That should take the tween 5 seconds to execute. It actually always takes a different time to execute but it's only off by a few hundredths of a second. I can live with that.
However, if you uncomment the FOR...NEXT loop that simulates a heavy CPU load (and therefore slower framerate), what you would expect to see is a much jerkier tween but it should still take 5 seconds to run.
Unfortunately, it takes around 8.5 seconds to run.

That's a crude test but it accurately demonstrates the issue that I have.
I'd really appreciate a fix so that I don't have to throw away the lovely sound effect that I created.

AGK V2 user - Tier 1 (mostly)
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 14th Mar 2017 17:32
The problem isn't the Tween, but GetFrameTime(). Your load reduces the FPS to less than 5FPS...

GetFrameTime

Get the time in seconds spent processing and rendering the last frame. Only updated when Sync or Swap are called. This is limited to a max value of 0.2 seconds to prevent internal timer based code from interpolating large time gaps.

This works...

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 14th Mar 2017 18:00
Excellent!
Thanks Mr B, I'll pop it into my original code when I get home and see how it goes, hopefully it will still sync with my audio and I won't have to recreate it
AGK V2 user - Tier 1 (mostly)

Login to post a reply

Server time is: 2024-11-24 18:30:15
Your offset time is: 2024-11-24 18:30:15