| |||||||||||
|
Main Menu Other |
Tutorials -- Updating Games Based on Time | ||||||||||
|
Updating Your Game Based on TimeNote: 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.
|
|||||||||||