Sign in to follow this  

particle engine

Recommended Posts

Hello all. Partly off-topic this on, I'm coding in OpenGL and using NeHe's base code, but my question is more a theoretical one. I'm write my own particle engine. So far I have made some crappy snow particles and something that might look like firework.... What kind of particle do a good engine need? smoke, fire, sparks, rain? Other? What functionality do a particle engine need? Now my particles never die... Gravity/weather and lifespan is one the list? collision detect? how? other? Also, any good link to theory on particle engins would be nice. Thanks Endre

Share this post

Link to post
Share on other sites
It all depends on context. Generally your particles will be used for smoke, fire, explosions, rain etc, etc. In my game, I'm even using particles for a paralax starfield effect.

Lifespan is a must. Some particles don't die, whereas things such as smoke and explosive particles will expire after a length of time (or on collision).

I don't have particle collisions, but sometimes you might want to model particles colliding with surfaces and responding accordingly. Bear in mind that a physical simulation of particles will be heavy on the CPU as there can be typically hundreds, even thousands of particles in a given scene.

One way of doing the collision detection would be to treat the particle as a point, or even a sphere - from there you'd follow your normal collision detection / collsion response route.

Gravity can be simulated by weighting the 'y' velocity with 9.81 m/s (convert to units appropriate to your engine). You could get advanced and simulate particle mass, energy as well as effects such as wind resistance and turbulence. As for this, you'd probably have some Physical Manager to store the scene's settings which are read by the system in it's update routines.

I don't use near this much complexity though, I have a generic system that's fed certain variables from an Xml file. Anything the system can't cover (by design) will have to be coded specifically, but there's not much of a need for that in my game.

You can make particle effects as simple or as complex as you want, but bear in mind the complexities of updating the system coupled with the increased overhead on the GPU for rendering.

I've said before though, I love particle effects and playing with systems. It's some of the most fun you can have in codig, IMHO [grin]

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this