Game Development Reference
In-Depth Information
Spreading influences
To actually spread the current influences to their maximum possible regions, you can call
Sandbox.SpreadInfluenceMap . Based on how influences are configured to fall off
over distances, the spreading of influences will be calculated automatically. The reason be-
hind spreading influences allows for a quantization of areas where multiple systems can ac-
cess spatial data with no overhead cost of calculating values:
Sandbox.SpreadInfluenceMap(sandbox, influenceMapLayer);
The overall algorithm used to calculate influence has a maximum of 20 iterations in case
the set falloff of influence is so low that it could propagate past 20 cells in any direction.
Additionally, if the propagation of influence drops below the minimum of one percent, the
algorithm will terminate early:
iterationMax = 20
minPropagation = 0.01
currentPropagation = 1 - falloff
for (iteration; iteration < iterationMax; ++iteration) {
UpdateInfluenceGrid(grid, layer, inertia, falloff)
currentPropagation = currentPropagation * (1 - falloff)
if ( currentPropagation <= minPropagation ) {
break
}
}
The following screenshot illustrates what happens when you spread existing influences
through the influence map:
Search WWH ::




Custom Search