FrameTimer Questions

Blitz3D Forums/Blitz3D Beginners Area/FrameTimer Questions

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.

A frametimer will control the execution speed of your program (frames per second) so higher will make it faster. 200 may be too fast as some slower computers will take longer to reach that "200" delay.

A better way to control the framerate is to use render tweening. Heres a basic example...

Const framerate = 50

Graphics3D 1024,768,16,1
SetBuffer BackBuffer()

period = 1000 / framerate
time = MilliSecs() - period

While Not KeyHit(1)

	Repeat
		elapsed = MilliSecs() - time
	Until elapsed

	ticks = elapsed / period
	tween# = Float(elapsed Mod period) / Float(period)

	For k = 1 To ticks
		time = time + period
		If k = ticks Then CaptureWorld
		
		; main game loop goes here -------------------->
		
		
		
		UpdateWorld
	Next
	
	RenderWorld tween
	Flip
Wend
End


You will find that using render tweening will be much more reliable for keeping the game speed at a set rate and will keep the display smooth.