CEG%3ADefs - beyond-all-reason/springrts_engine_wiki_mirror GitHub Wiki
CEG Definitions
Source
The engine source code which loads the tags from these files is viewable here:
Data Types
CEGs use the following data types:
You can use CEG:Operators to define floats that are not fixed.
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 thegroundfx
category. - Texture images are usually placed in the "bitmaps" subfolder.
Overall Format
A CEG file contains one or more CEGs. Each CEG follows this format:
return {
["ceg_name"] = {
-- EXPLOSION LEVEL
useDefaultExplosions = false,
spawner1_name = {
-- SPAWNER LEVEL
class = "CClassName",
count = 1,
air = true,
ground = true,
water = true,
properties = {
-- CLASS LEVEL
},
},
},
spawner2_name = {
-- SPAWNER LEVEL
-- each spawner follows the above format
},
groundflash = {
-- groundflash is a special spawner name; it always generates a CStandardGroundFlash
-- CStandardGroundFlash properties
},
-- other special spawner names exist, although their use is discouraged in favour of class="CSomeClass"
-- see https://github.com/spring/spring/blob/develop/cont/base/springcontent/gamedata/explosion_alias.lua#L61
},
}
Explosion Level Tags
Spawner Level Tags
A CEG can contain any number of spawners. The name of the spawners don't
really matter, as long as it's not groundflash
, which has a special
meaning. You can think of each spawner as being one component of the
overall explosion.
Visibility Conditions
These determine under what conditions the spawner will run. If you set the condition to true, the spawner will run if the explosion takes place under that condition. If you set more than one condition, the spawner will run if any of them are true. If you want a spawner to run only if two or more conditions are all true, you have to do a little trick with the #CExpGenSpawner class as explained in "suggested use".
Class Level Tags
Common Properties
All classes have the following properties, although not all of them use them:
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 spawnedCEG 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
CBitmapMuzzleFlame
This creates three rectangular textures at right angles to each other. The has 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
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
CHeatCloudProjectile
Creates an expanding sprite. Simple but effective.
Suggested Use
- As the main background to an explosion.
Properties
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 to something less than
1
, and to something positive. The particle will grow to a size equal tosizeGrowth / (1 - sizeMod)
and stop. The smaller is, the faster it will reach this size.
Properties
Initial Velocity Properties
Movement Properties
Size Properties
Visual Properties
Life Properties
CSpherePartSpawner
Draws an expanding sphere.
Suggested Use
- Looks like a shockwave.
Properties
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
CStandardGroundFlash
If you name a spawner "groundflash," it will always generate a standard groundflash.
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
CSmokeProjectile2
( newly added to wiki. someone cross-check then remove this note )
Particles that begin with a hard-coded yellow-red colorfade and then fade to monochrom. (shades of grey)
Movement is influenced by the random wind. Finer details of visual and
position update are best explained by looking at the formulas in
CSmokeProjectile2::Update() & CSmokeProjectile2::Draw()
Suggested Use
Smoke. Smokestacks, rocket exhaust, burning wreckage,...
For a nicer stream of smoke spawn it frequently over multiple frames, otherwise it looks rather bland.
Properties
CSmokeProjectile
Monochrome particles that fade out. A more "primitive" version of CSmokeProjectile2. No hardcoded red-yellow start but it misses wantedPos to tweak the look a bit more detailed.
Suggested Use
Smoke. For a nicer stream of smoke spawn it frequently over multiple frames, otherwise it looks rather bland.
Properties
Examples
'Balanced Annihilation' CEGs (TDF format)
'Imperial Winter' CEGs (TDF format)
'MechCommander: Legacy' CEGs (TDF format)
'Spring: 1944' CEGs (TDF format)
'XTA' CEGs (TDF format)