Frame rate counter

BlitzPlus Forums/BlitzPlus Programming/Frame rate counter

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.

I've done a bit of code to show the frame rate of my game, but it seems to change the number a lot. Is this normal/to do with my game, or is there a better way of designing a frame rate counter?

here's the code

If debug=1 Then 
nowmillisecs#=MilliSecs()-lastmillisecs#
	Color 150,150,0
	Rect 600,500,150,50
	SetFont ammostatfont
	Color 255,255,255	
	Text 610,510,nowmillisecs+"ms/f"
	Text 610,530,1/(nowmillisecs#/1000)+" FPS"
EndIf

lastmillisecs#=MilliSecs()



It shows the frame rate in milliseconds per frame (ms/f) and frames per second (fps)