Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

share|improve this question
    
Use google: en.wikipedia.org/wiki/Particle_system –  Justin Skiles Aug 6 '12 at 2:45
5  
Remember that all your great features won't matter if you don't make your tool usable by artists. –  Laurent Couvidou Aug 6 '12 at 2:54

3 Answers 3

I've been doing some research myself into this area. This tutorial seems to have brought me up to speed, even though I haven't been able to port it into my code yet:

http://www.baysidegames.net/blog/?p=51

(includes videos that explain all of the code)

share|improve this answer

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.

share|improve this answer
    
+1 Great, comprehensive list :) –  David Gouveia Aug 6 '12 at 2:58
    
+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). –  Marton Aug 6 '12 at 6:52
    
Awesome list! Really comprehensive. +1 –  Link Aug 6 '12 at 14:39
1  
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. –  congusbongus Mar 18 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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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