I created a basic particle system for SDL in C++. It has some basic stuff like an emitter, as well as a simple particle class. It can load a image, or create a dot of a color. And that's it. What other features do most simple particle engines have? Keep in mind this is a 2D particle engine.


This is a very broad question, but generally particle system features can be broken down into a few categories. Here are some general ideas for the sorts of things you might want to have.

Emission features define how, when, and where particles are emitted.

  • Continuously generate particles at a fixed rate, or generate a cluster all at once when triggered by some in-game event.
  • Place newly-emitted particles at a point, or randomly within a region, such as a box or circle. The point or region could be moving, e.g. attached to an object or character.
  • Emit particles at a rate proportional to the velocity of a moving object, which can be useful for smoke trails and suchlike.
  • Give the particles a random initial speed and direction, within certain ranges. For example, an explosion would send particles in all directions while a cannon would send them in the direction the cannon is pointing.
  • Optionally have particles inherit velocity from their emitter, when the emitter is itself moving.

Motion features control how particles move after they're emitted.

  • Gravity or buoyancy makes particles sink or rise.
  • Collision detection can be used to make particles respect walls, either by flowing along them or bouncing off.
  • Air drag causes fast-moving particles to slow down.
  • Particles also might move along a spline defined by the designer, or be attracted to a particular point or region (possibly attached to an object or character), etc.

Rendering features control how particles look.

  • You almost certainly want to have the particles change size, color, and alpha as they age. Animation curves can be defined to control these.
  • For a 2D game, the Z-order of particles relative to other game objects should also be controllable.
  • For sprite particles, you might like to have the sprite rotate. It could spin at a random speed, or rotate to face its direction of motion, or the direction its emitter was moving when it was emitted.
  • Also for sprite particles, you might want to have it run through a sequence of animation frames.

These are just a bunch of general ideas. For your specific game you might only need a couple of these, or you might need other ideas that aren't on this list.

  • \$\begingroup\$ +1 This is exactly the feature list of my particle engine implementation. Later on, you might want to add some extras, like emitting along a line (for laserbeam effects), or circle (a spaceship's shield, for example). \$\endgroup\$ – Marton Aug 6 '12 at 6:52
  • \$\begingroup\$ Awesome list! Really comprehensive. +1 \$\endgroup\$ – Rivasa Aug 6 '12 at 14:39
  • 1
    \$\begingroup\$ Add two more ideas: if you render the entire lifetime of the particle, you can get static particles, which can be used to generate hair or grass; let emitters generate emitters as well as plain particles - you can create some interesting explosions by generating debris which in turn generate smoke trails. \$\endgroup\$ – congusbongus Mar 18 '14 at 4:14

Watch this video for some ideas that you can add to your system, in particular modifiers, which can be used to interpolate particle properties over time, such as color or opacity, or to apply complex gravitational forces to the system. These are often enough to create some really cool effects, when combined with a basic particle emitter.

Afterwards, you might want to check the documentation of some existing particle engine to see what else they provide. The first one that comes to my mind is the Mercury Particle Engine, which also seems to be built around the concept of particle emitters and modifiers. Give it a test drive and it should be enough to answer your question.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.