Game Maker's Garage Forum

Game Creation => Code Exchange => Topic started by: Gan on March 01, 2012, 11:04:58 PM

Title: Particle Systems
Post by: Gan on March 01, 2012, 11:04:58 PM
Have any of you guys experimented with particle systems?

I've noticed, Terraria has some top notch particle effects. From sparks, to chopped up vines, to even fire and water!
Fascinating stuff, really bumps up a game's quality to a whole new level.

I've never experimented with making a particle system, would you think it'd be difficult?
Title: Re: Particle Systems
Post by: Connors on March 02, 2012, 06:43:31 PM
Well a simple particle effect isn't hard, it would make some objects with a random size and direction and if you want you make them affected by gravity. They don't need to be sprites unless they are large enough for you to tell or else they might lag more. It might be even faster to make only one particle object with a 2D array containing a row for each particle in an effect.
You already made one when you programmed the continuous laser in Space Marine, where it adds random dots at the end. But those don't move. I bet if you made that bigger and had it only  appear when the laser hit a zombie it would be an okay blood splat.
Title: Re: Particle Systems
Post by: x on March 02, 2012, 06:54:25 PM
The trick with a particle engine in not in the creation of particles, but the cleaning up and logistics of them. Luckily the language you will use will probably have a garbage collector. Thus the main problem you face is collisions; working out collisions for 100s-1000s of particles can really slow a game down.
Title: Re: Particle Systems
Post by: Connors on March 03, 2012, 12:07:24 AM
Well perhaps we won't bother with collisions for now. Unless the effect is pretty big that is. Maybe you could also draw the particles after the floor but before walls? But that would be hard because of the way the map draws.
 I'm thinking each separate effect like an explosion or splattering could be a particle object with an array for it's own particles. Garbage collection should be no problem.