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.

Code Snippets / FPS independant object animation

Author
Message
Millenium7
21
Years of Service
User Offline
Joined: 13th Dec 2004
Location:
Posted: 27th Sep 2005 18:43
While doing a few searches found people asking/complaining about object animations being too slow/fast on computers depending on the framerate. Didn't find any solution already posted and I figured out the fix a while ago should have posted it back then but anyway here it is



That should do it, your object animations should be played at the same speed per second rather than per loop. It does however take a little while to take effect (about 0.1-0.4 seconds). But you won't notice it unless your getting fps fluctuation of +/-30 per seconds in which case its not the animation you should be trying to fix

Here's a little tester program using the above code just press keys 1-6 and 0 to try different framerates



Note: This works for both DBP and DB
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 29th Sep 2005 02:39
if the animation speeds up on other computers, so will everything else in the game. You should lock the sync rate anyway.


Deadly Night Assassins
Millenium7
21
Years of Service
User Offline
Joined: 13th Dec 2004
Location:
Posted: 29th Sep 2005 07:01 Edited at: 29th Sep 2005 07:03
Err not sure what you mean there, I think your talking about everything in the game going slow or fast depending on the framerate, thats why you use time based movements rather than each loop based movements which is quite easy to do. (bottom line, if doing 2fps or 500fps everything goes at the same speed regardless)

Capping the sync rate is hopeless not everyone has a computer fast enough to reach the fps limit anyway. I've seen a few games in db/dbpro that use timer based control so everything moves at the same speed but the animation doesn't so please use this it really does make things look a lot better

Login to post a reply

Server time is: 2026-06-12 03:36:24
Your offset time is: 2026-06-12 03:36:24