View Full Version : Fps management
22-04-2007, 06:32 PM
Hi everyone. Can someone please show me how to take control of the frame rate in my game written in Delphi 6 & DelphiX? The dxTimer interval is set to 0 and I achieve the following frame rates: Slower machine - 70 fps, Medium machine - 300 fps and very fast machine - over 450 fps. How can one hard code the fps so that it runs at 300 fps (the ideal rate) on all the machines mentioned?
Thanks for your help :-)
22-04-2007, 07:12 PM
Setting the interval to zero means your game will run at the maximum speed. This isn't always the best thing, however, because it will also mean that your game will run at different speeds on different machines (as you discovered yourself).
To counter this you could try a different setting, say for example 16, (~60fps) which will give similar speeds on different pc's.... most of the time anyway.
In case of 2d games, 60fps usually is more than enough.
However, if you want speed to be the same on all pc¬¥s no matter it¬¥s configuration, you really should get yourself familiar with delta time, or timebased movement. There are several threads about it here on PGD, including code samples. In short it means that your sprites don¬¥t move with a certain pixels per frame, but rather with a certain pixels per timeunit.
23-04-2007, 05:51 PM
This is a must topic for you:
If you still have some questions, feel free to ask :)
24-04-2007, 05:44 AM
Thanks Traveler & Wodzu. I value your input :-)
Powered by vBulletin® Version 4.1.10 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.