Sponsored By

On Cocos2D Particle Systems

Covers the most important points in creating an efficient and effective particle system using cocos2d and some third party tools. Note: The author is not associated with the authors of any of the mentioned tools.

Michael Haney, Blogger

September 13, 2011

2 Min Read

Designing the System of Particles

 

It's difficult to talk about the designing of a particle system because there's a lot of parts to it. But I suppose if you break it down, you can see two distinct parts -- 1. How the particles behave and 2. How the particles look. To get both of these things right will require significant trial and error. There's a couple tools to make your life easier, though. You can use Particle Designer to create your system of particles. The main thing to keep in mind while designing your particle system is to keep the particle count low as you possibly can while maintaining the look of the system you desire. Also, play around with things like particle size to see if you can achieve the same system design with fewer particles. To texture the particles, you can use SVG-editGIMP (best imho), or really any graphics package to determine how your particles look.



Texturing Your Particles
Using your graphics package, create a texture that will represent your particles. The largest sized texture you can create is 64x64. However, the size of the texture for your particles greatly influences the performance of the particle system, so try to make the texture as small as you can (5x5, 10x10) while still having the particle look as you'd like.


Putting Your Particles In-Game
This is the easiest part of them all. Using cocos2d for iOS, code similar to the below code would get you a working particle system

CCParticleSystemQuad *system = [CCParticleSystemQuad particleWithFile:@"SystemCreatedWithParticleDesigner.plist"];

[YourCCNode addChild:system];


Important Points

  • Keep particle system total particle counts low as possible

  • Keep particle textures as small as possible

  • Use tools if you can, creating the right system by code alone can be tedious

Read more about:

Blogs
Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like