• Advertisement
Sign in to follow this  

Need constant frame rate on different computers

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

I was looking around for a way to make my game's frame rate the same on different computers. What I don't like is that every tutorial I've found insists that you multiply everything in your game by some speed factor. When I used Allegro it was brilliant. Somehow (using an interrupt, I believe) it made it so I didn't need to change anything else. I just designed the game for 60FPS and it did the rest using its timer. Is there any timer library or code I can use that does the same without Allegro (I'm using Irrlicht now for 3D)? Or, as an alternatvie, is Allegro compatible with Irrlicht? Can I use both? And if so, is there a way to import only the timer into my EXE? (I remember the filesize got pretty big otherwise.) Thanks.

Share this post


Link to post
Share on other sites
Advertisement
If you do your timing based on the elapsed time per frame, then you don't have to change anything when you move from computer to computer. First, determine how fast you want an object to move in pixels per second. Then, each frame, move the object by that amount times the elapsed time. With this method, no matter how fast or slow the machine is, the object will always move the same number of pixels per second.

Share this post


Link to post
Share on other sites
Quote:
Original post by Dave Hunt
If you do your timing based on the elapsed time per frame, then you don't have to change anything when you move from computer to computer. First, determine how fast you want an object to move in pixels per second. Then, each frame, move the object by that amount times the elapsed time. With this method, no matter how fast or slow the machine is, the object will always move the same number of pixels per second.

Actually, a better way would be to use a Fixed Timestep.

Share this post


Link to post
Share on other sites
Quote:
Original post by bytecoder
Actually, a better way would be to use a Fixed Timestep.


I would say different, not necessarily better. Certainly a good alternative, though.

Share this post


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

  • Advertisement