Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Synchronizing Frame Rates / Game Speed

This topic is 5921 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

Hi, I''m having problem to synchronize my game speed during the game. The situation was caused by the fact that the rendering time each frame may differs depending if my scene happened to have complex mesh or not, imagine that you are in a building, of course the buliding it''s quite complex so my frame rate is lower (let''s say 40 fps) then for example if I move to the outside street (which is nothing but an empty street) I''ll get 60 fps. How can I determined the the threshold value of my fps, for ex. I wan''t to get 40 fps even in a scene which I can get higher fps so I can assure that my game speed is always the same at all time. What kinda ideas to implement this synchronization ?? do u use delay ?? How do you guys doing it ?? How can I predict my fps so that I can calculate the amount of delay ?? Thx !!!

Share this post

Link to post
Share on other sites
Why not just implement movement based on your FPS speed? You can calculate how long each frame takes to draw, and move objects the appropriate speed.

You have a ball, you wish to move the ball 10 units in 1 second. If you are running at 20 Frames Per second, you would move the ball by 0.5 units every frame... (10/20=0.5) 0.5 * 20 = 10. Now, lets say it was only running at 10 FPS. You need to move the ball by 1 unit ever frame (10/10=1) 1*10 = 10!

Billy - BillyB@mrsnj.com
(Hey, I''''m no longer anonymous!)

Share this post

Link to post
Share on other sites

I can see what you are saying but that adds a divide for each object that is to be moved per frame eg this could be 10s/100s of divides per game loop

Is there an equivilent calculation which does not use a divide?

Thanks in advace

Lost.......Assumed Coding!

Share this post

Link to post
Share on other sites
yanuart, I think you need framerate independent movement.
There are lots of topics on this at the forums and links articles on it too. Check here, and search.

Basically, the formula is something like:
movmentval = desiredDistanceToMovePerSecond * secondsPerFrame

BadBazza - this formula uses times not divide. Although, I am not sure whether it is faster or not.


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!