You Like My Tutorials? Click The Banner To Keep 'Em Coming!

glGameDeveloper(): The Game Developer's Source for OpenGL Coding
Main Menu
Latest News
Archived News
Tutorials
Links
E-Mail Me

Other
Message Board
My Guestbook

Tutorials -- Updating Games Based on Time
 


Updating Your Game Based on Time Page 1 of 3
< Previous Jump to Page: 1 | 2 | 3 Next >

Updating Your Game Based on Time

Note: This tutorial is best used with the Basic OpenGL tutorial source code. If you aren't building off of that, you may have to change some things around.

This is a quick and painless tutorial on how to get your game running at the same speed on anyone's computer. Because 3d rendering is CPU intensive, slower computers can't handle the same FPS as faster computers. This poses a problem because the game is updated between each frame, instead of during each frame.

Say we have a game that is set to update the same amount every frame. If it takes 1/10 of a second (10 FPS) to update the screen, that much time has passed according to the player. But according to the game, only one frame has passed. In this scenario the game will run in slow motion. If, however, the game updates the screen in 1/100 a second (100 FPS), the game runs too fast. Both of these situations affect gameplay tremendously.

There's no way of making the game draw the screen in a certain amount of time because of variations in CPU power. Therefore, the logical solution is to update the game according to how much time has passed. Move on and we'll learn how to do that.

Updating Your Game Based on Time Page 1 of 3
< Previous Jump to Page: 1 | 2 | 3 Next >

This site best viewed with MS Internet Explorer 5.0 at 16-bit color and at least 800x600.

All Contents of this site are Copyright 1999, 2000 Joe Zimmerman. No part of this site (code, HTML, etc.) may be reproduced without my permission.

Click Here!