Jump to content
  • Advertisement

Archived

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

deadlydog

By time or by frame

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

Is it best to program your games by time or by frame. For example, would it be better to use every 30 frames x happens, or every 1 second x happens? What are the advantages/disadvantages of the 2? Thanks - God is my favorite fictional character

Share this post


Link to post
Share on other sites
Advertisement
Frame-based movement is much simpler than time-based.

Time-based runs the same on different computers.

Unless you're never going to upgrade and never going to give your program to another person, stick with time-based movement.

[edited by - vnillabrent on May 20, 2004 10:35:29 PM]

Share this post


Link to post
Share on other sites
I don''t think time based is really that much more difficult. Using frame times is really not workable. You can''t even guarantee on the same pc that you will get the same frame rate every time you run the game. Some background process could be running that will slow things down. The only way to get a game to run properly is time based.

Share this post


Link to post
Share on other sites
Way back in the day games used to run based on frame rate. Then new computers came out and everything ran in turbo-speed. Any sensible person today runs things based on time.

-John

Share this post


Link to post
Share on other sites
So if I''m going to do everything time-based, as that seems to be the sensible choice from what u guys are saying, is there any point to locking the framerate to 33 FPS, or should I just leave it uncapped?

- God is my favorite fictional character

Share this post


Link to post
Share on other sites
i recommend leaving the frame rate uncapped
fast computers will run slower than they could
slow computers may still drop to a lower frame rate

using time based movement will cause slower computers to skip frames in order to keep up to the current frame on a fast computer. this may cause animation to look choppy or laggy.

Share this post


Link to post
Share on other sites
There really isnt a question about it. Use time-based-movement.
Unless you''re making a simulation that isnt real-time.
-CProgrammer

Share this post


Link to post
Share on other sites
Remember Wolfenstein 3D? That was one of the first games to use time rather than frames to handle game events. Consequently, unlike many of its peers, it will still run at the right speed today, even though processor speed has increased massivly.

Capping frame rates can actually be a good defensive programming strategy. The idea being, that you don''t know what will happen when framerates get excessivly high on computers which don''t exist yet, however as long as the framerate is high enough to look smooth, why let it get any faster? If you know your timing code is reliable, better let it take up the slack on fast machines rather than your possible unstable-at-high-speed rendering code.

Quake III had minor issues at excessivly high FPSes and consequently Doom III''s FPS has been capped at about 60. If you have performance to spare, better code defensivly and prevent the need for patches etc. later.

Share this post


Link to post
Share on other sites
What issues did Quake 3 have running at high speeds? I''m just wondering how running a game on a fast enough computer can break it even if it is time based.

Share this post


Link to post
Share on other sites
I''d take a guess at floating point errors. If you''re running at 1000 frames a second, then 1 frame takes 1 millisecond to render. If you want an object to move 1 unit in 1 second, then you need it to move 10/1000 = 0.001 unit every milisecond. In 1 second, you''ll have done 1000 additions of 0.001, which could result in a value like 1.123 instead of 1.0 due to floating point errors, which will mean that the collision will go screwy.

As i said, this is just a guess and i could be completely wrong

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.

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!