Animate, CPU overload problem

Archives Forums/Blitz3D Bug Reports/Animate, CPU overload problem

FlagDKT(Posted 2009) [#1]
When playing b3d files, CPU load grows with animation frames...
At the beginning I thought about a B3Dext problem, then after doing various tests I realized that it is a Blitz3D bug.

Download Example


chi(Posted 2009) [#2]
... your exported b3d is messed up!
i recreated your scene and my mesh is only 5mb and the animation is working without heavy cpu load. so it seems itīs more your workflow than a bug in blitz ;)


FlagDKT(Posted 2009) [#3]
The Cilinders you see are skinned meshes with many bones, that simulates 5-6 skinned characters moving at the same time.


t3K|Mac(Posted 2009) [#4]
Remember: animation is done only using the CPU (DX7!). No GPU acceleration available. So keep your bones count low.


FlagDKT(Posted 2009) [#5]
Yes, but why at frame 10 takes 5% CPU and at frame 500 takes 50% CPU??
That's a bug..


FlagDKT(Posted 2009) [#6]
Answer?


marksibly(Posted 2009) [#7]
Hi,

It seems to be something to do with SetAnimTime inside EXT_UpdateEntity.

The algorithm used by SetAnimTime just does a linear scan to find the right key frame to use for animation, so if you have tons of keyframes in a model with tons of children it could cause linear slowdown like this. Also, the EXT_ stuff appears to do it's own hierarchy walking, which could be combining with Blitz's to cause 'squared' slowdown.

But then, I have no idea what the EXT_ stuff is doing to the model in the first place. I don't appear to be able to animate it using standard Blitz3D commands - animtime ticks away, but nothing animates. Is this normal? In this case, it's hard NOT to consider the model 'broken'.


FlagDKT(Posted 2009) [#8]
Here's the same example that use ANIMATE command only, please check it out:

Graphics3D 800,600,32,0
Global frameTimer = CreateTimer(60)

light=CreateLight()
PositionEntity light,0,10,0

camera=CreateCamera()
TranslateEntity camera,0,3,-100

Global xx=LoadAnimMesh("bugtest.b3d")

;SKINNED CYLINDERS
Animate xx,1,.5
Animate FindChild(xx,"Cylinder01"),1,.5
Animate FindChild(xx,"Cylinder02"),1,.5
Animate FindChild(xx,"Cylinder04"),1,.5
Animate FindChild(xx,"Cylinder05"),1,.5
Animate FindChild(xx,"Cylinder07"),1,.5
Animate FindChild(xx,"Cylinder08"),1,.5
Animate FindChild(xx,"Cylinder10"),1,.5
Animate FindChild(xx,"Cylinder11"),1,.5
Animate FindChild(xx,"Cylinder13"),1,.5
Animate FindChild(xx,"Cylinder14"),1,.5
Animate FindChild(xx,"Cylinder16"),1,.5
Animate FindChild(xx,"Cylinder17"),1,.5
Animate FindChild(xx,"Cylinder83"),1,.5
Animate FindChild(xx,"Cylinder84"),1,.5	;<-The rotating one
Animate FindChild(xx,"Cylinder86"),1,.5
Animate FindChild(xx,"Cylinder87"),1,.5
Animate FindChild(xx,"Cylinder88"),1,.5
Animate FindChild(xx,"Cylinder90"),1,.5
Animate FindChild(xx,"Cylinder92"),1,.5
Animate FindChild(xx,"Cylinder93"),1,.5
Animate FindChild(xx,"Cylinder95"),1,.5
Animate FindChild(xx,"Cylinder96"),1,.5
Animate FindChild(xx,"Cylinder97"),1,.5
Animate FindChild(xx,"Cylinder99"),1,.5


While Not KeyHit(1)
	WaitTimer(frameTimer)
	time = MilliSecs()
	Framecounter_counter=Framecounter_counter+1
	If Framecounter_time+1000 <=MilliSecs() Then
		Framecounter_framerate=Framecounter_counter
		Framecounter_counter=0
		Framecounter_time=MilliSecs()
		FpsCounterAccumulator=FpsCounterAccumulator+Framecounter_framerate
	EndIf
	cpuStartMesure=MilliSecs()
	UpdateWorld
	cpuLoad=MilliSecs()-cpuStartMesure
	RenderWorld
	Text (800-85-FontWidth()),FontHeight(),"FPS: "+Framecounter_framerate
	Text (800-100-FontWidth()),FontHeight()*2,"AnmTime: "+AnimTime (xx)
	Text (800-100-FontWidth()),FontHeight()*3,"CPUload: "+cpuLoad
	Flip
Wend
EndGraphics
End


I need this bug to be fixed cause i have cutscenes in the game where 5-6 characters talk and move, and after 20secs of animation, it starts to slowdown till it goes at 15fps or less...(and it starts from over 60 with alla characters visible)
I don't think it would be too much difficult for you to fix it.
really thank you.


FlagDKT(Posted 2009) [#9]
Ok It has been Fixed with 1102 update.
..Thx Mark!