🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Standardizing program speed

Started by
1 comment, last by RobTheBloke 18 years, 2 months ago
If my title is confusing, I'll try to explain it. Basically, I have a p3 in my laptop and an atholon in my PC. I'm writing a program on my laptop, but when i try it on my PC, it goes about 3x faster. How abouts would I make some type of delay that would adjust to the computer? if you want to take a look at the program, you are more than welcome to; it's located at this link: http://www.atosoftpp.digitalblackie.com/uploads/Hard%20Nova%20remake.rar Feel free to poke around on it. Ozwald~
Advertisement
The easiest thing to do is to base the movement speed of everything on the so called delta time.

Delta time is the time it took to render the last frame and it should be good enough for most things.

If you are using nehes basecode then the deltatime should be fed directly to the update function, it's in miliseconds so you have to divide it by 1000 to get a better value to work with.
then just multiply every movement with this value like this.
x=x+(xmovement*deltatime);

there are other ways to do this, i have four diferent methods implemented in my engine and i bet that there are sill more than that.
Frame rate independence


This topic is closed to new replies.

Advertisement