Game Development Community

Particle lifetime broken in beta2?

by WDDG · in Torque Game Builder · 03/26/2006 (9:07 pm) · 5 replies

Hey guys, I think there's a (probably small issue), with beta 2. I was previously in beta 1.1 was setting particle effect lifetime to 0.1, so that it would die as soon it's particles died. However in beta2 the effect starts and dies almost instantly (0.1 seconds later to be exact), killing the emitted particles before they finish animating.

I am pretty sure that this is a bug, as I remember Melv stating how an effect won't die until all it's particles are cleared (I believe he was explaining to someone why they had a large parfree number).

Is there any small fix I can change in the engine. I don't mind re-compiling it.

--

Also overall the performance of the particle engine seems to have degraded for some reason. For example, i'm seeing a drop from 230fps to 180fps when I explode an object in the game that emits ~75 [very small] particles.

Pretty sure that's new.

#1
03/26/2006 (11:19 pm)
As far as I know, there haven't been any changes to the particle engine for quite a while now, certainly not between beta#1/#2 or at least none that I can remember.

Could you be more specific on what you mean by "setting particle effect lifetime to 0.1"? Are you talking about one of the effect or emitter particle-life fields? Perhaps the "setEffectLifeMode()" or "setLifetime()"?

- Melv.
#2
03/27/2006 (7:08 am)
I was using setLifetime(0.1), in my initemitter function. Perhaps i'm doing it the wrong way and it just happened to be working before?
#3
03/27/2006 (11:38 am)
James,

Well, "setLifetime()" had a bug in it which meant that gave odd behaviour, it's possible this was giving you seeming good results before although this was fixed before the beta#1 so I'm not sure really.

The "setLifetime()" call will destroy the effect and any particles currently activated after 0.1 seconds, period. It won't wait for anything to happen before it does this, it'll stop creating particles after 0.1 seconds have elapsed and let the ones that are active, live out their life. The number of active particles will be dependant upon your emissions settings, e.g. particles/sec so you should get 1/10th of this value.

Using objects for such short lifetimes is extremely inefficient and problematic though. You should consider creating a particle that does this using its graphs e.g. without having to kill it. At least this way you can reuse it again and again and you'll get consistent results.

- Melv.
#4
03/27/2006 (3:28 pm)
Quote:
The "setLifetime()" call will destroy the effect and any particles currently activated after 0.1 seconds, period. It won't wait for anything to happen before it does this, it'll stop creating particles after 0.1 seconds have elapsed and let the ones that are active, live out their life.

Are you referring to some other method in the second part of that paragraph? Seems like a contradiction. That it destroys any particles active, yet also allows the ones that are active to live their life.
#5
03/27/2006 (11:19 pm)
James,

What I was referring to was that the point at which it will start the destroy process is independant of what the particle effect is doing at the time. In this case, after the elapsed time, it will pause the effect (stopping any new particles) and then wait for the existing ones to complete at which point it will destroy the object.

With less than 6 hours sleep in the last two days, I'm lucky to even be able to think about particles, never mind discuss them with others. ;)

- Melv.