The Glest Wiki
(Linked particles)
No edit summary
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
  +
{{XMLs}}
The Projection [[Particle]] XML defines the visual effects as well as part of the mechanics used to for ranged attacks between units.
 
  +
The Projection [[Particle]] XML defines the visual effects as well as part of the mechanics used to for attacks between [[units]].
<?xml version="1.0" standalone="yes"?>
 
  +
<projectile-particle-system>
 
  +
{{TOC limit|2}}
<font color="green">&lt;!-- A bitmap file used to map the alpha of the particles. --&gt;</font>
 
  +
<texture value="true" luminance="true|false" path=".../texture_name.bmp"/>
 
  +
==XML==
<font color="green">&lt;!-- Model used as the projectile. --&gt;</font>
 
  +
{{XML_definition_header}}
<model value="true|false" path=".../model_name.g3d"/>
 
  +
<syntaxhighlight lang="xml">
<primitive value="line|quad"/>
 
  +
<?xml version="1.0" standalone="yes"?>
<offset x="0" y="0.2" z="1"/> <font color="green">&lt;!-- Offset the origin of the attack; +X is to the right of the attacker, +y is
 
  +
<projectile-particle-system>
above the attacker, +z is to the front of the attacker. Make no difference
 
  +
<texture value="true" luminance="true" path="texture_name.bmp"/>
to the endpoint --&gt;</font>
 
  +
<model value="true" path="model_name.g3d"/>
<font color="green">&lt;!-- Starting color/transparency, ranges from 0-1 --&gt;</font>
 
  +
<primitive value="quad"/>
<color red="1.0" green="0.5" blue="0.0" alpha="0.5" />
 
  +
<mode value="normal"/>
<font color="green">&lt;!-- Ending Color, same range --&gt;</font>
 
<color-no-energy red="0.0" green="0.0" blue="0.0" alpha="0.2" />
+
<offset x="0" y="0.2" z="1"/>
  +
<color red="1.0" green="0.5" blue="0.0" alpha="0.5" />
<size value="6" /> <font color="green">&lt;!-- size of texture when particle is created --&gt;</font>
 
  +
<color-no-energy red="0.0" green="0.0" blue="0.0" alpha="0.2" />
<size-no-energy value="4" /> <font color="green">&lt;!-- size of texture when particle has emitted all energy --&gt;</font>
 
  +
<size value="6" />
<speed value="0" /> <font color="green">&lt;!-- The speed (distance moved really) of the particle over their lifetime --&gt;</font>
 
  +
<size-no-energy value="4" />
<gravity value="0"/> <font color="green">&lt;!-- How much particles are effected by gravity --&gt;</font>
 
  +
<speed value="0" />
<emission-rate value="1" /> <font color="green">&lt;!-- The amount of particles emitted --&gt;</font>
 
  +
<gravity value="0"/>
<energy-max value="20" /> <font color="green">&lt;!-- Maximum Energy --&gt;</font>
 
  +
<emission-rate value="1" />
<energy-var value="0" /> <font color="green">&lt;!-- Variation --&gt;</font>
 
  +
<energy-max value="20" />
 
  +
<energy-var value="0" />
<font color="green">&lt;!-- The following trajectory type definitions are mutually exclusive --&gt;</font>
 
  +
<!-- Start MG Only -->
 
<trajectory type="linear">
+
<child-particles value="true">
  +
<particle-file path="particle.xml">
<speed value="14"/> <font color="green">&lt;!-- Speed of the projectile - negative values and 0 have interesting, but not
 
  +
<offset x="0.5" y="0.5" z="0"/>
terribly useful effects. Bug Notice: currently, in both Glest 3.1.2 and GAE
 
  +
<radius value="0.1"/>
0.2.8a, very high values for speeds may cause the engine to fail to detect a
 
  +
<size value="0.1"/>
collision, resulting in an attack that both appears visually wrong and will
 
  +
<gravity value="0"/>
not always (or ever) harm their intended targets. --&gt;</font>
 
  +
<direction x="0" y="0" z="-2"/>
</trajectory>
 
  +
</particle-file>
 
  +
</child-particles>
<font color="green">&lt;!-- or --&gt;</font>
 
  +
<!-- End MG Only -->
 
  +
<trajectory type="parabolic">
 
  +
