#31644 - ThUg4LiFe - Mon Dec 13, 2004 1:48 pm
right well, i was wondering how you make a game maintain a set fps? because surely if there is a lot happening at a particular time (accumulating scores, enemies animations, health and speed calculations) the game loop would more than likely take longer than a loop where there isnt much happening (such as the player just standing still)
each game loop there would be more aspects of the game and display to update which have been brought into it when more is happening. i would assume this makes each loop take longer, and thus you would get a "slow-down" effect
i know i read that a game loop should (would?) be around one VBlank and there are 60 VBlanks to a second, but surely it would not be around one VBlank for a game (or at a time in a game) where there is less/more happening? i do not know the answer, but if the game loop time would vary because of such things, then can i find out what the longest game loop would be, and force the code to start each loop again only once that amount of time has passed.... so if a loop is finished quicker, it will wait til the set elapsed time from execution before continuing? this would prevent slow-down and such, i think :\
each game loop there would be more aspects of the game and display to update which have been brought into it when more is happening. i would assume this makes each loop take longer, and thus you would get a "slow-down" effect
i know i read that a game loop should (would?) be around one VBlank and there are 60 VBlanks to a second, but surely it would not be around one VBlank for a game (or at a time in a game) where there is less/more happening? i do not know the answer, but if the game loop time would vary because of such things, then can i find out what the longest game loop would be, and force the code to start each loop again only once that amount of time has passed.... so if a loop is finished quicker, it will wait til the set elapsed time from execution before continuing? this would prevent slow-down and such, i think :\