Paweł Mogiła's game development blog

Particle effects November 21, 2011

Filed under: gamedev,tutorials — szaman @ 01:58
Tags: , , ,

Hello

At the beginning I want to say that approach mentioned here in my earlier post – so creating sequences of frames consisting for full animation of explosion was totally wrong. After creating one explosion animation in ExploTexGen or Particle Illusion, I wanted to have more of these. So simply I started to create another fixed animations. What was th result? TGA files weighing over 2MB each with poor scalability and repeatable look. It wasn’t too efficient way to produce graphics effects. Additionally, I spent a lot of time on creating, exporting and transforming to looping animation.

So, I decided to create my particle system which could create various effects. Firstly I was thinking that I can use Bullet physics engine to simulate particles without collision. But then, I found that Bullet is calculating too much – too much for simple movement with gravitation, without any collision response. So I am calculating trajectory of  particles by myself. Each particle emitter has 20 parameters which determine appearance of spawned particles. most important of them are:

  • size of particle ( more precisely it is side length of textured square )
  • texture – it can be really small, I’m using 8×8 and 16×16 pixels
  • color – RGBA  begin values
  • lifeTime -as the name suggests, it is time after which particle is removed
  • dieTime – time after which particle begins to die, so it’s color and size starts interpolating to dieColor and dieSize
  • frequency – amount of particles

Full options visible on screenshoot.

It can be used for simulating things like:

  • fire
  • smoke
  • wind steams
  • rain, snow
  • explosion
  • blood
  • falling leaves from trees
  • spells, sparks
  • teleports
  • magic areas
  • waterfalls
  • fountains

As well as lot of other things which I can’t now come up with. What is important is that these various effects are produced / simulated in the same way but with different parameters ( so, logic for falling leaves is the same like in simulating fire or gas steam but final effect is totally different). Moreover, the design of new graphical effects is fast as hell. All particle emitters shown in the video bellow were created in less than 15 minutes. Of course everything is integrated in my world editor (new section added)

On video You can see examples of particle emitters and at the end – gas stream which is also forcefield and source of sound