<trajectory type="linear">
<speed value="16"/> <font color="green">&lt;!-- Speed of the projectile --&gt;</font>
 
  +
<speed value="14"/>
<scale value="2.5"/> <font color="green">&lt;!-- Height of the parabolic arc --&gt;</font>
 
  +
<!-- Start GAE Only -->
</trajectory>
 
  +
<start value="self"/>
 
  +
<start-offset x="0" y="0" z="0"/>
<font color="green">&lt;!-- or --&gt;</font>
 
  +
<start-offset-var x="0" y="0" z="0"/>
 
  +
<end value="target"/>
<trajectory type="spiral">
 
  +
<end-offset x="0" y="0" z="0"/>
<speed value="4.0"/>
 
  +
<end-offset-var x="0" y="0" z="0"/>
<scale value="1"/> <font color="green">&lt;!-- Width of the spiral --&gt;</font>
 
  +
<tracking value="false"/>
<frequency value="0.5"/> <font color="green">&lt;!-- How often the spiral, uh, spirals --&gt;</font>
 
  +
<!-- End GAE Only -->
</trajectory>
 
  +
</trajectory>
 
  +
<trajectory type="parabolic">
</projectile-particle-system>
 
  +
<speed value="16"/>
 
  +
<scale value="2.5"/>
Back to [[XML_Definitions]]
 
  +
<!-- Start GAE Only -->
  +
<start value="self"/>
  +
<start-offset x="0" y="0" z="0"/>
  +
<start-offset-var x="0" y="0" z="0"/>
  +
<end value="target"/>
  +
<end-offset x="0" y="0" z="0"/>
  +
<end-offset-var x="0" y="0" z="0"/>
  +
<tracking value="false"/>
  +
<!-- End GAE Only -->
  +
</trajectory>
  +
<trajectory type="spiral">
  +
<speed value="4.0"/>
  +
<scale value="1"/>
  +
<frequency value="0.5"/>
  +
<!-- Start GAE Only -->
  +
<start value="self"/>
  +
<start-offset x="0" y="0" z="0"/>
  +
<start-offset-var x="0" y="0" z="0"/>
  +
<end value="target"/>
  +
<end-offset x="0" y="0" z="0"/>
  +
<end-offset-var x="0" y="0" z="0"/>
  +
<tracking value="false"/>
  +
<!-- End GAE Only -->
  +
</trajectory>
  +
<!-- Start GAE Only -->
  +
<trajectory type="random">
  +
<speed value="100.0"/>
  +
<scale value="0.3125"/>
  +
<frequency value="8"/>
  +
<start value="target"/>
  +
<start-offset x="0" y="30" z="0"/>
  +
<start-offset-var x="4" y="0" z="4"/>
  +
<end value="target"/>
  +
<end-offset x="0" y="0" z="0"/>
  +
<end-offset-var x="0" y="0" z="0"/>
  +
<tracking value="true"/>
  +
</trajectory>
  +
<blend-mode src="mode" dest="mode"/>
  +
<blend-equation mode="mode"/>
  +
<!-- End GAE Only -->
  +
</projectile-particle-system>
  +
</syntaxhighlight>
  +
  +
==Documentation==
  +
[[File:Luminance.png|thumb|Comparison of luminance on and off, using the texture at the top-right corner.]]
  +
===texture===
  +
Particles can use textures to shape how the particles should look. If luminance is turned on, the image file used as a texture will simply work to define the intensity of the colors. If luminance is turned off, the colors in the image file will be used in the particle. The path is the path to the image.
  +
  +
===model===
  +
If true, the path to the model which will be used as the attack projectile. Animated models will only show the last frame.
  +
  +
===primitive===
  +
Particles have two methods of creation: either <tt>quad</tt> (renders a set of four particles in a dot style) or <tt>line</tt> (creates solid lines). Quad is the most commonly used, as it creates the fuzzy style of particles that would be used for flames, explosions, smoke, etc, while lines are generally only used for projectiles such as an arrow. Note that you cannot have more than one particle effect linked to a projectile or splash (though you can for unit particle effects) yet, so it is not possible to mix particles (such as a line and flaming particles for a flaming arrow).
  +
  +
===mode===
  +
Particles have two modes of rendering, either <tt>normal</tt> which uses colors, or as <tt>black</tt> which allows the usage of black particles. If not specified, it defaults to normal.
  +
  +
