Particle Editor
I made some simple games, but i'm no artist (check Karma is a Bitch to understand better).
With that in mind I started looking for stuff I could do to make the games look good or at least look better using any programming tricks.
The most common recommendation I found over the internet was to use and abuse particles. They can be fully programmed and can be used for really cool effects, create feedback for the player, simulate fire/smoke, etc.
So to explore better how I could configure and visualize particles I started the making of a simple particle editor.
Implementation
To implement a particle system we will use 2 main parts:
- Particle – The particle with all of its configurations.
- ParticleGenerator – The system which will create, configure, update and destroy a group of particles.
The configuration parameters will be used by the particle system and when needed propagated to each particle. We will have the following parameters:
- Spawn Rate – Time between the spawn of each particle in seconds.
- Lifetime – Time between the moment the particle spawns until the moment it disappears in seconds.
- Dispersion – Max possible value of variation in a particle direction that is calculated when it is created.
- Velocity – Starting velocity of the created particles.
- Direction – Multiplier by the velocity that tells the particles which direction to follow, usually have the value 0, 1 or -1.
- Gravity – Boolean to activate the gravity calculation to each particle.
- Type – Multiple formats of particles can be used, right now I implemented the RECT, CIRCLE, POINT, LINE and FIRE types. Most are primitive types so I don't need to make art, and the fire is a free particle image I found in the internet.
To draw the visualization of the particles effect and to be able to detect the input to change the particle generator configuration I used the Love2D game engine.
With drawing and input handling I implemented the missing part, applying the calculations for each of the received parameters to the particles.
Result
With all done we can see in the following video some experimentation with the editor and after that some gifs of particle configurations.
I achieved what I wanted, I understood how I could make a particle system and got some visualization for it. I will use particles in my next game for sure, but probably will re-implement the particle editor inside the game so I can generate particles while testing the game.
Anyway, if I wanted to have this as a standalone particles editor I needed at least to be able to export configurations in json/lua tables formats.
Repository
If you want to check the particles editor code go to the repository.
Other
If you want to receive updates when there are new games or development stories join the mailing list