Essentials Series/Particles

From Heavy Iron Modding
Essentials Series
  1. Introduction
  2. Industrial Park basics
  3. Editing Assets
  4. Templates
  5. Links
  6. Dispatchers
  7. Tikis and Enemies

This page is part of the Essential Series modding tutorials. Particles are visual effects, such as smoke, fire or sparkles. They can have various kinds of behavior and spawn from multiple places. A lot is not yet known about particles, but enough is for us to be able to make custom ones.

Particles are controlled by multiple assets and there are no templates for them, so if you want to make custom particles, you must copy existing particle assets which are already similar enough to how you want yours to behave. You do not need to edit values if you do not understand what they mean, but understanding them can help you make your particles look more like you want them to.

Particle Assets

When using particles, you need to deal with three asset types.

  • Particle Emitter (PARE), which controls where particles will be emitted, is the simplest to deal with.
  • Particle Properties (PARP), which controls how particles change during their lifetime (size, color, movement) is the most complex of the 3.
  • Particle System (PARS), which controls the rendering data for a particle (including the texture), is the one we don't know much how to change yet, as it contains a constructor function for the particle in its data which is best left alone for now (I would recommend changing only the particle texture and the render modes if you understand what they mean).

Particle Emitter

Emitters contain a reference to the Particle Properties asset they will use, so be sure to update that if you renamed your assets. They contain data which tells where particles will show up, such as from a fixed point or from a specific entity asset.

By setting the Emitter Type to one of the possible shapes, you can choose if the particles emit from a point, sphere, box or line shaped region, for example. This region will be placed in the center of the emitter position. The PareSpecific region contains the information about this region, which you can change.

The Emitter property has a reference to the asset you want the particles to emit from (entity asset or group of markers):

  • To use marker assets as emitters, place as many markers as you want using the template. Place a Group template as well and put all the markers in the group. Put the Group's assset ID in the Emitter field of the PARE. The particles will be emitted from all the markers.
  • To use an entity asset, set the EmitterType to Entity Bound and the asset ID of the entity in the Emitter field of the particle emitter. The particles will be emitted from the entity's position at the time of emission.
  • You can also set the Emitter property to 0 and set the XYZ values of the emitter position directly in the asset.

Use events to control particle emission.

Events

  • On: send this event to the particle emitter to begin particle emission.
  • Off: send this event to the particle emitter to stop particle emission.

Particle Properties

Particle Properite contain a reference to the particle system they will use, so be sure to update that if you renamed your assets. They contain general information which tells how particles are created: their size, color, lifetime, how they move. A particle properties asset contains a section of 14 different structs. Each of them controls the value of one aspect of the particle, and each of them have internal controllers to decide the value. These are the fields that each of the 14 structs have:

  • Interpolation Value 0/A: this is the minimum interpolation value for the struct.
  • Interpolation Value 1/B: this is the maximum interpolation value for the struct.
  • Frequency (Random, Linear and Step): this is the frequency in which the values for the Random, Linear and Step functions will be updated.
  • Frequency (Sin and Cos): this is the frequency in which the values for the Sine and Cosine functions will be updated.
  • Interpolation Mode: this defines which function will be used to choose an interpolation value for this struct. The value chosen for each particle is a function of the particle properties' elapsed time and will always be between values 0/A and 1/B. These are the possible functions:
    • ConstA: always value 0/A.
    • ConstB: always value 1/B.
    • Random: a new random value between 0/A and 1/B is chosen. The rate is defined by the frequency (above).
    • Linear: a new value between 0/A and 1/B is chosen using linear interpolation.
    • Sine: a new value between 0/A and 1/B is chosen using sine interpolation.
    • Cosine: a new value between 0/A and 1/B is chosen using cosine interpolation.
    • Time: a new value is chosen using the time of the interpolation directly.
    • Step: the start value until time*freq >= 0.5, then the end value.

These are the 14 structs for which the fields above apply:

  • 0 - Rate: how many times per second a particle is emitted.
  • 1 - Life: particle lifetime in seconds.
  • 2 - Birth Size: particle birth size in units.
  • 3 - Death Size: particle death size in units.
  • 4 - Start Color (R): red component of the particle birth color (0 to 255).
  • 5 - Start Color (G): green component of the particle birth color (0 to 255).
  • 6 - Start Color (B): blue component of the particle birth color (0 to 255).
  • 7 - Start Color (A): alpha component of the particle birth color (0 to 255).
  • 8 - End Color (R): red component of the particle death color (0 to 255).
  • 9 - End Color (G): green component of the particle death color (0 to 255).
  • 10 - End Color (B): blue component of the particle death color (0 to 255).
  • 11 - End Color (A): alpha component of the particle death color (0 to 255).
  • 12 - Unknown/Unused
  • 13 - Unknown/Unused

Particle System

In the Particle System asset editor, you can set the texture the particle will use, the pipeline rendering options for the particle, and the maximum amount of this particle that will be visible at once (although this sometimes seems to be ignored).