===color and color-no-energy===
  +
If luminance is off, the colors of the texture will be used to color the particles. If luminance is on, the colors defined in the XML are used, though the intensity and shape will be defined by the texture. There are two colors values, the first which is the color at the start of the particle's life, and the second which defines the color when the particle is dead. Thus, the particles can transition in color. Colors are rendered by mixing red, green, and blue, as well as you can set the alpha channel. Each parameter is from 0 - 1, where 1 means there is 100% of that color. With the alpha, 1 would mean the color is almost completely transparent while 0 would be completely opaque.
  +
  +
===size and size-no-energy===
  +
While the shape - and thus some degree of the size - is defined by the texture, the size is also affected by the size parameter passed into the XML, which will define the size in game units. Like the color, there are two size values that define the starting and ending sizes. As a result, the particles can seem to shrink or grow over their life.
  +
  +
===gravity===
  +
Glest has a simple gravity system which can also cause particles to sink downwards - or float upwards - over their life. The value is the degree of sink - or in the case of a negative number, the degree of rise.
  +
  +
===trajectory===
  +
There are four types of trajectories, <tt>linear</tt> (straight line), <tt>parabolic</tt> (arc), <tt>spiral</tt> (spinning spiral), and <tt>random</tt> (projectile arcs from multiple points in random directions, eg: lightning).
  +
====Table of trajectory values by type====
  +
{| class="wikitable"
  +
! Type of trajectory
  +
! Element
  +
! Description
  +
|-
  +
| linear
  +
| speed
  +
| How fast the particle moves. Note that speed values over 25 without a splash will nearly always miss due to a bug.
  +
|-
  +
| rowspan="2" | parabolic
  +
| speed
  +
| How fast the particle moves. Note that speed values over 25 without a splash will nearly always miss due to a bug.
  +
|-
  +
| scale
  +
| The angle of the parabola. Higher numbers means it will arc more. For example, with 90, it would shoot almost straight up.
  +
|-
  +
| rowspan="3" | spiral
  +
| speed
  +
| How fast the particle moves. Note that speed values over 25 without a splash will nearly always miss due to a bug.
  +
|-
  +
| scale
  +
| The angle of the parabola. Higher numbers means it will arc more. For example, with 90, it would shoot almost straight up.
  +
|-
  +
| frequency
  +
| How many times the spiral will spiral around.
  +
|-
  +
| rowspan="3" | random
  +
| speed
  +
| How fast the particle moves.
  +
|-
  +
| scale
  +
| The degree of angle (in decimal form) that must be changed at each "joint".
  +
|-
  +
| frequency
  +
| How many "joints" the projectile will have. At each "joint", it will change direction in a random way.
  +
|-
  +
| rowspan="7" | Any of the above (GAE Only, all optional)
  +
| start
  +
| Can be either <tt>self</tt> or <tt>target</tt>. Where the projectile starts. Default is self.
  +
|-
  +
| start-offset
  +
| Specify an offset from where the attack starts. Measurements are cells in the game's 3D grid.
  +
|-
  +
| start-offset-var
  +
| Allows you to randomize the offset of the start location of the attack.
  +
|-
  +
| end
  +
| Can be either <tt>self</tt> or <tt>target</tt>. Where the projectile ends. Default is target.
  +
|-
  +
| end-offset
  +
| Specify an offset from where the attack ends. Measurements are cells in the game's 3D grid.
  +
|-
  +
| end-offset-var
  +
| Allows you to randomize the offset of the end location of the attack.
  +
|-
  +
| tracking
  +
| If true, the particle will change course to follow its target. Default is false.
  +
|}
  +
  +
<!-- Current progress -->
  +
  +
===blend-mode===
  +
[[GAE]] supports choosing the OpenGL blend mode of the particles, allowing you to set the source and destination blending from these possible options:
  +
  +
*zero
  +
*one
  +
*src_color
  +
*one_minus_src_color
  +
*dst_color
  +
*one_minus_dst_color
  +
*src_alpha
  +
*one_minus_src_alpha
  +
*dst_alpha
  +
*one_minus_dst_alpha
  +
*constant_color
  +
*one_minus_constant_color
  +
*constant_alpha
  +
*one_minus_constant_alpha
  +
*src_alpha_saturate
  +
  +
