CEG:Defs: Difference between revisions

From Spring
Jump to navigationJump to search
Flozi (talk | contribs)
tag tag tag
Flozi (talk | contribs)
tagify; next up: remove repeats
Line 6: Line 6:
* {{sourcelink|file=rts/Sim/Projectiles/}}  
* {{sourcelink|file=rts/Sim/Projectiles/}}  
* {{sourcelink|file=rts/Sim/Projectiles/Unsynced/}}
* {{sourcelink|file=rts/Sim/Projectiles/Unsynced/}}
== CEG Textures ==
* Textures on CEG definitions are referenced by name.
* The list of available textures and their names should be in [[resources.lua]]
* Texture definitions to be used in projectile classes should be placed within the "projectiletextures" category and textures to be used with [[#CSimpleGroundFlash]] class should be placed within the "groundfx" category.
* Texture images are usually placed in the "bitmaps" subfolder.


== Common Properties ==
== Common Properties ==
Line 37: Line 45:
|description = The initial speed of the spawner.
|description = The initial speed of the spawner.
}}
}}


== CExpGenSpawner ==
== CExpGenSpawner ==
Line 73: Line 82:
|description = The name of the CEG you want to spawn.
|description = The name of the CEG you want to spawn.
}}
}}




Line 79: Line 87:
This creates three rectangular textures at right angles to each other. The {{taglink|frontTexture}} has {{taglink|dir}} as its normal.
This creates three rectangular textures at right angles to each other. The {{taglink|frontTexture}} has {{taglink|dir}} as its normal.


=== Suggested Use: ===
=== Suggested Use ===
*Muzzle flames, obviously.
*Muzzle flames, obviously.
*You can use an upward-pointing CBitmapMuzzleFlame as a simple splash of water or dirt.
*You can use an upward-pointing CBitmapMuzzleFlame as a simple splash of water or dirt.
Line 85: Line 93:
*This is the only class that both obeys perspective and allows for a custom texture.
*This is the only class that both obeys perspective and allows for a custom texture.


=== Properties: ===
=== Properties ===


{{tag
{{tag
Line 149: Line 157:
|description = Where the frontTexture is along the length of the muzzle flame. <code>0</code> means it is in the back, <code>1</code> is in the front.
|description = Where the frontTexture is along the length of the muzzle flame. <code>0</code> means it is in the back, <code>1</code> is in the front.
}}
}}


== CExploSpikeProjectile ==
== CExploSpikeProjectile ==
Line 197: Line 206:
|description = The color of the spike.
|description = The color of the spike.
}}
}}


== CHeatCloudProjectile ==
== CHeatCloudProjectile ==
Line 255: Line 265:
== CSimpleParticleSystem ==
== CSimpleParticleSystem ==


Creates a sprite that can undergo complex motion. Probably the most versatile class. Since there are a lot of properties, I'll group them:
Creates a sprite that can undergo complex motion. Probably the most versatile class.
 
=== Suggested Use ===
* Anything moving that is not doing so at constant velocity.
* If you want something that expands (or shrinks) to some size then stops, set {{taglink|sizeMod}} to something less than <code>1</code>, and {{taglink|sizeGrowth}} to something positive. The particle will grow to a size equal to <code>sizeGrowth / (1 - sizeMod)</code> and stop. The smaller {{taglink|sizeMod}} is, the faster it will reach this size.
 
=== Properties ===
==== Initial Velocity Properties ====
{{tag
|name = emitVector
|type = float[3]
|description = The initial direction vector in which the particle is emitted. When spawning CEGs via EmitSfx you can make the particles go into the direction of the emiting piece with {{taglink|emitvector|dir}}. This is useful for e.g. fire coming out of a gun barrel.
}}
 
{{tag
|name = emitRot
|type = float
|description = At what angle to emit the particle relative to {{taglink|emitVector}}. <code>0</code> means that the particle will be emitted in {{taglink|emitVector}}'s direction; <code>180</code> will emit the particle in the opposite direction. <code>90</code> will emit the particle in a random direction perpendicular to {{taglink|emitVector}}, which is good for creating rings.
}}
 
{{tag
|name = emitRotSpread
|type = float
|description = For each particle, a random number between <code>0</code> and {{taglink|emitRotSpread}} is added to the {{taglink|emitRot}}.
}}
 
{{tag
|name = emitMul
|type = float[3]
|description = Scales the initial particle velocity; for this property, +y is considered to be in the direction of {{taglink|emitVector}}. Good if you want to create an egg-shaped explosion.
}}
 
