Skip to content

Particle Engine

May 29, 2012

I recently had the opportunity to program a particle engine from scratch  and it was the first time I’ve ever had to do it so I dove in head first and got started.  Something that I learned very quickly was to make it very object oriented.  Individual particles have the potential to have lots of different properties.  In my first attempt I started out by creating an emitter that emitted particles, but very quickly I learned where I went wrong.  What you actually want is for particles to actually be emitters.  Sometimes you want trails, sometimes you want a missile to fly through the air and then trigger an explosion of particles, etc.  You never know what you’re going to need.  So I started over and created a particle that was also an emitter.

Next I wanted each particle to control its own animation, so I created an inherited class that controlled how it looped and started/died. The particles also had to move, so I created a force class and each particle could be affected by multiple physical forces, such as gravity and an engine.  Once all of those parts were attached to each particle I could achieve a fair amount of effects with little effort.  It was a fun task and I hope to have more like it in the future.  I always love delving into visual tasks that I’ve never had to do before.


Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: