Sign in to follow this  

Time Based Framework/Engine

Recommended Posts

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this