Timing Code Made Easy?

BlitzMax Forums/BlitzMax Programming/Timing Code Made Easy?

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.

Any pitfalls to using this code? I found it in the awesome "Annihilation" game source code. When I did some sprite tests, the animation was a little more jittery compared to my delta logic, but for someone who wants a fixed logic framework, this might be ideal.

Const	ReqFPS:Int=60  ' how often to update logic
Global	SUperiod:Int=1000/ReqFPS
Global	SUtime:Int=MilliSecs()-SUperiod
Global	SUelapsed:Int
Global	SU:Int
Global	SUticks:Int
'
Repeat
	Repeat
		SUelapsed=MilliSecs()-SUtime
	Until SUelapsed

	SUticks=SUelapsed/SUperiod
	If SUticks>1000 Then SUticks=1
	For SU=1 To SUticks
		SUtime=SUtime+SUperiod
		UpdateLogic()
	Next
	Cls
	RenderAll()
	FPS()
	DoDebug()

	Flip(0)
Until QUIT=1