XML/Projectile particle

From MegaGlest
Revision as of 20:10, 22 June 2011 by Hofmic (talk) (Started, to be finished later)
Jump to: navigation, search

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

XML

<?xml version="1.0" standalone="yes"?>
<projectile-particle-system>
    <texture value="true" luminance="true|false" path=".../texture_name.bmp"/>
    <model value="true|false" path=".../model_name.g3d"/>
    <primitive value="line|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" />
    <trajectory type="linear">
        <speed value="14"/>
    </trajectory>
    <trajectory type="parabolic">
        <speed value="16"/>
        <scale value="2.5"/>
    </trajectory>
    <trajectory type="spiral">
        <speed value="4.0"/>
        <scale value="1"/>
        <frequency value="0.5"/>
    </trajectory>
    <!-- Begin GAE Only -->
    <trajectory type="random">
        <speed value="100.0"/>
        <scale value="0.3125"/>
        <frequency value="8"/>
    </trajectory>
    <trajectory type=any>
        <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

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.

model

If true, the path to the model which will be used as the attack projectile. Cannot be animated.

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.

color

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.

Size

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.

Radius

Whereas size affects the particle's individual size, radius affects the area filled with particles. Only used for unit particle systems.

Gravity

Glest has a simple gravity system which can also cause particles to sink downwards - or float upwards - over their life.

Trajectory types

For particle projectile systems, the type of the trajectory, either linear (the particle moves in a straight line), parabolic (the particle moves in an arc), spiral (the particle spins around in an arc), or random (GAE only, arcs in random paths). These are not present in other types of particle systems.

Vertical and horizontal spread

See Particles/Spread

Teamcolor

In GAE and MegaGlest, particles are able to contain teamcolor, and like the size and color, it can transition into or away from this.

Static

Static particles do not move, but rather cycle through their regular and no-energy colors, thus allowing them to glow (the color and color-no-energy values can be set the same to prevent this glowing). This is mainly used for the glow, as it simulates a light.

Relative and relative direction

If the particle rotates with the unit, the relative option allows this. This is handy if, for example, having smoke come out of a chimney, as it ensures the building can be rotated while rotating the particle effect with it. Relative direction ensures that even if the particles move relatively with the object, they still go in the same direction, such as with smoke.

Blend modes (GAE only)

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'.