Question

I'm using Cocos2d 3.0 RC2, and I built a game around using dozens of sprites to create an explosion animation. Each sprite used in the explosion animation undergoes the following:

1)scaling

2)bezier movement

3)tinting

4)fade out

I've noticed that if just 500 sprites or more are being used on the screen, the game drops off from 60fps. However, in the cocos2d particle tests, I see about 1000 or so "particles", moving fluidly at 60fps with tinting, gravitational movement, fading, and scaling.

So the ultimate question is:

1) What's the difference between a "particle" and a "sprite", if they seem to be the same thing?

2) Is the particle system much faster than using lots of individual sprites? If so, why?

Cheers!

Was it helpful?

Solution

"Just 500 sprites" - you may need to adjust your expectations. 500 sprites can be quite a lot even for the iPhone 5S, depending on the sprite texture sizes. The larger the sprites are the fewer of them you can draw without dropping frames.

Also consider sprite batching (CCSpriteBatchNode) if you haven't and be sure to test performance only on a device, never the Simulator.

That said, particles are faster because they are controlled entirely by the particle system class. You can not access individual particles and even if you could, you couldn't apply many of the sprite features (skew, physics, etc.) to them. Meaning particles are fast because they are more efficiently rendered while sacrificing functionality that you often need to use with sprites.

That's the simplistic explanation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top