Table of Contents

InfluencerAgent component

Any actor which wants to put its influence on the map can use the InfluencerAgent component to put its stamp where it is located at any time.

Add this component like any other to your actors either in C++ using CreateSubObject<T>() or in blueprints and set its parameters to your desired values. The agent will put its influence on the map and remove its previous influence based on how often it moves and how much delay you set between checks. You can tell it to not remove its influence from its previous place by removing the checkbox for ShouldRemoveInfluenceWhenMoving. The agent will not change the influence if it doesn't move unless you check the ShouldAddInfluenceWhenNotMoving box.

Important parameters

There are only a few parameters which you should care about:

  • MapName
  • InfluenceMode the mode that the agent works in, can be a single template or multiple ones to change at runtime.
  • Template is the template which the agent uses for its stamp in single template mode. A template is a radius and a curve.
  • Templates is the array of templates which the agent uses for its stamp in multiple template mode. A template is a radius and a curve.
  • TemplateIndex is the index of the template in the array which should be used at the moment in the multi template mode.
  • DelayBetweenUpdates is the delay between two checks which the agent executes to see if it moved and if yes, it removes its template from its previous position and adds it to its current position.
  • bClampFinalMapValues The final result of the operations of this component will be clamped between a min and a max value.
  • MinClampValue The min value used for clamping if the bClampFinalMapValues was set.
  • MaxClampValue The max value used for clamping if the bClampFinalMapValues was set.
  • ShouldRemoveInfluenceWhenMoving Should the actor remove its influence from its previous place when moving? Defaults to true.
  • ShouldAddInfluenceWhenNotMoving Should the actor add its influence again and again even if it is not moving? Defaults to false.

MapName

This is the name of the map that the agent will put its template on. If you need to put your influence in multiple maps then you need to use multiple components for now but usually you'll want different templates and different delays for different maps.

InfluenceMode

Your agent can either always use the same template or have the ability to change its template at runtime. If your agent changes its influence shape due to using a different weapon or something else, then you can use the multiple templates mode.

When single template mode is chosen, the Template variable will be used, when multiple templates mode is chosen, then the combination of the Templates variable and the TemplateIndex variable will be used to find the current template.

Template

A template is basically a pre-baked array of values for a stamp. It has a radius and a curve and the radius is in cells. It calculates all cells of a square based on the curve and the square size is calculated based on the radius of the template. It is a radius because the shape of the cells will resemble a circle and not a square with most curve shapes.

Templates

A template is basically a pre-baked array of values for a stamp. It has a radius and a curve and the radius is in cells. It calculates all cells of a square based on the curve and the square size is calculated based on the radius of the template. It is a radius because the shape of the cells will resemble a circle and not a square with most curve shapes.

This array contains multiple templates which you can change to at runtime by changing the TemplateIndex.

TemplateIndex

When using multiple templates mode, this variable is used to know which template in the Templates array should be used. There is a SetCurrentTemplateIndex() function which should be used at runtime so you don't set the index to something outside the bounds of your array.

Delay Between Updates

For example an enemy which moves fast probably needs less delay and something which moves rarely can have a delay of multiple seconds.

bClampFinalMapValues

This parameter and the min and max parameters for it cause the final result of the operation on the map to be clamped. This is mostly useful if you don't want to end up with -0.00000007 in a cell instead of 0 because you search the map for highest/lowest values.

The super slight changes in final results without clamping happen because of floating point errors in the way computers calculate floating point mathematical operations

If a map's values are between a different range than 0 to 1, then you can normalize it but this option is useful because your map might be between 0 and 1 and normalizing it is too expensive. Clamping is cheaper and removes the -0.000005 and 1.00000001 and similar numbers from the map so they are not always chosen as the lowest/highest values in searches.

ShouldRemoveInfluenceWhenMoving

You might want to set this to false for effects like scent which should stay there even after the actor moves. Usually another component like WFInfluenceMapDecayComponent wears the effect of the actor off over time.

ShouldAddInfluenceWhenNotMoving

For effects like scent or anything else whose map decays over time, you might want to set it to true. Usually another component like WFInfluenceMapDecayComponent wears the effect of the actor off over time. You need this if you want the actor to constantly tell the map that I'm here. In maps which other components don't remove/change your effect, this is not needed to be set to true.

Advanced Usage

Using this component is not mandatory and you can call the methods of the InfluenceMap actors directly to add and remove influence. Even using templates is not mandatory. While they help with performance of the operations, if you need to calculate values without curves or need to change the curves dynamically enough that using templates doesn't make sense then you can use the Propagate family of methods and give your curves directly to the WFInfluenceMap actor.

The source code of the InfluencerAgent component is pretty small and pretty simple, it sets up a timer based on the Delay parameter and in that timer if the agent is moved, it adds its influence to the previous position with the magnitude of -1 which is technically removing it and adds it in the new position with the magnitude of 1. It continues this until the actor is destroyed.