Particle System


Tremulous Particle System

 

Files matching the pattern scripts/*.particle are loaded as particle system description files. Each .particle file can contain an arbitrary number of discrete particle systems, much like a .shader file can house many shaders. A particle system is declared by a name followed by curly braces within which the functionality of the particle system is defined. For example:

 

aShinyNewParticleSystem { } 

 

Inside the particle system declaration are placed up to four particle ejectors. Ejectors are identified by the keyword ejector and curly braces:

 

aShinyNewParticleSystem

{

 

ejector { }

 

ejector { }

 

thirdPersonOnly

 

}

 

The thirdPersonOnly keyword may be used to specify that the particle system is not visible from the first person if it relates to that client. The role of the particle ejector is to create some number of new particles at a defined rate. These attributes are controlled by the following parameters:

 

 

It is perfectly acceptable to have an initial period of zero. In this case the number of particles specified by the count keyword will be ejected at once. It is not permissible to have count infinite and a period of zero for obvious reasons.

 

At ejection time each ejector creates up to four new particles based on templates. These are specified in the ejector section using the particle keyword:

 

aShinyNewParticleSystem

 

{

 

ejector

 

{

 

particle { }

 

particle { }

 

count 50

 

delay 0

 

period 0 - 0

 

}

 

}

 

Each particle template has a number of attributes:

 

 

Except for vector components, shader fps ... and period <initial <final> <variance>, every value can be specified with a random variance. The syntax for this is as follows:

 

 [value][variance[%]] 

 

So the following forms are possible, where random is a random number between 0.0 and 1.0 inclusive:

 

    5.0      // 5.0

 

5.0~8.0 // 5.0 + ( random * 8.0 )

 

5.0~200% // 5.0 + ( random * 5.0 * 200% )

 

~7.0 // random * 7.0

 

This allows for relatively fiexible randomisation of most of the particle’s parameters. For parameters taking an initial and final value, specifying the final value as ’-’ will result in a final value the same as the initial value.

 

For the purposes of map based particle systems using misc_particle_system it is safe to ignore velocityType and accelerationType tag|cent|normal, normalDisplacement and parentVelocityFraction altogether.

 

Of course, it is not necessary to specify every parameter documented here for every particle system. If a parameter is not included it will usually default to zero. C/C++ style comments can be used throughout. There are an enormous number of possible combinations of particle systems parameters and as such it is impractical to test them all. For this reason it is possible that certain permutations do not behave as expected or wrongly. In this case you may have discovered a bug - let us know. Having said this when you’re having problems with a particle system make sure you scroll up the console and check that it compiled OK, I’ve written the parser to be very intolerant of error.

 

Here is an example particle system:

 

   aShinyNewParticleSystem

 

{

 

ejector

 

{

 

particle

 

{

 

shader sync shader1 shader2

 

 

 

velocityType static

 

velocityDir linear

 

velocityMagnitude 200

 

velocity 0 0 1 ~30

 

accelerationType static

 

accelerationDir linear

 

accelerationMagnitude 50

 

acceleration 0 0 1 ~0

 

radius 0 10.0 50.0

 

alpha 0 1.0 1.0

 

rotation 0 ~360 -

 

bounce 0.4

 

lifeTime 1500

 

}

 

count 50

 

delay 0

 

period 0 - 0

 

}

 

}