Effect class

The Effect class manages all the particles and decals which are created in-game. Other actors reference an effect asset, a data only blueprint, and request its creation from the game state.

For example on the right is how a drone creates its death effect which stays behind. Let’s see the parameters of the Create Effect node:

Creating an effect Effect class Effect class EffectClass01 300x109
  • Target: The game state which is the singleton overlooking, managing the entire game. It implements often used functions like this Create Effect.
  • Effect Type: The reference to the data only child BP of the Effect class.
  • Base Component: When attachment is used the effect will be attached to this component.
  • Is Attached To Base: Just what it says on the tin. It’s false here but for example set to true for bullet holes to make them stick to dynamic objects.
  • Location: The effect instance will be spawned at this location. Here it’s the soon to be dead drone’s location but its value comes from a trace for bullet impacts for instance.
  • Rotation: The actor’s in this case. For bullets it’s usually derived from the surface’s normal.
  • Amount: This value is passed to decal materials and particle systems so they can use it to show different intensities. For example a paint splatter effect with 0.5 Amount might look like a bunch of drips while 1.0 would turn it to a full puddle.
  • Aux Parameters: A struct which allows to specify a float and a vector parameter’s names and their respective values. Those will be passed to materials and particle systems to further customize their behavior.

On the output side of the node is the reference to the created effect which is in this case discarded. It’s okay because the Effect class manages everything during its lifetime: creation of decals and particles, their decay, the change of the Amount parameter, cleanup of expired elements, etc. There are scenarios where it make sense to keep the effect reference: for example the smoke coming from the exhaust pipe would stay active forever but have its Amount value constantly adjusted in relation to engine torque.


Besides the create-and-forget property of the Effect class the other advantage is that effect editing is decoupled from effect use, they involve different assets, which makes collaboration easier.

Another important feature of this system is that it’s a collection of particle systems and decals: the same particle system or decal can be used in different effects. For example a dust puff particle system can be added to the bullet impact effect (along with a bullet hole decal) while also included in the effect for physics objects sliding on the ground. Reusing effect building blocks is especially handy with iterative development where the particle systems are refined more and more over a longer period of time while in use right from the start.


Now let’s see how an effect is actually set up:

  • Amount: The aforementioned parameter to control the intensity of the elements in the effect.
  • Is Active On Spawn: If true it starts right away, otherwise it waits for a Start Effect interface call.
  • Elements: The elements in this effect, we’ll take a look at them in just a moment.
  • Decay Mode: When this property is set to No Decay then the Amount property will not change over time (unless without another class changing  it from the outside). If the mode is set to Decay On Start or Decay On Stop then Amount will steadily decrease and when it reaches 0 then the effect destroys itself.
    Decay On Start is typically used for bullet holes which start to shrink on creation and disappear slowly. Decay On Stop would be useful with a looping effect like water coming from a tap: when the tap (and thus the effect) is turned off then the water stream narrows and finally stops.
  • Decay Delay Range: A random value is picked in this range and used as a delay (in seconds) to postpone the start of the decay. Helps to break up the decay of similar effects created at the same time.
  • Decay Duration Range: Defines how long the decay will take.

Effect properties Effect class Effect class EffectClass02 300x149

The Elements property is a dynamic array of a struct which looks like this:

  • Description: Helps to identify this element.
  • Attachment Mode: The element can be either Unattached or Inherit attachment from the Effect class it resides in. For instance when a heavy stone ball falls to the ground it might produce two decals: unattached cracks decal on the ground left behind when the ball rolls off and another one which sticks to the ball like it’s container.
  • Location offset: Allows tweaks to the location the effect is created at.
  • Location variance: The final location offset will vary randomly but never more than this value.
  • Uniform Scale: If true then only X component of the final scale value will be used on all three axes.
  • Delay: Delays the start of this element. Used to fine tune timing between elements.
  • Decal element: Contains the necessary data to create a decal. The extents are affected by scaling.
  • Particle systems: Two dynamic arrays of particle system references. The first one contains emitters which are always spawned when the element is started. The second array might contain several particle systems but only a randomly picked one will be created.

The element setup Effect class Effect class EffectClass03 247x300

This class is not finished yet, the next feature I intend to implement is sound effect support. I almost added dynamic lights but particle systems can create point lights which were good enough so far.