{{tag
|name = particleSpeed
|type = float
|description = The particle's initial speed.
}}
 
{{tag
|name = particleSpeedSpread
|type = float
|description = For each particle, a random number between <code>0</code> and {{taglink|particleSpeedSpread}} is added to the {{taglink|particleSpeed}}.
}}
 
==== Movement Properties ====
 
{{tag
|name = gravity
|type = float[3]
|description = This will be added to the particle's velocity every frame.
}}
 
{{tag
|name = airdrag
|type = float
|description = The particle's velocity is multiplied by this every frame.
}}
 
==== Size Properties ====
 
{{tag
|name = particleSize
|type = float
|description = The initial size of the particle.
}}


=== Initial Velocity Properties ===
{{tag
*emitVector (float3): The basic direction in which the particle is emitted.
|name = particleSizeSpread
Protip:<br>
|type = float
When spawning CEGs via EmitSfx you can make the particles go into the direction of the emiting piece with:
|description = For each particle, a random number between <code>0</code> and {{taglink|particleSizeSpread}} is added to the {{taglink|particleSize}}.
<code>emitvector = dir,</code>
}}
This is usefull for eg fire coming out of a gun barrel.
 
*emitRot (float): At what angle to emit the particle relative to emitVector. 0 means that the particle will be emitted in emitVector's direction; 180 will emit the particle in the opposite direction. 90 will emit the particle in a random direction perpendicular to emitVector, which is good for creating rings.
{{tag
*emitRotSpread (float): For each particle, a random number between 0 and emitRotSpread is added to the emitRot.
|name = sizeGrowth
*emitMul (float3): Scales the initial particle velocity; for this property, +y is considered to be in the direction of emitVector. Good if you want to create an egg-shaped explosion.
|type = float
*particleSpeed (float): The particle's initial speed.
|description = How much the particle grows each frame.
*particleSpeedSpread (float): For each particle, a random number between 0 and particleSpeedSpread is added to the particleSpeed .
}}
 
{{tag
|name = sizeMod
|type = float
|description = The size of the particle is multiplied by this each frame.
}}
 
==== Visual Properties ====
 
{{tag
|name = directional
|type = bool
|description = If true, the particle will point in the direction it is moving.
}}
 
{{tag
|name = texture
|type = string
|description = The texture to use for the particle.
}}


=== Movement Properties ===
{{tag
*gravity (float3): This will be added to the particle's velocity every frame.
|name = colorMap
*airdrag (float): The particle's velocity is multiplied by this every frame.
|type = string
|description = See [[CColorMap]].
}}


=== Size Properties ===
==== Life Properties ====
*particleSize (float): The initial size of the particle.
*particleSizeSpread (float): For each particle, a random number between 0 and particleSizeSpread is added to the particleSize.
*sizeGrowth (float): How much the particle grows each frame.
*sizeMod (float): The size of the particle is multiplied by this each frame.


=== Visual Properties ===
{{tag
*directional (bool): If true, the particle will point in the direction it is moving.
|name = numParticles
*texture (string): The texture to use for the particle.
|type = int
*colorMap (string): The colormap to use for the particle.
|description = How many particles to create. This is not the same as <code>count</code>; if you spawn multiple particles using <code>count</code>, any [[CEG-Operators]] will be re-evaluated for each particle, whereas if you use {{taglink|numParticles}} they will not be. However, the spread properties are evaluated separately for each particle regardless of which one you use.
}}


=== Life Properties ===
{{tag
*numParticles (int): How many particles to create. This is not the same as <code>count</code>; if you spawn multiple particles using <code>count</code>, any [[CEG-Operators]] will be reevaluated for each particle, whereas if you use <code>numParticles</code> they will not be. However, the spread properties are evaluated separately for each particle regardless of which one you use.
|name = particleLife
*particleLife (float): How long each particle lasts.  
|type = float
*particleLifeSpread (float); For each particle, a random number between 0 and particleLifeSpread is added to the particleLife .
|description = How long each particle lasts.  
}}


Suggested Use:
{{tag
*This is probably the most versatile class.
|name = particleLifeSpread
*Anything moving that is not doing so at constant velocity.
|type = float
*If you want something that expands (or shrinks) to some size then stops, set sizeMod to something less than 1, and sizeGrowth to something positive. The particle will grow to a size equal to sizeGrowth/ (1 - sizeMod) and stop. The smaller sizeMod is, the faster it will reach this size.
|description = For each particle, a random number between <code>0</code> and {{taglink|particleLifeSpread}} is added to the {{taglink|particleLife}}.
}}