The destination cannot be set to 'src_alpha_saturate'. If none is selected, the default is equal to the source being 'src_alpha' and the destination being 'one'.
  +
  +
===blend-equation (GAE only)===
  +
[[GAE]] supports choosing the blending equation from these possible options:
  +
  +
*func_add
  +
*func_subtract
  +
*func_reverse_subtract
  +
*min
  +
*max
  +
  +
The default is 'func_add'.
  +
  +
==See also==
  +
*[[XMLs]]
  +
*[[Particles]]
  +
*[[MegaGlest]]
  +
*[[GAE]]
 
[[Category:XMLs]]
 
[[Category:XMLs]]

Latest revision as of 08:26, 25 October 2012

Engines_icons.png This article documents Glest, GAE, and MegaGlest

This is noted in the colored backgrounds, which denote lines as being engine specific. See the key below.[Editing help]

v  d  e


The Projection Particle XML defines the visual effects as well as part of the mechanics used to for attacks between units.

XML[]

GAE Only
GAE and MegaGlest Only
<?xml version="1.0" standalone="yes"?>
<projectile-particle-system>
	<texture value="true" luminance="true" path="texture_name.bmp"/>
	<model value="true" path="model_name.g3d"/>
	<primitive value="quad"/>
	<mode value="normal"/>
	<offset x="0" y="0.2" z="1"/>
	<color red="1.0" green="0.5" blue="0.0" alpha="0.5" />
	<color-no-energy red="0.0" green="0.0" blue="0.0" alpha="0.2" />
	<size value="6" />
	<size-no-energy value="4" />
	<speed value="0" />
	<gravity value="0"/>
	<emission-rate value="1" />
	<energy-max value="20" />
	<energy-var value="0" />
	<!-- Start MG Only -->
    <child-particles value="true">
    	<particle-file path="particle.xml">
    		<offset x="0.5" y="0.5" z="0"/>
    		<radius value="0.1"/>
    		<size value="0.1"/>
    		<gravity value="0"/>
    		<direction x="0" y="0" z="-2"/>
    	</particle-file>
    </child-particles>
	<!-- End MG Only -->

	<trajectory type="linear">
		<speed value="14"/>
		<!-- Start GAE Only -->
		<start value="self"/>
		<start-offset x="0" y="0" z="0"/>
		<start-offset-var x="0" y="0" z="0"/>
		<end value="target"/> 
		<end-offset x="0" y="0" z="0"/>
		<end-offset-var x="0" y="0" z="0"/>
		<tracking value="false"/>
		<!-- End GAE Only -->
	</trajectory>
	<trajectory type="parabolic">
		<speed value="16"/>
		<scale value="2.5"/>
		<!-- Start GAE Only -->
		<start value="self"/>
		<start-offset x="0" y="0" z="0"/>
		<start-offset-var x="0" y="0" z="0"/>
		<end value="target"/> 
		<end-offset x="0" y="0" z="0"/>
		<end-offset-var x="0" y="0" z="0"/>
		<tracking value="false"/>
		<!-- End GAE Only -->
	</trajectory>
	<trajectory type="spiral">
		<speed value="4.0"/>
		<scale value="1"/>
		<frequency value="0.5"/>
		<!-- Start GAE Only -->
		<start value="self"/>
		<start-offset x="0" y="0" z="0"/>
		<start-offset-var x="0" y="0" z="0"/>
		<end value="target"/> 
		<end-offset x="0" y="0" z="0"/>
		<end-offset-var x="0" y="0" z="0"/>
		<tracking value="false"/>
		<!-- End GAE Only -->
	</trajectory>
	<!-- Start GAE Only -->
	<trajectory type="random">
		<speed value="100.0"/>
		<scale value="0.3125"/>
		<frequency value="8"/>
		<start value="target"/>
		<start-offset x="0" y="30" z="0"/>
		<start-offset-var x="4" y="0" z="4"/>
		<end value="target"/> 
		<end-offset x="0" y="0" z="0"/>
		<end-offset-var x="0" y="0" z="0"/>
		<tracking value="true"/>
	</trajectory>
	<blend-mode src="mode" dest="mode"/>
	<blend-equation mode="mode"/>
	<!-- End GAE Only -->
</projectile-particle-system>

Documentation[]

Luminance

Comparison of luminance on and off, using the texture at the top-right corner.

