ModEnc is currently in Maintenance Mode: Changes could occur at any given moment, without advance warning.

Particles and ParticleSystems

From ModEnc
Revision as of 12:55, 15 February 2009 by DCoder (talk | contribs) (Creating from executable... to be continued...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Wip tools.png Work in Progress
This page is the result of a currently running discussion. The information on it is subject to change.

"Particles" in the C&C series are ingame objects designed to represent things like smoke, gas, sparks, fire and Railgun effects. They're usually contained within a "ParticleSystem" that's attached to a weapon or an object, such as the IFV Repair spark or Ghost Stalker's Railgun. As a lot of other Westwood concepts, they sound nice in theory but end up limited in practice.

ParticleSystems

ParticleSystems are basically commanders of single Particles - they spawn their own Particles when needed, tell them where to go, how to act and when to die. There are no unmanaged Particles in the game, even the seemingly independent Poison Gas Particles spawned by the Virus are in fact controlled by the global particle system the game creates especially for "uncontrolled" particles.

ParticleSystem Behaviours

ParticleSystems have five preprogrammed behaviours corresponding to the five use cases that were needed in Tiberian Sun where they first appeared. These behaviours are assigned to a Particle System by setting its Template:TTL flag.

Warning small.png Note that Template:TTL is a flag applicable to both ParticleSystems and Particles. It means two different things in those two contexts.

Template:TTL

This behaviour is normally used to depict smoke caused by damage the object has sustained, or smoke produced by normal functionality of the object (Slave Miner's smoke stacks). The system follows its owner object around.

Template:TTL

This behaviour is naturally used to depict gases floating around, such as Tiberium Gas emitted by the Veinhole Monster in Tiberian Sun or Poison Gas created by the Virus-induced deaths in Yuri's Revenge. The system usually has no owner object and floats around in accordance to the wind.

Template:TTL

This behaviour is used by flamethrower-type weapons like the Devil's Tongue subterranean flame tank in Tiberian Sun. The system obeys the source object's turret facing and will not fire until the turret is correctly facing the target. This behaviour generates lots of particles in a sine wave formation.

Template:TTL

This behaviour is used (predictably) to depict sparks caused by damaged electrical systems or welding sparks (IFV Repair weapon). In addition to spawning particles, this behaviour also creates flashes of light programmatically, although other behaviours can also create these flashes in a different way.

Template:TTL

This behaviour is used for the Railgun particles. It is the most complex one, calculating the particles' trajectories along the path as a spiral. There are multiple INI controls to adjust this spiral's behaviour. It also can draw a narrow laser beam along the center of the spiral, this laser is visually quite different from ordinary ones generated by laser-type weapons.

Creating Particle Systems

Particle Systems are spawned by the game under the following circumstances:

  • A VoxelAnim has been created - the Particle System specified in Template:TTL (if any) will be created.
  • A VehicleType is inactive (like an offline Robot Tank) - the [CombatDamage]DefaultSparkSystem= will be created every once in a while.
  • A TechnoType with Template:TTL is damaged into yellow health - a random System from those listed in Template:TTL (only systems with BehavesLike=Smoke are eligible) will be created. As long as this spawned system exists, repeating these conditions will not create more systems. This system will be terminated automatically if the object heals back into green health.
  • An InfantryType with Template:TTL and Template:TTL has less that [General]ConditionYellow= health - a random System from those listed in Template:TTL (only systems with BehavesLike=Spark are eligible) will be created. As long as this spawned system exists, repeating these conditions will not create more systems. The odds of this system being created (assuming the previous condition allows it) are [General]ConditionRedSparkingProbability= or [General]ConditionYellowSparkingProbability=, depending on whether the cyborg's health is below [General]ConditionRed= or not.
  • A TechnoType is firing a weapon that has Template:TTL set. Once this TechnoType fires this weapon, it will not be able to fire any more Template:TTL weapons until that particle system expires.
  • A TechnoType is firing a weapon with either Template:TTL or Template:TTL set. Once it fires, it will not be able to fire any more weapons with any one of those two flags until that particle system expires.
  • A Map Action calls for a creation of a Particle System.
  • A Scenario starts - a global system named GasCloudSys is created to control the "unmanaged" particles mentioned above.
  • A Parasite is "firing its weapon" inside its host - the [CombatDamage]DefaultSparkSystem= will be created. This system is ownerless, will be recreated with each "shot" and will expire on its own.
  • A weapon with Template:TTL is fired - the [CombatDamage]DefaultSparkSystem= will be created. Like the parasite one, this system is ownerless.
  • A warhead with Template:TTL set is detonated - an ownerless system declared in this flag will be created. Note that despite the flag being named Particle, you're supposed to specify a ParticleSystem as its value.
  • A warhead is detonated in a cell that contains an OverlayType with Template:TTL set - the [CombatDamage]BarrelParticle= system will be created. Note the Particle/ParticleSystem naming again.
  • A Mind Controlling object that's subject to MasterMindOverload logic is overloaded - 5 instances of the [CombatDamage]DefaultSparkSystem= will be created.
  • A BuildingType is placed - the System specified as Template:TTL , if any, is created. This system is recreated whenever the building decloaks, Warning small.png however, this part is done if the BuildingType has the Template:TTL set to non-zero coordinates, without checking that it actually has a NaturalParticleSystem set.
  • A BuildingType is destroyed - a random System from those listed in Template:TTL (only systems with BehavesLike=Smoke are eligible) will be created.
  • A Harvester or a Slave unloads ore at a Refinery - up to four instances of the System specified as Template:TTL will be created, depending on how many of Template:TTL, Template:TTL, Template:TTL, Template:TTL are set to non-zero. These systems will auto expire after Template:TTL frames.
To be continued...