== CSpherePartSpawner ==
== CSpherePartSpawner ==
Line 326: Line 421:
|description = The color of the sphere.
|description = The color of the sphere.
}}
}}


== CSimpleGroundFlash ==
== CSimpleGroundFlash ==
Line 365: Line 461:
|description = See [[CColorMap]].
|description = See [[CColorMap]].
}}
}}
== CEG Textures ==
* Textures on CEG definitions are referenced by name.
* The list of available textures and their names should be in [[resources.lua]]
* Texture definitions to be used in projectile classes should be placed within the "projectiletextures" category and textures to be used with "CSimpleGroundFlash" class should be placed within the "groundfx" category.
* Texture images are usually placed in the "bitmaps" subfolder.


[[Category:CEG]]
[[Category:CEG]]

Revision as of 22:34, 8 August 2014

CEG Classes

Source

The engine source code which loads the tags from these files is viewable here:

CEG Textures

  • Textures on CEG definitions are referenced by name.
  • The list of available textures and their names should be in resources.lua
  • Texture definitions to be used in projectile classes should be placed within the "projectiletextures" category and textures to be used with #CSimpleGroundFlash class should be placed within the "groundfx" category.
  • Texture images are usually placed in the "bitmaps" subfolder.


Common Properties

All classes have the following properties, although not all of them use them:

bool alwaysVisible  default: false 

If true, the spawner is always visible, ignoring LoS.

bool useAirLos  default: false 

Whether the spawner uses air LoS to determine if it is visible. This may allow the spawner to be seen from a further distance than normal.

float[3] pos  default: {0.0, 0.0, 0.0} 

The initial position of the spawner.

float[3] speed  default: {0.0, 0.0, 0.0} 

The initial speed of the spawner.


CExpGenSpawner

This is the closest thing CEG has to a function call. Instead of creating a graphical effect on its own, it creates another CEG.

Suggested Use

  • If you use a spawner a lot of times, you may want to make it a separate CEG to avoid having to copy-paste many times.
  • This is the only way to truly delay a graphical effect.
  • The spawned CEG still checks conditions, so if you want to, say, spawn an effect only if it is in water and doesn't hit a unit, you can give the CExpGenSpawner nounit = 1; and the spawned CEG water = 1;.
  • This allows you to give a set of spawners the same (and possibly random) direction.
  • You can animate an explosion flip-book style using delays and several bitmaps.

Properties

int delay  default: ? 

How long to wait (in frames?) before spawning the CEG.

float[3] dir  default: ? 

The CEG will be called with this direction vector.

float damage  default: ? 

The CEG will be called with this damage. The CEG doesn't actually deal any damage, but you can use this as a parameter and read it using the 'd' operator.

string explosionGenerator  default: ? 

The name of the CEG you want to spawn.


CBitmapMuzzleFlame

This creates three rectangular textures at right angles to each other. The frontTexture has dir as its normal.

Suggested Use

  • Muzzle flames, obviously.
  • You can use an upward-pointing CBitmapMuzzleFlame as a simple splash of water or dirt.
  • Railgun trails.
  • This is the only class that both obeys perspective and allows for a custom texture.

Properties

string sideTexture  default: "" 

Texture as viewed from the side.

string frontTexture  default: "" 

Texture as viewed from the front.

float[3] dir  default: {0.0, 0.0, 1.0} 

The direction vector of the muzzle flame.

string colorMap  default: "" 

See CColorMap.

float size  default: ??? 

The initial width of the muzzle flame.

float length  default: ??? 

The initial length of the muzzle flame.

float sizeGrowth  default: ??? 

By the end of its life, the muzzle flame grows to 1 + sizeGrowth times its initial size and length. The flame grows quickly at first and more slowly toward the end.

int ttl  default: ??? 

How long the muzzle flame lasts.

float frontOffset  default: ??? 

Where the frontTexture is along the length of the muzzle flame. 0 means it is in the back, 1 is in the front.


CExploSpikeProjectile

This creates a glowy spike. Note that the spike is two sided, i.e., symmetric about the position of the spawner.

Suggested Use

  • Anything glowy.
  • For large, slow missiles, you can try using this as an extended engine flame. Set the width to something fairly large.
  • Long and thin spikes will look spiky; meanwhile, shorter and wider spikes look more blobby.
  • The colors of spikes add together, so if you have several spikes and all three color channels are non-zero, it will be white in the center.
  • The length growth of the spike depends on the norm of the dir vector. The spike does not grow in width.

Properties

float length  default: ? 

The initial length of (half) of the spike (multiplied by dir).

float width  default: ? 

