So, this is probably redundant, as I seem to remember Anaël mentioning that he’s got some code for a particle system already written, but I thought it would be a good test of the plugin system to try and have a particle system and editor plugin.
I’ve written a small particle system before. It wasn’t overly impressive but it was functional. I didn’t think I could very easily write a flexible one though, so why not do what I’ve been doing recently for a few other things, piggyback off an existing library. Unfortunately there aren’t an awful lot of particle system libraries which are freely available (everyone rolls their own?) but I did come across Particle Systems API which seems to do a lot of what I want. The rendering ended up being incredibly simple and implemented in the example program, rather than the library itself, which is nice.
I have begun work on attempting to integrate it with Maratis/MGui as a “behavior” in a dll. Unfortunately, at this point, it doesn’t seem to work. Ok, more than that, it crashes. Still, I’m happy that it actually compiles with the minimal work I’ve done. I will look into why it crashes and fix that. If anyone wants to take a look at the code, it’s up on github for all to see.
So, what are the goal of this particle system. A quick list to see what we’re wanting to do:
- Be able to place multiple particle emitters around the level. Probably as a behaviour is easiest.
- Be able to tweak emitter variables from within Maratis Editor and see things update within the editor without running the game.
- Potentially use MPhysicsContext (Bullet) for particle behaviour.
- Potentially move particle behaviour onto GPU.
Now, it’s unlikely that we can do both using physics for the behaviour and moving it onto the GPU (although Bullet now can do calculations on the GPU). It just depends how things look, how it will evolve I think.
The thing I would really love is to be able to create a particle system which emulates a cloud of smoke and reacts to the player moving through it, swirling around them. I’ve looked into fluid dynamics and I think, in order to model this on the scale of a particle system, it really should be on the GPU, but using a physics system might be able to approximate it well enough.
What do people think? Any experiences at all with this?