Archived

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

Timing...

This topic is 5398 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! 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

Share this post


Link to post
Share on other sites
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;

Share this post


Link to post
Share on other sites