Jump to content
  • Advertisement
Sign in to follow this  
anupgupta

Time Based Framework/Engine

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

Advertisement
Assuming definitions something like -

frame-based: "executing code dependent on the number of frames"

time-based: "executing code dependent on the current time"

A frame-based system executes code each frame, regardless of when the last frame was rendered. A time-based system executes code depending on how much time has elapsed since the last frame was rendered.

For instance, a frame-based system would move a character the same amount each frame - position += delta_move;

A time-based system would move a character an amount that's dependent on the time that has elapsed - position += speed*delta_time.

Problems occur when a frame-based application is run on a faster or slower machine. I.e., the player will move faster or slower just because the frames are being rendered at a different rate.

To make the application run on machines with different speeds, either control the frame rate, or update positions, rotations, etc., based on time elapsed since the last frame.

Share this post


Link to post
Share on other sites
Time-based systems aren't always as simple as just factoring in a time delta. Fix your Timestep! is a good article that deals with some of the more subtle issues you may encounter. It's possible that you don't need that kind of reliability, but it's still good to know.

At the very least, cap your time delta to sane values - you don't want things flying through the roof (or falling through the floor) if a frame happens to take a couple of seconds due to who-knows-what.

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!