Jump to content
  • Advertisement
Sign in to follow this  
BennettSteele

C++ (openGL + openAL) game loop DT

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

So i am using C++, openGL and openAL, and have a main loop, like:


while(!done)
{
int oldTime=APP.Timer;
APP.Timer=timeGetTime()-APP.StartTime;
float DT=APP.Timer-oldTime;
std::stringstream Loler;Loler<<DT/100;

GameLogic(DT/100);
}





and i need it to run as fast as it would on any computer, like taking that delay of frames to calculate how to increment all the values.

Share this post


Link to post
Share on other sites
Advertisement

So i am using C++, openGL and openAL, and have a main loop, like:


while(!done)
{
int oldTime=APP.Timer;
APP.Timer=timeGetTime()-APP.StartTime;
float DT=APP.Timer-oldTime;
std::stringstream Loler;Loler<<DT/100;

GameLogic(DT/100);
}





and i need it to run as fast as it would on any computer, like taking that delay of frames to calculate how to increment all the values.


Hmm, have you looked at this article: http://gafferongames...-your-timestep/ it talks about having a fixed timestep for physics with visual interpolation based on DT, but I've also used a variant of tha loop to do both physics and gamelogic.

Share this post


Link to post
Share on other sites
What's your actual question? You've already calculated dt, so now all you need to do is plug that in as your time value in your simulation tick.

Maybe if you show your code for the simulation/rendering ticks we could point out what needs to be adjusted?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!