Flint Particle System Forum - Performance Leak Gravity Wells 2010-11-17T10:48:17+00:00 http://flintparticles.org/forum/ Lussumo Vanilla & Feed Publisher Performance Leak Gravity Wells http://flintparticles.org/forum/comments.php?DiscussionID=98&Focus=425#Comment_425 2008-10-04T00:28:21+01:00 2008-10-30T14:59:25+00:00 Manuel Dahm http://flintparticles.org/forum/account.php?u=75 Hi there, I am checking out Flint for the first time, which is great fun. I changed a bit the Gravity Wells example and in the beginning it runs well but after some time FPS goes down and never ...
I am checking out Flint for the first time, which is great fun. I changed a bit the Gravity Wells example and in the beginning it runs well but after some time FPS goes down and never comes up again, even if I unload the swf, Memory though stays stable, weird actually as it was my first guess why it kept slowing down.

Below's the code, any hints for where to dig would be greatly appreciated as I am new to the Flintstone.

Cheers,
Manuel

----

emitter = new GravityWells();
renderer = new PixelRenderer( new Rectangle( 0, 0, 300, 300 ) );
renderer.addFilter( new BlurFilter(2, 2, 1 ) );
renderer.addFilter( new ColorMatrixFilter( [ 1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1.0001,0 ] ) );
renderer.addEmitter( emitter );
fx.addChild( renderer);
---
Gravity Wells.as:
private var gs : Array;

public function GravityWells()
{
gs = [];
counter = new Blast( 600 );
addInitializer( new ColorInit( 0x4ebf3aFF, 0xe63d16FF ) )
addInitializer( new Position( new DiscZone( new Point( 150, 150 ), 80) ) );
addAction( new Move() );

for (var i : Number = 0; i < 12; i++)
{
var p : Point = r();
var l:Number = Math.random()*45 + 52;

var g:GravityWell = new GravityWell( e(), p.x, p.y )
addAction( g );
gs.push({g:g, p:p, c:Math.round(Math.random()*360), l:l, i:(Math.random()*2 - 1)});
}
setInterval(onEnterFrameHandler, 100)
}

private function onEnterFrameHandler() : void
{
for (var i : Number = 0; i < gs.length; i++)
{
var o:Object = gs[i];
var g:GravityWell =o.g;
var p:Point = NonoMath.posFromAngleDistance(o.p, o.c+=o.i, o.l);
g.updatePos(p);
}
}

private function r() : Point
{
return new Point(Math.round(Math.random()*30)+122,Math.round(Math.random()*30 + 122 ));
}

private function e() : Number
{
return Math.random()*6 +6;
}

public function kill() : void
{
counter = null;
}]]>
Performance Leak Gravity Wells http://flintparticles.org/forum/comments.php?DiscussionID=98&Focus=434#Comment_434 2008-10-15T08:59:53+01:00 2010-11-17T10:48:17+00:00 Richard http://flintparticles.org/forum/account.php?u=1 Hi Manuel I ran your example for 20 minutes with no visible slow down. I don't have the NonoMath class so had to use something else, otherwise I ran it as above. Are you able to create a ...
I ran your example for 20 minutes with no visible slow down. I don't have the NonoMath class so had to use something else, otherwise I ran it as above.

Are you able to create a simpler example, not using NonoMath or any other classes other than Flint and Flash, that demonstrates the problem?

P.S. Your kill method will cause an error if you call it - set the counter to a ZeroCounter if you want to stop creating particles.]]>