Game Timing

BlitzMax Forums/BlitzMax Programming/Game Timing

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

For Delta timing you multiply all movement my the delta time, that way it can pump out Max FPS but the movement (and logic?) will only tick along at the delta time. Say:

B3D Example:
MoveEntity Player, 0, 0, 10 * DeltaTime


I think alot of the reference to Mark's timing is actually from the Mak Castle Demo in the Blitz3D Samples Folder.

Timing code:
Const FPS=30
period=1000/FPS
time=MilliSecs()-period

While not keydown(001) ; Main Loop

Repeat
		elapsed=MilliSecs()-time
	Until elapsed

	;how many 'frames' have elapsed	
	ticks=elapsed/period
	
	;fractional remainder
	tween#=Float(elapsed Mod period)/Float(period)
	
	For k=1 To ticks
		time=time+period
		If k=ticks Then CaptureWorld
		
		UpdateGame()
		UpdateWorld
	Next
Renderworld tween#


Its pretty easy to follow. Hope it helps :)