Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Script / Particle Editor] About Particle System Behavior
TheGreatCthulhu Offline
Member

Posts: 213
Threads: 10
Joined: Oct 2010
Reputation: 32
#1
[Script / Particle Editor] About Particle System Behavior

I have a pretty good grasp of the Particle Editor, but I noticed something interesting. I've created this billowing smoke particle system (for the sake of experimentation), and when I use it ingame, and call the DestroyParticleSystem() function on it, the result is different depending on when the function was invoked.
There is a certain time period (about 5s, which is also (coincidentally?) the lifetime of the particles) during which the PS sprouts a bunch of particles, as if they accumulated "inside" it before the PS was created.
During this time, the call to DestroyParticleSystem() works, but the effect is delayed until this sprout period is over. On the other hand, if I wait for this to end (as I said, about 5s, and you can tell by the fact that after it occasional gaps begin to appear between the emitted particles), and then invoke DestroyParticleSystem(), the effect is instantaneous.
Why is this the case? Can this behavior be changed, or is it hard-coded into the engine?
I've attached the .ps file below, so that you can try it out yourself.


Attached Files
.rar   smoke.rar (Size: 1.07 KB / Downloads: 69)
12-01-2012, 09:52 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: [Script / Particle Editor] About Particle System Behavior

It's more realistic the way DestroyParticleSystem works, simply stopping the (re)spawning of the particles and letting the lifetime of the particle do the rest, especially if we're talking about smoke.

Tutorials: From Noob to Pro
12-01-2012, 11:30 PM
Website Find
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#3
RE: [Script / Particle Editor] About Particle System Behavior

I'm not sure if I understand exactly, but DestroyParticleSystem only stops fresh particles from spawning, as far as I know. Existing particles will stay there until their lifespan is over.

12-02-2012, 12:12 AM
Find
TheGreatCthulhu Offline
Member

Posts: 213
Threads: 10
Joined: Oct 2010
Reputation: 32
#4
RE: [Script / Particle Editor] About Particle System Behavior

No, you didn't understand what I was trying to say. I don't want all the particles to simply disappear. The problem is that there is a period where spawning doesn't stop.

The particle system appears to be implemented to work this way: particles are spawned at a certain rate untill Max Particles value is reached; each particle has a lifetime (set on the Life tab), and the lifetime of each particle starts when it's spawned.
Particles are spawned untill MaxParticles value is reached, and then the "normal", rate-based spawning stops; however, if Respawn Dead Particles checkbox is checked, once the particle dies, it will be respawned from the emitter at the rate the particles die (and they can have different lifetimes - hence the small "spawn-gaps" in my PS).

Now, if I call DestroyParticleSystem() before Max Particles is reached, it basically has no immediate effect - it just stops dead particles from respawning.
If I do it after Max Particles is reached, the emitter stops spawning new particles instantly (and the existing ones just drift away).

P.S. BTW, what I did in the test map was: I hooked up a lever so that one state creates, and the other destroys the PS on an entity. The effect can be observed if you do a create-destroy "move" - it doesn't have to be too fast. Within the first 4-5 seconds.
(This post was last modified: 12-02-2012, 12:51 AM by TheGreatCthulhu.)
12-02-2012, 12:44 AM
Find




Users browsing this thread: 1 Guest(s)