texture[]

Particles can use textures to shape how the particles should look. If luminance is turned on, the image file used as a texture will simply work to define the intensity of the colors. If luminance is turned off, the colors in the image file will be used in the particle. The path is the path to the image.

model[]

If true, the path to the model which will be used as the attack projectile. Animated models will only show the last frame.

primitive[]

Particles have two methods of creation: either quad (renders a set of four particles in a dot style) or line (creates solid lines). Quad is the most commonly used, as it creates the fuzzy style of particles that would be used for flames, explosions, smoke, etc, while lines are generally only used for projectiles such as an arrow. Note that you cannot have more than one particle effect linked to a projectile or splash (though you can for unit particle effects) yet, so it is not possible to mix particles (such as a line and flaming particles for a flaming arrow).

mode[]

Particles have two modes of rendering, either normal which uses colors, or as black which allows the usage of black particles. If not specified, it defaults to normal.

color and color-no-energy[]

If luminance is off, the colors of the texture will be used to color the particles. If luminance is on, the colors defined in the XML are used, though the intensity and shape will be defined by the texture. There are two colors values, the first which is the color at the start of the particle's life, and the second which defines the color when the particle is dead. Thus, the particles can transition in color. Colors are rendered by mixing red, green, and blue, as well as you can set the alpha channel. Each parameter is from 0 - 1, where 1 means there is 100% of that color. With the alpha, 1 would mean the color is almost completely transparent while 0 would be completely opaque.

size and size-no-energy[]

While the shape - and thus some degree of the size - is defined by the texture, the size is also affected by the size parameter passed into the XML, which will define the size in game units. Like the color, there are two size values that define the starting and ending sizes. As a result, the particles can seem to shrink or grow over their life.

gravity[]

Glest has a simple gravity system which can also cause particles to sink downwards - or float upwards - over their life. The value is the degree of sink - or in the case of a negative number, the degree of rise.

trajectory[]

There are four types of trajectories, linear (straight line), parabolic (arc), spiral (spinning spiral), and random (projectile arcs from multiple points in random directions, eg: lightning).

Table of trajectory values by type[]

Type of trajectory Element Description
linear speed How fast the particle moves. Note that speed values over 25 without a splash will nearly always miss due to a bug.
parabolic speed How fast the particle moves. Note that speed values over 25 without a splash will nearly always miss due to a bug.
scale The angle of the parabola. Higher numbers means it will arc more. For example, with 90, it would shoot almost straight up.
spiral speed How fast the particle moves. Note that speed values over 25 without a splash will nearly always miss due to a bug.
scale The angle of the parabola. Higher numbers means it will arc more. For example, with 90, it would shoot almost straight up.
frequency How many times the spiral will spiral around.
random speed How fast the particle moves.
scale The degree of angle (in decimal form) that must be changed at each "joint".
frequency How many "joints" the projectile will have. At each "joint", it will change direction in a random way.
Any of the above (GAE Only, all optional) start Can be either self or target. Where the projectile starts. Default is self.
start-offset Specify an offset from where the attack starts. Measurements are cells in the game's 3D grid.
start-offset-var Allows you to randomize the offset of the start location of the attack.
end Can be either self or target. Where the projectile ends. Default is target.
end-offset Specify an offset from where the attack ends. Measurements are cells in the game's 3D grid.
end-offset-var Allows you to randomize the offset of the end location of the attack.
tracking If true, the particle will change course to follow its target. Default is false.


blend-mode[]

GAE supports choosing the OpenGL blend mode of the particles, allowing you to set the source and destination blending from these possible options:

  • zero
  • one
  • src_color
  • one_minus_src_color
  • dst_color
  • one_minus_dst_color
  • src_alpha
  • one_minus_src_alpha
  • dst_alpha
  • one_minus_dst_alpha
  • constant_color
  • one_minus_constant_color
  • constant_alpha
  • one_minus_constant_alpha
  • src_alpha_saturate

The destination cannot be set to 'src_alpha_saturate'. If none is selected, the default is equal to the source being 'src_alpha' and the destination being 'one'.

blend-equation (GAE only)[]

GAE supports choosing the blending equation from these possible options:

  • func_add
  • func_subtract
  • func_reverse_subtract
  • min
  • max

The default is 'func_add'.

See also[]