Lag Fix. What is the definitive method?

BlitzMax Forums/BlitzMax Programming/Lag Fix. What is the definitive method?

Amon(Posted 2006) [#1]
I've looked at the lag fix thread and wanted to know the best way to go about fixing the lag. What should I add to my code?

Also, will there be a proper BRL fix for this?


Grey Alien(Posted 2006) [#2]
buy my framework ;-) the new version I'm releasing tomorrow will put the price up.

stick this after flip

Function ccFixLag()
	'This fixes the annoying DirectX7 rendering lag in BlitzMax
	?Win32
		If TD3D7Max2DDriver(_max2dDriver)
			Local sdesc:DDSurfaceDesc2 = New DDSurfaceDesc2
			sdesc.dwSize = SizeOf(sdesc)
			Local res:Int = PrimaryDevice.backbuffer.Lock(Null,sdesc,DDLOCK_WAIT|DDLOCK_READONLY,Null)
			PrimaryDevice.backbuffer.unlock(Null)
			Return res
		EndIf
	?
End Function




TartanTangerine (was Indiepath)(Posted 2006) [#3]
BRL have included it in the code but for some reason it is commented out at this stage.


FlameDuck(Posted 2006) [#4]
Use OpenGL.


Grey Alien(Posted 2006) [#5]
OPenGL still has a tiny lag, maybe one frame, whereas with the lag fix DirectX has none. I can notice it when moving the mouse on my PC.


Kuron(Posted 2006) [#6]
Use OpenGL.
I agree with FlameDuck 100%. BMax is 100% deisgned for OpenGL and works flawlessly. Mark gave in to the whiners and added DX support as an after-thought and it truly shows.

BRL have included it in the code but for some reason it is commented out at this stage.
Because it causes more problems than it fixes.


Amon(Posted 2006) [#7]
I'm not an expert but isn't OpenGL more troublesome? For example, will people need to update their drivers(to get my game working) more for OPenGL or DirectX?

I want people to download the game and be able to play straight away.

Lag fix works by the way, thanks Grey. :) Doesn't work with superstrict though.


puki(Posted 2006) [#8]
"Amon" - I guess the answer to your question in General Discussion was a no.

Just thought I'd let you know :)


Amon(Posted 2006) [#9]
I don't mind Puki. I'm done warring with BRL and everyone else. :)

Mark gave in to the whiners and added DX support as an after-thought and it truly shows.


Is there any truth to this? DX seems pretty stable.


Grey Alien(Posted 2006) [#10]
DX is supported on more mainstream systems so that's why I'm coding in it as my game is going to be commercial. I could add a OpenGl toggle on the options page I guess as my game engine works perfectly with it.


FlameDuck(Posted 2006) [#11]
For example, will people need to update their drivers(to get my game working) more for OpenGL or DirectX?
That depends on your market segment.

Is there any truth to this? DX seems pretty stable.
No. DirectX is just infinately worse documented (including, but not limited to statements that are downright wrong) and structured than OpenGL. There are a lot more 'gotchas' in DirectX. Developing in OpenGL just takes less time, and is more readilly available in BRLs target segment than DirectX is, thus it was done sooner.

DX is supported on more mainstream systems so that's why I'm coding in it as my game is going to be commercial.
But (judging by your previous works) you're not making a mainstream product.


popcade(Posted 2006) [#12]
At least BRL tried to fix it, just dunno when it's done...

PureBasic and Torque2D was just got updated yesterday, don't even have time to try them, working busy currently.

@Grey:
I've talked to my wife and she allowed me to put the money in, you should have got noticed about my purchase.