Game Development Community

Particle engine changes, thoughts on usefulness

by Max Robinson · in Torque Game Engine Advanced · 08/18/2006 (5:44 pm) · 10 replies

Hello.

I've been using some features that I like to put on my particle engine for some time now, and it just hit me that others may be interested in them. They are fairly low overhead memory wise though they do extend datablock size.

Here is a short but comprehensive list:

- Ability to specify velocity and offset (incl. variance) based on X,Y,Z axes inherited from emitter's transform. Handy for engine emitters on square/rectangle engines, plus other strange uses.

- "Decay": particle can be given % chance to spawn another particle at a certain % of its lifetime. Handy for explosions with fire that turns into smoke - the smoke is in the same shape as the fire! This requires an additional bool on the particle structure.

- Multiple particles per emitter, with wieghting. Lets you cut down on emitter datablocks, saves a bit of time with organization, and also lets you load more particleDatas on one explosion (wee!)

- per-particle spinBase which fixes a visual problem caused by 50 particles starting at the same rotation and then fanning out as they rotate. This could be skipped since it adds one U32 to the particle structure.

That's really it. Since TSE wants prepared vertex/index buffers, I implemented the multiple particleDatas (decay + multiple listed emitters) using a link list structure where each particleData has its own set of buffers (sized realistically, etc). In theory it could handle an infinite number of particleDatas, each which lead to a decay series of an infinite number of particles. I'm not saying your computer can handle that, though.

Any interest? GG? I can make some cool videos of explosions if you want :)

#1
08/18/2006 (10:27 pm)
Max, I'm interested! Drop me a line at tima@garagegames.com and we should talk :)
#2
08/19/2006 (11:11 am)
I'd be interested in what you have put together, unless there is plans for GG to eventually put this in TSE "natively"

Send me a note! :) byteasc@gmail.com
#3
08/19/2006 (11:23 am)
I'm very interested as well. The game my team is working on has immediate uses for everything you listed.

Drop me a line at trajan@clancore.net please
#4
08/19/2006 (12:19 pm)
Sounds interesting max.. wouldnt mind seeing the vids either :)
#5
08/19/2006 (8:49 pm)
I always love to show stuff off :)

Here's a vid of 3 explosions. First is a vehicle explosion, it'd be accompanied by flaming debris etc if I were to finish up the thing and have a vehicle actually explode of course. The smoke is probably dissapating a bit too fast. The second explosion is a large missile explosion. The smoke is really nice, I only show it against the ground but it looks great against other backgrounds too - there's a mix of grey and blackish due to different lifetimes. This shows the "smoke in the shape of the fireball" feature well, since the missile explosions can be pretty lopsided. The third is a large mortar explosion, sort of a incendiary or something, there's a big rising fireball as well as an expanding ring of fire at the base. I need to improve the texture I use for the fire here. This explosion would be much harder to make without the changes, since the nonspherical velocity/offsets simplify the shaping and the decay feature lets you match the smoke up correctly without any wierdness.

Anyway, the vid:
www.echelon5.net/max/talon_explosions_tse3_XVID.avi


edit:

Anyway, wow I just remembered.

I would just go ahead and make this a resource, but I sort of wanted someone who knew how the particle engine works well to see if what I did was optimal. In it's current state TSE's particle engine seems only partially stable and I didn't want to post something that'd mess stuff up. I've not had any crashes specifically related to it on my setup but I do have TSE crash fairly often so I never feel entirely comfortable with any of the changes I've had to make :P
#6
08/20/2006 (5:23 am)
Very nice expolsions :-).

I'd be interested in seeing this please contact me at, silencersoft@hotmail.com and I'll give it a go :-).
#7
08/20/2006 (11:17 am)
Very cool Max, please count us in too... we can certainly help test & optimize. jkanalakis@envygames.com
#8
08/20/2006 (12:32 pm)
I'll post this as a resource then.

Edit: I totally forgot the best feature I added.

I also added an "initialParticle" field. The emitter will spawn this many particles when it first is added. You can use ejectionPeriodMS = 0 to turn off periodic emission and instead just use a "burst" of particles, which looks many times better for explosions in my opinion.

Edit again:

resource: www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=11121

The changes are minimal but its not "plug and play". You'll need to read the italicized NOTE: bit at the beginning and the second section if you want TSE to compile again. :)
#9
08/20/2006 (1:11 pm)
Wow!!! Looks great hoping the resource will up soon :) Thanks for sharing!!!
Keep up the good work!
#10
08/20/2006 (1:41 pm)
Looks pretty sweet. Be fantastic if it gets integrated or even released as a resource.

EDIT: I think I'm blind. Missed the resource link 2 posts or so above.