Klepto's GetDelta() - Juddering

BlitzMax Forums/MiniB3D Module/Klepto's GetDelta() - Juddering

siread(Posted 2007) [#1]
I have tested this code on both MacOS and Vista (both on a MacBook with BootCamp so the hardware is identical).

In both OS's I am seeing serious juddering with Flip -1, and slight juddering with Flip 0.

On MacOS it is almost perfect on Flip 0 but not quite. Vista seems to have spasms where juddering on Flip 0 goes from non-existent to noticable.

On Flip 0 I'm getting an FPS of about 900 on the Mac and 1300 on Vista. The FPS does fluctuate quite a bit - is this normal?

Is there something wrong with the code? Is it due to background tasks? A driver issue maybe? I should point out that the juddering isn't constant but why is it so bad on Flip -1?

Please have a look and let me know what you think.

SuperStrict
Import klepto.miniB3D

Graphics3D(800, 600, 32, 0, 60)
TGlobal.SetDeltaFPS(60)

Global cam:TCamera = CreateCamera()
CameraRange(cam,1,2000)
CameraZoom(cam, 1.8)
PositionEntity(cam,0,200,-1500)
		
Global light:TLight = CreateLight(1)

Global Gravity:Float = 0.65
Global f:Int = -1	' Flip mode

Global ball:TBall = TBall.CreateBall()		

Repeat
	ball.Update()
	UpdateWorld
	RenderWorld
	
	DrawText("FPS:"+Int(TGlobal.GetFPS()), 10, 10)
	
	If KeyHit(KEY_SPACE)
		f:+1
		If f = 1 Then f = -1
	End If
	
	Select f
	Case -1
		DrawText("Flip -1 (Space)", 10, 30)
		Flip -1
	Case 0	
		DrawText("Flip 0 (Space)", 10, 30)
		Flip 0
	End Select
	
Until KeyDown(KEY_ESCAPE)

Type TBall
	Field mesh:TMesh
	Field radius:Float
	Field x:Float
	Field y:Float
	Field z:Float
	Field xv:Float
	Field yv:Float
	Field zv:Float
	
	Function CreateBall:TBall()
		Local b:TBall = New TBall
		
		b.mesh = CreateSphere(16)
		b.radius = 50
		ScaleEntity(b.mesh, b.radius, b.radius, b.radius)
		EntityColor(b.mesh, 255, 255, 255)
		PositionEntity(b.mesh, 0, 10, 0)
		b.xv = 15
		b.yv = 0 '-10
		
		Return b
	End Function
	
	Method Update()
		Local delta:Double = TGlobal.GetDelta()
		
		' Move ball
		TranslateEntity(mesh, xv*delta, yv*delta, zv*delta)
		
		' Keep ball on screen
		If EntityX(mesh) > 800 Then PositionEntity(mesh, 800, EntityY(mesh), EntityZ(mesh)); xv=-xv
		If EntityX(mesh) < -800 Then PositionEntity(mesh, -800, EntityY(mesh), EntityZ(mesh)); xv=-xv
	End Method
	
EndType



siread(Posted 2007) [#2]
Wow, this forum really has gone quiet. I think we need an update Simon. ;)


Robert Cummings(Posted 2007) [#3]
Gone back to 2D myself. At least I dont need features :)


siread(Posted 2007) [#4]
I do, my game is 70% complete! I just need faster animation and I take a massive step towards the finishing line. :)


klepto2(Posted 2007) [#5]
hi, sorry for the silence. But unfortunatly I had a lot other stuff to do the last weeks. But I had a short look to the code and on my XP machine it seems to work. small juddering but don't ask me why. I would guess a driver issue (most common problem with openGL).

btw: I hope simonh will release his new version soon also ;) .Because I want to release my new extended Version with his one as his new Version seems to have a lot of changes.
(new extended Version will hopefully include 2 new mesh loaders)


siread(Posted 2007) [#6]
Hi Klepto. Looking forward to your new version. :)

Yeah, it's a strange one and i get different performance depending on Vista's mood which is very annoying. Definitely noticed some skipping occured at the same time as an external hdd was being accessed too.


simonh(Posted 2007) [#7]
The new version is coming soon. I have two weeks off in a couple of weeks so at the very latest it will be released then.


siread(Posted 2007) [#8]
Great news. :)