Difference between revisions of "Particle Effects"
(Updated location of trail effect option location) |
m (Add documentation for optional parentheses.) |
||
Line 181: | Line 181: | ||
===Uniform random range=== | ===Uniform random range=== | ||
*This accepts 1 or 2 values. If one value is used then the random range always returns that value. If two values are specified then a uniformly distributed random value will be picked from the range. | *This accepts 1 or 2 values. If one value is used then the random range always returns that value. If two values are specified then a uniformly distributed random value will be picked from the range. | ||
− | *Syntax: '''(Random values)''', a list of floating point values. Either one or two values. | + | *Syntax: '''(Random values)''', a list of floating point values. Either one or two values. If only one value is specified then the parentheses are optional. |
**Example: ''(4 20)'' | **Example: ''(4 20)'' | ||
+ | **Example: ''4'' | ||
===Normal distribution random range=== | ===Normal distribution random range=== |
Revision as of 11:02, 9 February 2019
This feature requires FreeSpace Open |
Revision information.....
- FSO Git Commit: Date: 2016-09-02 SHA: 417eb20
Particle Effects is a SCP feature which allows to define custom particle effects that can be assigned to various engine properties.
This table is one of the Modular Tables and can be extended with xxx-part.tbm. This table type does not have a main table like the other types. All particle effects must be specified in modular tables. Currently there is no support for the usual +nocreate ability the other modular tables have but that will be added in the future. Parts of this documentation are written with with +nocreate in mind for when that is implemented.
Contents
General Info
- Begins with #Particle Effects
- Contains zero or more particle effect definitions
- Ends with #End
Particle effects are created by specifying a name and a type. The type dictates which values are valid and will be described below.
$Effect:
- Creates a new effect and specifies its name. The name must be at least one character long.
- Syntax: String
$Type:
- Sets the type of this effect. See Effect Types for possible values.
- Syntax: String
Effect Types
There are multiple different types of effects. They are specified by passing the given name to $Type.
Single
This effect type creates exactly one particle per processing step.
+Filename:
- Sets the filename of the animation that should be used.
- Required if +nocreate wasn't used
- Syntax: String, filename
+Size:
- Sets the size of the created particles. This is a uniformly distributed random range, see #Uniform random range.
- Required if +nocreate wasn't used
- Syntax: See #Uniform random range
+Lifetime:
- Sets the life time of the particles. This is a uniformly distributed random range, see #Uniform random range, or the string <none> in which case the runtime of the animation is used. Defaults to <none>.
- This is optional
- Syntax: See #Uniform random range, or the string <none>
+Duration:
- Sets for how long this effect will be active. The duration can be once, always or a random range. If the effect should run only once then you can use the string Onetime. If the effect should always be active you can specify the string Always. Otherwise a non-negative random range is expected.
- This is optional
- Syntax: Onetime, Always, or a #Uniform random range.
+Delay:
- Specifies after how much time after the effect is triggered the effect starts creating particles. This is not a valid option if the duration is Onetime.
- This is optional
- Syntax: See #Uniform random range, or the string <none>
Composite
A composite effects contains multiple other effects which are all displayed at the same time. This is useful if you want to create complex effects that require more than one individual particle effect. The amount of child effects is not limited. This type currently does not support +nocreate.
+Child effect:
- This specifies a child effect that should be added to the composite effect. The effect is specified using #Inline effect creation.
Cone
This effects creates multiple particles which travel in a cone around a specific direction. The particles are created in a normal distribution around the direction vector. That means that more particle are created along the direction vector than far away from it. The velocity of a particle is scaled based on the angle it is away from the direction vector. This may be changed in the future to allow different effects.
+Filename:
- Sets the filename of the animation that should be used.
- Required if +nocreate wasn't used
- Syntax: String, filename
+Size:
- Sets the size of the created particles. This is a uniformly distributed random range, see #Uniform random range.
- Required if +nocreate wasn't used
- Syntax: See #Uniform random range
+Lifetime:
- Sets the life time of the particles. This is a uniformly distributed random range, see #Uniform random range, or the string <none> in which case the runtime of the animation is used. Defaults to <none>.
- This is optional
- Syntax: See #Uniform random range, or the string <none>
+Deviation:
- Sets the standard deviation from the direction vector.
- Required if +nocreate is not present
- Syntax: float, in degrees
+Velocity
- Sets the velocity of the created particles. This is a #Uniform random range.
- Required if +nocreate is not present
- Syntax: See #Uniform random range
+Number
- Sets the amount of particles created for every frame the effect is active. This is a #Uniform random range.
- Required if +nocreate is not present
- Syntax: See #Uniform random range
+Direction
- Sets the direction the cone will be centered around. Can be one of:
- Incoming: The direction vector is the direction of the particle source, e.g. for a weapon this would be the orientation it is currently facing.
- Normal: The normal vector of the particle source. This data may not exist for all sources. The debug log file will contain the warning message "Effect '<EffectName>' tried to use normal direction for source without a normal!" if an effect tries to use the normal vector without it existing.
- Reflected: The reflected vector from incoming and normal vector. This is a good way of simulating armor deflecting a shot. This direction requires the normal for work properly so the same warning message as above may appear in your log if the source has no normal vector assigned to it.
- Reverse: The reverse of the incoming vector
- Optional
- Syntax: String, one of the strings specified above
+Duration:
- Sets for how long this effect will be active. The duration can be once, always or a random range. If the effect should run only once then you can use the string Onetime. If the effect should always be active you can specify the string Always. Otherwise a non-negative random range is expected.
- This is optional
- Syntax: Onetime, Always, or a #Uniform random range.
+Delay:
- Specifies after how much time after the effect is triggered the effect starts creating particles. This is not a valid option if the duration is Onetime.
- This is optional
- Syntax: See #Uniform random range, or the string <none>
+Trail effect:
- Sets the particle effect used for the trail of the created particles. This option uses #Inline effect creation.
- Optional
- Syntax: See #Inline effect creation.
Sphere
This effect creates particles in a sphere shape around the center.
+Filename:
- Sets the filename of the animation that should be used.
- Required if +nocreate wasn't used
- Syntax: String, filename
+Size:
- Sets the size of the created particles. This is a uniformly distributed random range, see #Uniform random range.
- Required if +nocreate wasn't used
- Syntax: See #Uniform random range
+Lifetime:
- Sets the life time of the particles. This is a uniformly distributed random range, see #Uniform random range, or the string <none> in which case the runtime of the animation is used. Defaults to <none>.
- This is optional
- Syntax: See #Uniform random range, or the string <none>
+Velocity
- Sets the velocity of the created particles. This is a #Uniform random range.
- Required if +nocreate is not present
- Syntax: See #Uniform random range
+Number
- Sets the amount of particles created for every frame the effect is active. This is a #Uniform random range.
- Required if +nocreate is not present
- Syntax: See #Uniform random range
+Direction
- Sets the direction the cone will be centered around. Can be one of:
- Incoming: The direction vector is the direction of the particle source, e.g. for a weapon this would be the orientation it is currently facing.
- Normal: The normal vector of the particle source. This data may not exist for all sources. The debug log file will contain the warning message "Effect '<EffectName>' tried to use normal direction for source without a normal!" if an effect tries to use the normal vector without it existing.
- Reflected: The reflected vector from incoming and normal vector. This is a good way of simulating armor deflecting a shot. This direction requires the normal for work properly so the same warning message as above may appear in your log if the source has no normal vector assigned to it.
- Reverse: The reverse of the incoming vector
- Optional
- Syntax: String, one of the strings specified above
+Duration:
- Sets for how long this effect will be active. The duration can be once, always or a random range. If the effect should run only once then you can use the string Onetime. If the effect should always be active you can specify the string Always. Otherwise a non-negative random range is expected.
- This is optional
- Syntax: Onetime, Always, or a #Uniform random range.
+Delay:
- Specifies after how much time after the effect is triggered the effect starts creating particles. This is not a valid option if the duration is Onetime.
- This is optional
- Syntax: See #Uniform random range, or the string <none>
+Trail effect:
- Sets the particle effect used for the trail of the created particles. This option uses #Inline effect creation.
- Optional
- Syntax: See #Inline effect creation.
Inline effect creation
At some places in this table a particle effect may be created within another particle effect. This is used for composite effects and particle trails. If inline creation is valid for an option then you may either specify a name of a previously defined effect or use $New Effect which will create a new, unnamed effect. If a name is specified then that effect must be already defined. In order to ensure that the effect is always defined no matter in which order the effect tables are parsed the effect should be defined in the same table. Some options using this construct require a specific type of effect. That will be noted in the documentation of the option.
If $New Effect is used then a new unnamed effect is created. If the surrounding option has not forced an effect type then you can specify it using the standard syntax described above. All options are the same as if the effect would have been parsed in the normal way. +nocreate is not valid within this element.
Random range
The particle effect system uses randomization to provide variation to the created particles. This is implemented by letting the mod author specify the values for the random distribution. There are different types of distributions which are explained below.
Uniform random range
- This accepts 1 or 2 values. If one value is used then the random range always returns that value. If two values are specified then a uniformly distributed random value will be picked from the range.
- Syntax: (Random values), a list of floating point values. Either one or two values. If only one value is specified then the parentheses are optional.
- Example: (4 20)
- Example: 4
Normal distribution random range
- This accepts 1 or 2 values. This random range generates values according to a normal distribution. The first value specified the mean value of the distribution. The second value specifies the standard deviation of the distribution, this defaults to 1.
- Syntax: (Random values), a list of floating point values. Either one or two values.
- Example: (4 20)
Example
#Particle Effects $Effect: MassDriverImpact $Type: Cone +Filename: exp05 +Size: (5 7) +Lifetime: (0.6) +Deviation: 5 +Velocity: (500 700) +Number: (20 30) +Direction: Reflected +Trail effect: $New Effect $Type: Single +Filename: exp20 +Size: (10) +Lifetime: (1) +Duration: Always $Effect: ApocalypseIgnition $Type: Single +Filename: exp20 +Size: (10 20) $Effect: ApocalypseHomed $Type: Composite +Child effect: $New Effect $Type: Single +Filename: exp05 +Size: (5 7) +Duration: (2 10) +Child effect: $New Effect $Type: Single +Filename: exp06b +Size: (5 7) +Duration: (2 10) +Delay: (8 15) #End