[SDL] Limiting game speed
Matthijs Hollemans
matthijs at allyoursoftware.com
Mon Nov 4 05:23:01 PST 2002
> When I write SDL games, I like to limit the frame rate to around
60fps.
I don't know what platform you are targetting, but my laptop's video
card (Nvidia) seems to have a fixed framerate of 52 point something
fps in 640x480x32 fullscreen mode using page flipping. (Even though
the settings indicate the refresh rate is set to 60 Hz.) If your
game uses a fixed rate of 60 fps (i.e. you expect each frame to take
up no more than 16ms), systems such as mine may not be able to keep
up (because frames can't go faster than 20ms). I don't know if the
refresh rate I am getting is typical for laptops.
If you are writing a 2D game aimed at the general public (not
hardcore gamers), 60fps may be too fast for typical consumer
hardware (PII 300, lame video card). On the other hand, if you're
writing a 3D game, a better approach is not to fix the frame rate,
but use whatever framerate you can get. Movement is now based on
elapsed time -- how long the last frame took is how much the objects
have moved. Slower machines may have to disable certain features to
still get decent performance.
--
Matthijs Hollemans
All Your Software
www.allyoursoftware.com
More information about the SDL
mailing list