Timing...

Started by
0 comments, last by jonassen 21 years, 1 month ago
Hey! I got a question about the timing and speed in games... If I just define the moving speed, without any time controlling(no delays or anything like that), the objects will move faster on a fast computer than on a slow one, right? So do you have any tips how to get the movements be the same att different computers... // Jonas Ericsson
// Jonas Ericsson
Advertisement
Two ways you can limit the frame rate so you know the maximum number of frames per sec like this

DWORD Timer = GetTickCount();
// Insert frame code

while(GetTickCount() - Timer < 33)
{}

This limits your program to 33 frames per second.
However for 3D Graphical games this is not often used (atleast not as far as I know). What you do is keep track of how much time the last frame took and then use this to work out how far the model/s should move such as:

Movement = MovementDistance * DeltaTime;

This topic is closed to new replies.

Advertisement