Script exec bug?
by JP · in Torque Game Engine · 12/17/2008 (6:43 pm) · 2 replies
I cannot for the life of me figure out why this is happening. I have several particle emitters that will not display correctly unless I exec the script files after I get into the game. For example, I have a shockwave particle that only goes out a fraction as far as a should, but if I open the console and exec the script file from there then the shockwave goes as far as it's suppose to. I tried to just exec the script files again once a client enters the game, but while this works for the host, it doesn't work for clients connecting to the server. Does anyone have any idea why this is happening or how I can fix it?
Associate Jeff Faust
Faust Logic, Inc.
If you look at the packData() methods for ParticleData and ParticleEmitterData, you'll see that they both transmit a number of their parameters at a reduced bit resolution. For example, ejectionOffset, which is an F32, is multiplied by 100, converted to an S32, and packed as a 14 bit value. This will be reversed in the unpack, but with a loss of some resolution.
Now it's also the case, that if you re-load the same datablocks later, you will sidestep the pack/unpack process for a local client and the values used will keep their original resolution.
I've seen this before with the particle color parameters, especially when going for something nearly transparent and setting a low alpha. The nearly transparent particles will be truncated to invisible until I exec the script containing them, and suddenly they appear.
In your case, one or more of your preferred parameter settings may be getting clipped or quantized when packed and unpacked. If this is the case, then you'll need to find different settings that work or edit some key writes and reads in the packData()/unpackData() methods to increase their transmitted bit resolution.