Constant framerate
Hey there, i want to know if there are calculations which make my code runs @ the same framerate on each machine...
Use a function like GetTickCount() to get the current time (in 1/1000 of a second). Your code would look something like this:
do LastFrame=GetTickCount RenderWorld while (GetTickCount-LastFrame)<(1000/TargetFPS) do nothinguntil Quit
May 06, 2002 08:06 AM
I usually don''t care how fast it updates the screen.
I just let it draw as fast as it can and then update the world (physics, movement, etc) 20-30 times a second.
If it misses any of the 20-30 times, it has to do the skipped updates too (either for(;missed updates
update(); or update(delta_time)
.
This way people that have a slower computer(<20fps) also get to play at almost the same speed.
I just let it draw as fast as it can and then update the world (physics, movement, etc) 20-30 times a second.
If it misses any of the 20-30 times, it has to do the skipped updates too (either for(;missed updates


This way people that have a slower computer(<20fps) also get to play at almost the same speed.
I do, but you said you wanted the same framerate on all machines, you didn''t say you wanted the game speed (how fast the characters move)with a variable frame rate.
If you''re looking for that I would suggest you read here (Gamedev article: Framerate Independent Movement)
If you''re looking for that I would suggest you read here (Gamedev article: Framerate Independent Movement)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement