Delta timeing can be a bit confusing. I don't know who wrote this, but its free in the IDEal IDE and really great. It has the advantage of only using the nessercery CPU power to maintain your FPS, so if you set it to something like 30FPS it will free up a lot of computer resurces and still maintain your game (and run it on the same speed on every computer)
Blitz3D but easily changeable.
Blitz3D but easily changeable.
Graphics3D 640,480 Global Camera=CreateCamera () Const GameUPS=60 ; Updates per second Local Period=1000/GameUPS Local FrameTime=MilliSecs()-Period Local Tween#, Ticks,i,Remaining,StartTime,Elapsed While Not KeyHit(1) StartTime = MilliSecs() Repeat Elapsed=MilliSecs()-FrameTime Until Elapsed Ticks=Elapsed / Period Tween=Float(Elapsed Mod Period)/Float(Period) For i=1 To Ticks FrameTime=FrameTime+Period If i=Ticks Then CaptureWorld End If UpdateGame() UpdateWorld Next RenderWorld Tween Remaining = Period - (MilliSecs() - StartTime) If Remaining > 1 Then Delay (Remaining-1) ; Free some CPU time End If Flip Wend End Function UpdateGame() ; ... End Function