Jump to content
  • Advertisement


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


Speed Adjustment

This topic is 5977 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

Hi, i have a question. I''ve done my very simple 3d engine, but on different PCs with different 3dcards it will work faster ot slover. It depend on 3d card power, and CPU speed of cause. How i can adjust speed, so this engine (or game) will work with same speed. F.e. 3DObjects movement, Rendering speed, etc... I know, that i need timers etc. But i don''t understant a logic or algorythms. Can you help me with that? Just simple algorytm, how to run mail loop with same speed on different PC ? Thank you !

Share this post

Link to post
Share on other sites
All moving things in your engine should have velocity in terms of "units per second" (or millisecond, etc). Then each time you call your Update function (which updates the world state), you have to record current time, and have the last update time at hand. Then you substract current time from last update time, to get the time elapsed between updates. And this way you can calculate how much you should move your objects using their current velocity and elapsed time.

For example:

Object velocity: 0.3 units per millisecond.
Elapsed time: 20 milliseconds.
Units to move object: 20 * 0.3 = 6.

You''ll have to use high precision timer, of course..

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!