Is this normal? how do you guys manage a stable fps with a particle system. I'm moving a particle across the screen every 5 seconds and every time I get a 10 fps decrease of CCParticleSun and even higher on CCParticleMeteor, dropping it down to 30 fps.
Particle System 10-30 fps drop
(4 posts) (2 voices)-
Posted 4 months ago #
-
That should not happen. Give some more details about what you are doing, please.
Posted 4 months ago # -
I run this method via schedule in 5 sec intervals. I'm thinking it may have something to do with initializing obstacle every tick.
-(void) moveObstacleTick: (ccTime) dt { if([self isObstacleOnScreen] == NO) { obstacleType = 1+arc4random()%numberOfObstacles; switch (obstacleType) { case fireBall: obstacle = [CCParticleSun node]; obstacle.texture = [[CCTextureCache sharedTextureCache] addImage: @"fire.pvr"]; [obstacle setEmissionRate:50]; break; default: break; } [obstacle setPosition: ccp(481,321)]; [self addChild:obstacle z:0 tag:obstacleTag]; CGPoint fireFromLane; // #2:lane1 #3:lane2 #4:lane3 int randomLane = lane1 + arc4random()%lane1; switch (randomLane) { case lane1: fireFromLane = ccp(490, 190); break; case lane2: fireFromLane = ccp(490, 140); break; case lane3: fireFromLane = ccp(490, 90); break; default: break; } [obstacle setPosition:fireFromLane]; id throw = [CCMoveTo actionWithDuration:3 position: ccp(-50, fireFromLane.y)]; id actionSeq = [CCSequence actions:throw, nil]; [obstacle runAction:actionSeq]; } }Posted 4 months ago # -
Its not a problem to set the position of the particle system every frame, But try to avoid to initializations of object during your game is running. I do not know how many particles your CCParticleSun is allocating. The higher that number the worse. Preallocate some systems and reuse them. You can improve this even further by batching them, but this is much more work. Start with the preallocation.
Hope thats helpful somehow.
Posted 4 months ago #
Reply
You must log in to post.