Hopefully someone can explain to me how this frametweening code mod works, or more importantly, if I shouldn't do it.
For the code in the box below, if I leave it as it is (this is how Mark's example code is) I get 20 to 30fps on my 2nd crap test PC. However, if I change this line -
to this -
I get 60fps. So, what I want to know is, why does this happen, and why is the original frametweening code set to 1, and am I messing something up by changing it to a zero?
I have noticed that on a really simple program that puts no load on the system, changing the 1 to a 0 causes it to behave a bit erratically, but on a full program it almost doubles the framerate.
I am confused as to why.
thanks
James
For the code in the box below, if I leave it as it is (this is how Mark's example code is) I get 20 to 30fps on my 2nd crap test PC. However, if I change this line -
;game logic loop For frameLimit = 1 To frameTicks
to this -
;game logic loop For frameLimit = 0 To frameTicks
I get 60fps. So, what I want to know is, why does this happen, and why is the original frametweening code set to 1, and am I messing something up by changing it to a zero?
I have noticed that on a really simple program that puts no load on the system, changing the 1 to a 0 causes it to behave a bit erratically, but on a full program it almost doubles the framerate.
I am confused as to why.
thanks
James
;pre-game timing setup, centre mouse and start debuglog etc... framePeriod = 1000 / gameFPS frameTime = MilliSecs () - framePeriod MoveMouse GraphicsWidth()/2,GraphicsHeight()/2 SeedRnd MilliSecs() While Not KeyHit(1) ;frame limiting Repeat frameElapsed = MilliSecs () - frameTime Until frameElapsed frameTicks = frameElapsed / framePeriod frameTween# = Float (frameElapsed Mod framePeriod) / Float (framePeriod) ;game logic loop For frameLimit = 1 To frameTicks If (frameLimit = frameTicks ) CaptureWorld EndIf frameTime = frameTime + framePeriod ;camera FUNC_Camera(GAMEDATA\vehicle1 , GAMEDATA ) ;game logic in here UpdateWorld Next ;render RenderWorld frameTween ;calculate FPS If (frameTicks>0) FPS = gameFPS/frameTicks Else FPS = gameFPS EndIf ;on-screen FPS counter Color 255,255,255 Text GraphicsWidth()-60,10,"FPS:"+FPS Flip Wend