Game Development Community

Particle Emitter lifetime error

by Eric Hartman · in Torque Game Engine · 08/22/2002 (12:32 am) · 5 replies

I'm getting a strange bug where the lifetimeMS property of some particle emitters seems to be forgotten.

I have an explosion with 2 particle emitters, both of which have an ejectionperiodMS of 1 and a lifetimeMS of 10. When i run the game, the lifetime of the emitters seems to be 1000 or so as it creates a fountain of particles. But if i exec the .cs file manually in the console, the lifetime is fixed but the next time i run the game its back to being messed up. Deleting the .dso's doesn't help.

#1
08/22/2002 (12:53 am)
Are you making sure to exec the script which makes these emitters in one of your other scripts or in main.cs or init.cs ?
#2
08/22/2002 (1:11 am)
i have it exec'd in the same place i have all my other scripts: onServerCreated() in game.cs

its definitely executing them there because i can change the color of the particles but it ignores any changes in lifetime until i execute it manually.
#3
08/22/2002 (4:32 pm)
I started over by copying and renaming the rifle explosion stuff and i'm getting the same result. Its not just the lifetime either, the drag coefficient changes too. Something must change in the way particle datablocks are interpreted between the onServerCreated() function and the time the game actually starts.
#4
08/22/2002 (4:43 pm)
This is surely is a bug in the engine as i havent changed anything code wise and when i execute the script from the console, it says "loading compiled script..." yet the particle effects change!
#5
08/22/2002 (8:52 pm)
ok try this: in the fps test app, fps/server/scripts/rifle.cs

under datablock ParticleData(RifleExplosionParticle)
change dragCoefficient to 100.
under datablock ParticleEmitterData(RifleExplosionEmitter)
change ejectionVelocity to 100.


The explosion particles should shoot quickly but stop very quickly because of the high drag.
Now run torqueDemo.exe -mod fps and start the waterworld mission. Get the rifle and shoot. The particles fly way off because the dragcoefficient isnt being properly updated. Now type exec("fps/server/scripts/rifle.cs"); in the console and shoot again. The particles now behave as they should.

At least, this is what happens on my machine. Someone please try this and see if i'm an idiot or not.