Since I first started programming, particle systems have always been one of my favorite things to write. In the 10 years since that is still true, and I have written so many of them. Today I ported the particle system from our previous engine ( Phalanx ) back in. It’s been cleaned up a bit and I added some more configuration settings ( like random colors ). The system is pretty straight forward, you create a particle emitter and place it at the location you want particles to emit from. This can be a child of any node in the scene graph if you like. You configure the appearance of the emitter to get different effects. Things like the power, the size, the angle spread the color, lifetime, sprite sheet settings, etc. Those particles emit back in world space and you get something that looks like this:
So this particular emitter is hard coded into the editor at the moment, next up I’ll have to link it up to the project data system so that you can drag and emitter into the world and configure it on the fly. This will also allow you to link it up and define its emission points.
Particles can quickly eat into your frame rate, so its important to add accurate timing metrics and make sure this is as optimal as possible. Also, since there are so many of them, its not a bad idea to move the particle calculations to secondary threads. But I haven’t really spent any time multi-threading this engine as of yet, Phalanx had multi-threading and it lead to a lot of bugs… I’ll have to design up a cleaner multi core solution to this at some point in the future. Most likely these particles will eventually make their way to a thread pool, but at this time, this is good enough. =)