Archived

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

Mike01

Same Speed on All PCs?

Recommended Posts

Hmm, I read the whole thing and couldn''t find it.

What I really need is a way to slow down my program. It runs too fast on my computer...

Thanks

Share this post


Link to post
Share on other sites
what you need is to limit the frame rate.
If you have you fps calculated, you can just add a delay of some sort to reduce the fps.

another way is to create a timer in the WM_CREATE section,
and on any timer ''click'' (WM_TIMER) render your scene.
set the timer to give you ~25 ticks a second.

...dont forget to kill the timer on WM_DESTROY.

you can get good documentation on this in the MSDN.

good luck

Share this post


Link to post
Share on other sites
Say you want to move something from point A to point B over exactly 1 second, and you want it to move at the same speed at 600fps as 40fps.

At the end of each frame, record how long (in seconds) that frame took in a variable (frametime for this posts sake). Now when moving your object each frame, multiply the distance it should move in 1 second by your frametime variable.

It works very well for me, as it should for you. If your game is running @ 100fps then each frame takes 10ms, and if you want to move 2000 units, you''ll multiply 2000 by 0.01 (10ms / 1000ms/sec). Each frame will move the object 0.02 units, and doing it 100 times will have your object at its intended destination.

Hope thats explained well enough

Share this post


Link to post
Share on other sites
quote:

what you need is to limit the frame rate.
If you have you fps calculated, you can just add a delay of some sort to reduce the fps.


why would you want to do this? frame-based modeling will make everything run at a constant speed no matter what kind of system the user has. This will let everything be more fluid. here some psuedo code:
start_timer=timeGetTime()
run_engine()
end_timer=timeGetTime()
delta=end_time-start_time;

move_object(0.1*delta)

HHSDrum@yahoo.com

Share this post


Link to post
Share on other sites