Sign in to follow this  
GameCreator

Need constant frame rate on different computers

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
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

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