Sign in to follow this  

Frame Timing

This topic is 4854 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Yes I did search the forum and no I don't want some copy paste solution. It would be great though if some one could jsut very clearly and concicely detail the concept for Frame Timing. I understand I need to store the time then run a while loop to waste time based on the stored info but theres some stuff about frequency and the windows function being very inefficent. So could some 1 just explain what exacly the info is needed for and how its compared in the while loop to waste time. And how this won't slow up a slower computer. Srry if I sound like a nub i'm really not just having trouble w\ this, found several conflicting examples that have confused me.

Share this post


Link to post
Share on other sites
Um I mean since right now everything is frame dependent, I want movement and pretty much everything to be frame rate independent, well my solution rather then timing everything else was just to limit the frames to 30fps. So I would but a time wasting loop before my render function. My question is how to get the info for this loop. I need 2 store the original system time when the timer starts then I gues every time this loop runs i need 2 query the time again and save the last query.

So if the delta of last query and the new query is less then 333.33 miliseconds then just run the loop again, so it should limit a computer to only get to the render loop 30 times every second. But the time query function has got to slow down slower computers.

But what was this bout the frequency?

Share this post


Link to post
Share on other sites
not so complex...
You just have to know the number of mili-sec that have passed since the last frame.
For you animation its now simple :
Imagine you have an object, and it move along the x axis 1000 unit per seconde.
We calculate our Elapsed value (The number of mili-sec that have passed since the last frame). If this value is 1000, then you have a frame rate of 1 :P. 1 seconde have passed since the last frame.
So you object is moving depending the value of the Elapsed :
Object.x += 1000 * Elapsed;
After 1sec it should move about 1000 unit ;)
For all your animation, you have to use this Elapsed value.
If the player have a frame rate of 10 and another guy of 100, the object will move at the same speed for the two PC ;)
Good luck

Share this post


Link to post
Share on other sites

This topic is 4854 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this