Difference between revisions of "XML/Splash particle"

From MegaGlest
Jump to navigation Jump to search
 
 
(15 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Splash particle systems are most commonly used to create special effects from a unit being attacked.
+
[[XML|Back to XML Overview ]]
<?xml version="1.0" standalone="yes"?>
 
<splash-particle-system>
 
                                      <font color="green">&lt;!-- An optional texture used for each particle (what does luminance do exactly?) --&gt;</font>
 
    <texture value="true|false" path=".../texture_name.bmp" luminance="true"/>
 
                                      <font color="green">&lt;!-- An optional model can be used. --&gt;</font>
 
    <model value="true|false" path=".../model_name.g3d"/>
 
    <primitive value="quad|line"/>  <font color="green">&lt; This shows the shape of the particle.  Line is like a line, quad is like a circle. --&gt;</font>
 
    <offset x="0" y="0" z="0"/>      <font color="green">&lt;!-- This can offset the entire splash from directly in front of the end of the projection where it would normally end. --&gt;</font>
 
                                      <font color="green">&lt;!-- Colors at epicentre (specifically of a particle when it's first created) --&gt;</font>
 
    <color red="0.0" green="0.0" blue="1.0" alpha="0.5" />
 
                                      <font color="green">&lt;!-- Colors at edge (specifically, the color the particle will become when it runs
 
                                          out of energy) --&gt;</font>
 
    <color-no-energy red="1.0" green="1.0" blue="1.0" alpha="0.0" />
 
    <size value="1" />              <font color="green">&lt;!-- Particle start size (center) --&gt;</font>
 
    <size-no-energy value="2" />    <font color="green">&lt;!-- Ending particle size --&gt;</font>
 
    <speed value="5" />              <font color="green">&lt;!-- The Maximum Radius of the explosion --&gt;</font>
 
    <gravity value="0"/>            <font color="green">&lt;!-- Gravity effects --&gt;</font>
 
    <emission-rate value="20" />    <font color="green">&lt;!-- How many particles are emitted --&gt;</font>
 
    <energy-max value="30" />        <font color="green">&lt;!-- Energy --&gt;</font>
 
    <energy-var value="10" />        <font color="green">&lt;!-- Variation --&gt;</font>
 
    <emission-rate-fade value="1"/>  <font color="green">&lt;!-- Particles last longer with a lower number / disappear quicker with a higher
 
                                          number --&gt;</font>
 
    <vertical-spread a="0" b="0"/>  <font color="green">&lt;!-- Direction splash goes after hitting --&gt;</font>
 
    <horizontal-spread a="1" b="0"/> <font color="green">&lt;!-- Direction splash goes after hitting --&gt;</font>
 
</splash-particle-system>
 
  
'''Clarifications''': The energy value is actually the number of server frames (40 per second) the particle will be "alive."  As the particle reaches it's end of life, the color will transition from the value specified by &lt;color&gt; to the value specified by &lt;color-no-energy&gt;.  Similarly, the size of each particle starts out the value specified by &lt;size&gt; and gradually decreases to &lt;size-no-energy&gt; as it runs out of energy.  (And please do correct any of this if you find it to be inaccurate.)
+
Splash [[particle]] systems are most commonly used to create special effects from a unit being attacked.
  
Back to [[XML_Definitions]]
+
 
 +
==XML==
 +
<syntaxhighlight lang="xml">
 +
<?xml version="1.0" standalone="yes"?>
 +
<splash-particle-system>
 +
<texture value="true" path=".../texture_name.bmp" luminance="true" />
 +
<model value="true" path=".../model_name.g3d" />
 +
<primitive value="quad" />
 +
<mode value="normal" />
 +
<offset x="0" y="0" z="0" />
 +
<color red="0.0" green="0.0" blue="1.0" alpha="0.5" />
 +
<color-no-energy red="1.0" green="1.0" blue="1.0" alpha="0.0" />
 +
<size value="1" />
 +
<size-no-energy value="2" />
 +
<speed value="5" />
 +
<gravity value="0" />
 +
<emission-rate value="20" />
 +
<energy-max value="30" />
 +
<energy-var value="10" />
 +
<emission-rate-fade value="1" />
 +
<vertical-spread a="0" b="0" />
 +
<horizontal-spread a="1" b="0" />
 +
</splash-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.
 +
 
 +
===emission-rate===
 +
The number of individual particles that are emitted.
 +
 
 +
===energy-max===
 +
The starting energy of the particles.
 +
 
 +
===energy-var===
 +
A variance to add or subtract from energy-max to make particles more random.
 +
 
 +
===emission-fade-rate===
 +
The rate at which the particles disappear. A lower number will have particles lasting longer, while a higher number will have shorter lasting particles.
 +
 
 +
===vertical-spread and horizontal-spread===
 +
{{See|Particles/Spread}}
 +
 
 +
==See also==
 +
*[[XMLs]]
 +
 
 +
==External links==
 +
*[http://www.gehacktes.net/2010/01/alphablending-with-opengl/ OpenGL blending types]
 +
[[Category:XMLs]]

Latest revision as of 01:40, 11 October 2019

Back to XML Overview

Splash particle systems are most commonly used to create special effects from a unit being attacked.


XML[edit]

<?xml version="1.0" standalone="yes"?>
<splash-particle-system>
	<texture value="true" path=".../texture_name.bmp" luminance="true" />
	<model value="true" path=".../model_name.g3d" />
	<primitive value="quad" />
	<mode value="normal" />
	<offset x="0" y="0" z="0" />
	<color red="0.0" green="0.0" blue="1.0" alpha="0.5" />
	<color-no-energy red="1.0" green="1.0" blue="1.0" alpha="0.0" />
	<size value="1" />
	<size-no-energy value="2" />
	<speed value="5" />
	<gravity value="0" />
	<emission-rate value="20" />
	<energy-max value="30" />
	<energy-var value="10" />
	<emission-rate-fade value="1" />
	<vertical-spread a="0" b="0" />
	<horizontal-spread a="1" b="0" />
</splash-particle-system>

Documentation[edit]

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

texture[edit]

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[edit]

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

primitive[edit]

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[edit]

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[edit]

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[edit]

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[edit]

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.

emission-rate[edit]

The number of individual particles that are emitted.

energy-max[edit]

The starting energy of the particles.

energy-var[edit]

A variance to add or subtract from energy-max to make particles more random.

emission-fade-rate[edit]

The rate at which the particles disappear. A lower number will have particles lasting longer, while a higher number will have shorter lasting particles.

vertical-spread and horizontal-spread[edit]

See also[edit]

External links[edit]