Advertisement

Implementing an Influence Map

Started by March 27, 2018 03:25 AM
1 comment, last by Kylotan 6 years, 8 months ago

I am seeking help understanding how to implement an Influence Map in Unreal Engine. I feel like I have a good basic understanding of practical uses of an Influence Map from online articles such as: Mechanics of Influence Mapping. However I haven't found many examples that actually explain the implementation of an influence map. Specifically I have not been able to grasp the coding involved with creating the map itself whether that be a basic grid, area graph, or way-point network.  I would like to ultimately use an influence map (or maps) to control an AI system for my game. Any help is appreciated. If I'm not being clear enough I apologize I am still very new to this and am not sure where to begin. I'm happy to answer questions if anyone needs more details. Thank you.

Usually each map is simply a grid implemented as a 2D array of floating point values. Each cell corresponds to some part of the game world, and the mapping between the two is typically some sort of cellX = worldX / cellSize calculation. If you're struggling with the syntax for a 2D array, look here - https://stackoverflow.com/questions/936687/how-do-i-declare-a-2d-array-in-c-using-new#936702 - or just use a 1D array and calculate the cell indices as (x * rowWidth) + y.

Generating the map is a matter of writing in whatever values represent whatever phenomena you're trying to model, and doing that in a way that takes up space beyond the single cell in which the represented entity is. Usually that means you write in the core values and then use a 'propagation' technique to spread the values out wider. With a grid this is usually a 'blur' algorithm. You can see a simple example here - http://blackpawn.com/texts/blur/ - but be careful to operate on a copy of the map rather than the original, then swap them when done (as noted in your linked article).

This topic is closed to new replies.

Advertisement