Particle Engine

Anonymous Aug 30, 2005 at 02:20


As you can see, the above screenshots showoff my latest project, a particle engine, that I have been programming for the past 2 weeks. There is still much work to do but I’m satisfied with the results I’m currently receiving. Now onto the technical stuff :)

I’m using SDL to setup the render window and OpenGL for hardware acceleration. This combination provides me the ability to port my engine onto Linux, which I plan on doing in the near future.

In each of the above images, with the exception of the bottom right screenshot, there are 800 particles that are being rendered/updated. It’s a simple system, when a particle reaches its death its attributes are reset and it gets placed where ever the current emitter’s position is located. I use a linked list to store the location of each particle, this provides me with the faculty of dynamically changing how many particles are rendered in real-time.

The performance isn’t bad considering that I didn’t optimize the code and that I’m rendering on resolution: 1024x768 32-bit color depth.
AMD Athlon XP 2000+
GeForce FX 5700LE

Average FPS 170

Onto the screenshots:

Top Left:

800 Particles
Alpha Blending

Tried to simulate a smoke effect, I can do better but I have to get the right color combination.

Bottom Left

800 Particles
Additive blending

Same as above image except with additive blending

Top Right:

800 Particles
Additive Blending


Bottom Right

1000 Particles
Additive Blending

This one looks a little different and that is because all the particles are initialized at once before the game loop. You can make some cool looking firework effects or explosions with this type of approach.

1 Reply

Please log in or register to post a reply.

zavie 101 Aug 30, 2005 at 06:54


What you can do to make the smoke effect look more realistic is to fake volumetric shape for particules. Just define normals going away from the center (supposing you’re using a single square, they will all result parallel to the billboard), and then turn light on. You will also need to sort your particules.