News:

Building a 3D Ray Tracer  By stevmjon

Main Menu

Game timing routine

Started by Draco9898, July 06, 2004, 03:24:44 AM

Previous topic - Next topic

Draco9898

I use this simple Algorithm in my game to ensure the gameplay is justified in terms of speed when the game FPS slows down, considering that 120 is suppose to be 100% normal and when the game is at 60 FPS its at it's 100% peak.

This makes it so let's say the user has a lousy computer and the FPS is 30, then we lost 50% of our normal frames per second so the game speed is increased 50%.

`Timing
CurFPS#=FPS()
TimeFlush#=120*(1+(1-(CurFPS#/60)))
DualCore Intel Core 2 processor @ 2.3 ghz, Geforce 8600 GT (latest forceware drivers), 2 gigs of ram, WIN XP home edition sp2, FireFox 2.

"You'll no doubt be horrified to discover that PlayBasic is a Programming Language." -Kevin

kevin

I guess using the FPS() function is prolly ok in a lot of cases... Just be careful not to call it more than once per frame.   Doing so will make throw the fps results totally out the window,since it calcs the fps() rate each time you call it..  which will effect your calcs based upon it..  So just grab the last frames fps() into a variable, then use that for your calc's for the next frame, as you've done..

Most people would prolly use the timer function though.  Prolly get a little more precision...