Half the initial width of of the spike. This is an absolute value.

float alpha  default: ? 

The starting alpha of the spike.

float alphaDecay  default: ? 

How quickly the alpha of the spike decreases.

float[3] dir  default: ? 

The direction of the spike. Not normalized.

float[3] color  default: ? 

The color of the spike.


CHeatCloudProjectile

Creates an expanding sprite. Simple but effective.

Suggested Use

  • As the main background to an explosion.

Properties

float heat  default: ? 

FIXME:

float maxheat  default: ? 

FIXME:

float heatFalloff  default: ? 

This is really confusing way of representing alpha and alphaDecay. Basically alpha = heat/maxheat, and alphaDecay = heatFalloff/maxHeat.

float size  default: ? 

The initial radius of the heatcloud.

float sizeGrowth  default: ? 

The heatcloud grows by this amount every frame.

float sizeMod  default: ? 

The size of the heatcloud is multiplied by 1 - sizeMod.

float sizeModMod  default: ? 

Each frame, sizeMod is multiplied by sizeModMod.

string texture  default: ? 

The texture used for the heatcloud.


CSimpleParticleSystem

Creates a sprite that can undergo complex motion. Probably the most versatile class.

Suggested Use

  • Anything moving that is not doing so at constant velocity.
  • If you want something that expands (or shrinks) to some size then stops, set sizeMod to something less than 1, and sizeGrowth to something positive. The particle will grow to a size equal to sizeGrowth / (1 - sizeMod) and stop. The smaller sizeMod is, the faster it will reach this size.

Properties

Initial Velocity Properties

float[3] emitVector  default: ? 

The initial direction vector in which the particle is emitted. When spawning CEGs via EmitSfx you can make the particles go into the direction of the emiting piece with emitvector = dir. This is useful for e.g. fire coming out of a gun barrel.

float emitRot  default: ? 

At what angle to emit the particle relative to emitVector. 0 means that the particle will be emitted in emitVector's direction; 180 will emit the particle in the opposite direction. 90 will emit the particle in a random direction perpendicular to emitVector, which is good for creating rings.

float emitRotSpread  default: ? 

For each particle, a random number between 0 and emitRotSpread is added to the emitRot.

float[3] emitMul  default: ? 

Scales the initial particle velocity; for this property, +y is considered to be in the direction of emitVector. Good if you want to create an egg-shaped explosion.

float particleSpeed  default: ? 

The particle's initial speed.

float particleSpeedSpread  default: ? 

For each particle, a random number between 0 and particleSpeedSpread is added to the particleSpeed.

Movement Properties

float[3] gravity  default: ? 

This will be added to the particle's velocity every frame.

float airdrag  default: ? 

The particle's velocity is multiplied by this every frame.

Size Properties

float particleSize  default: ? 

The initial size of the particle.

float particleSizeSpread  default: ? 

For each particle, a random number between 0 and particleSizeSpread is added to the particleSize.

float sizeGrowth  default: ? 

How much the particle grows each frame.

float sizeMod  default: ? 

The size of the particle is multiplied by this each frame.

Visual Properties

bool directional  default: ? 

If true, the particle will point in the direction it is moving.

string texture  default: ? 

The texture to use for the particle.

string colorMap  default: ? 

See CColorMap.

Life Properties

int numParticles  default: ? 

How many particles to create. This is not the same as count; if you spawn multiple particles using count, any CEG-Operators will be re-evaluated for each particle, whereas if you use numParticles they will not be. However, the spread properties are evaluated separately for each particle regardless of which one you use.

float particleLife  default: ? 

How long each particle lasts.

float particleLifeSpread  default: ? 

For each particle, a random number between 0 and particleLifeSpread is added to the particleLife.

CSpherePartSpawner

Draws an expanding sphere.

Suggested Use

  • Looks like a shockwave.

Properties

float alpha  default: ? 

The alpha of the sphere.

int ttl  default: ? 

Time to live, in frames(?).

float expansionSpeed  default: ? 

How quickly the sphere expands.

float[3] color  default: ? 

The color of the sphere.


CSimpleGroundFlash

Draws an expanding ground texture.

Suggested Use

  • A short groundflash (~8 frames) is good for any explosion that gives off light. You can also use a longer groundflash to suggest the ground is glowing from heat.

Properties

float size  default: ? 

The radius of the particle.

float sizeGrowth  default: ? 

How much the particle grows each frame.

int ttl  default: ? 

Time to live, in frames(?).

string texture  default: ? 

The texture to use for the particle.

string colorMap  default: ? 

See CColorMap.