Skip to main content
GameDev.net gamedev.net
🔒 Locked

Question About Framerate

Started by LamerGamer May 9, 2005 at 11:18 PM 1 replies 1.2k views
Original Post
LamerGamer
LamerGamer
What are taken into consideration when determining framerate? I figure processor speed and type, memory, and video card speed and memory. I'm using Allegro for Dev-C++; I like to use the rest() function to control the framerate. If I were to consider my game being played on various computers, what factors should I consider when controlling framerate?
xegoth
xegoth
I'm not sure why you want to limit frames but if you're having issues with your game running too fast... Enabling vsync is usually the best way to go about keeping frames reasonable. Vsync limits the frame rate to your monitor refresh rate. That's the simplest solution (if that does what you want). I think allegro has a vsync() function.

If you have a specific number you want to limit your FPS to (say 25 ) that's not too difficult but I don't have time to answer since I need to go to sleep and wake up in a few hours. :)
chad_420
chad_420
There is a far better way to go about this. Instead of limiting frame rate, you scale all your movements by a certain number. Ussually you use the time between frames as that number(in sec's so you get a nice small number to scale by). So for example you may have

(pseudo code)
thing.moveX(5); // move 5 pixels down the X axis

and you'd get varying speeds on dif pc's.

whereas if you have this:

float velocity = 5.0f;
float time_delta = time_between_frames;
thing.moveX(velocity * time_delta);

then it will always move same distance in a given amout of time.
There are alot of ways to get the time passed between frames and thats largely dependant on what libraries you are using. If you still are having trouble I'd be glad to provide some examples (just so happens I use dev-cpp, and love allegro :D)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.