| The code below I have slightly modified from another authors code. Please look it over and see if my comments make sense. Does anyone have an example of multi-threading? Would breaking up the logic and video renderer into separate threads be more efficient than render tweening? What about combining render tweening and multi-threading? 
 
 
Local renderTime = Floor(1000.0 / 60), updateTime# = 1000.0 / 30 ;30 standard  / 50 high performance = HIGHER IS SMOOTHER BUT FASTER
Local cTime = MilliSecs(), accum#
;Global RenderTween# = 1.0 ;MOVED TO GLOBAL_CODE
If CRT_Display = 1 Then
;( USE THIS ONE For CAPPING FPS TO THE MONITOR REFRESH RATE 85 HTZ ON NEC CRT ) BEST
;This one also limits TV/LCD/PLASMA screen to 30fps regardless of Vsync or Refresh Rate Setting??? Does not affect actual LCD Monitors as such.
	DoVsync = True
	LimiterOn = False
End If
If LCD_Display = 1 Then
	;Original Setting - Most Compatible
	DoVsync = False
	LimiterOn = True 
End If
If Uncapped_Mode = 1 Then
	;For benchmarking or last dtich attempt for good performance on some systems.
	;On very past machines should max out at 850 fps.
	DoVsync = False
	LimiterOn = False 
End If
;Local DoVsync = False, LimiterOn = True 	   ;( THIS IS THE ORIGINAL ROUTINE - CHANGE BACK To LIMIT FPS To 60 FRAMES ) MOST COMPATIBLE
;Local DoVsync = False, LimiterOn = False      ;( STAYS MOSTLY ABOVE 100 FPS FOR ME ) EXPERIMENTAL - CAN OVERHEAT CARD???
;----------------------------------------------------------------------------------------------------------------------------------------------
While Not KeyDown(1)							;Outermost main loop - rendering and all secondary functions
	accum = accum + (MilliSecs() - cTime)		;Accumulator for update loop
	cTime = MilliSecs()							;Official start of loop
	
	;Update loop (for render tweening) - all movement, input and update happens within this one.
	While accum >= updateTime
		;! CAPTURE STUFF
		CaptureWorld
		
		;! UPDATE STUFF (e.g. input)
		;KEYBOARD - RENAME THIS KEYS
	
		
		
		;! VARIOUS OTHER UPDATE FUNCTIONS
		UpdateWorld		;!If necessary
		accum = accum - updateTime
	Wend
	RenderTween = accum / updateTime
	
	;! SETUP DRAW STUFF
	AmbientLight red#,green#,blue# ;UPDATE THE SETTINGS AND TAKE EFFECT
	;! DRAW STUFF
	;Render World camera view - was this a command or simply a note??????
	RenderWorld RenderTween
	
	;! DRAW OTHER STUFF (e.g. 2D)
	Mousecursor() ;Draws the AIMER in lines on screen.
If LimiterOn Then Delay (renderTime - (MilliSecs() - cTime)) - 1;What does this one do? The timer here frees the spare CPU time.
	If DoVsync Then VWait     ;If Vertical Sync is on then Vwait
	Flip False                ;Flip False 
Wend
End
; MAIN GAME LOOP END
;/////////////////////////////////////////////////////////////////////////////////
 
 At the bottom on the code I am not sure what the -1 actually does?
 If LimiterOn Then Delay (renderTime - (MilliSecs() - cTime)) - 1
 
 
 |