Jump to content
  • Advertisement

Archived

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

Neen10do

controling frame rate

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

hey guys, i found out how to display the frame rate (on my comptuer its about 142) but i want to be able to control it, because i know it wont run the same on all machines. any ideas would be great. i know how to do it in vb, but c++ is a litte different. thanks i code therefore i am.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Try looking at the links on this page: www.google.com/custom?hl=en&lr=&ie=UTF-8&cof=L:http://www.gamedev.net/pics/gdlogo2.gif%3BLH:60%3BLW:270%3BGL:2%3BBGC:00000%3BT:FFFFFF%3BLC:FFFF96%3BVLC:FFFF96%3BALC:9999FF%3BGALT:9999FF%3BAH:center%3B&domains=GameDev.net&sitesearch=GameDev.net&q=frame+rate+independent&spell=1

You shouldn''t have to control the framerate, but let the events in the game operate independent of framerate.

Share this post


Link to post
Share on other sites
how would i have controls (movement, input etc) independent from the number of times it is displayed on the screen? like skipping or something. what im trying to do is get the game to run basically the same on all systems. is there any special control i have to do to get this?

i code therefore i am.

Share this post


Link to post
Share on other sites
ya, you take the difference of the time before rendering and the time after rendering, something like this:
stime=gettime
drawscene
etime=gettime
delta=etime-stime

then you simply use the delta value in moving your objects like this:
ball.x+=delta/ball.dx;

check out my timer class on my site. it makes this a little bit easier.

My Homepage

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!