top of page

Influence Maps

In this video, I demonstrate the simple functionality of my latest project, influence mapping. It is a type of mapping to a graph that I have combined with my flow field pathfinding in order to create a more detailed and varying pathfinding simulation. The demo itself is a simple tower defense game. In it, the units follow the flow field to get to the endpoint, but when the user clicks to place a tower, those towers cast an influence over the surrounding area that the flow field takes into account.

The algorithm itself was fairly simple. Each tower in the game had its own maximum and minimum range at which the influence would be calculated, as well as a maximum value for the center. Using a specific mathematical formula, we can take the current distance into account and calculate the exact influence at any point within range. 

 

Once the influence is calculated, there are a number of ways you could use it to work with other pathfinding algorithms, especially ones that work with costs such as Dijkstra's, A*, or some other variation. For mine, I decided to work the influence data into my pre-existing flow-field algorithm. I created a new function called Propagate Influence to calculate the influence cast on each tile, and then simply added that influence cost to the cost field in my flow field data. This made it so the influence areas behaved almost like rough terrain, and would allow the flow field to calculate the best and most efficient paths through the map.

If I wanted to increase the strength of the influence and make it so the flow field avoided the towers better, all I had to do was raise the max influence on each tower, and I could fully adjust how strongly I wanted the path to avoid the influenced areas.

After I had the influence working, with a flow field, it was a simple matter to implement user controls and the enemies. The player can left-click to place towers with shorter range, and right-click to place towers with long-range. Each costs money, and the player earns money as the towers destroy enemies, which spawn continually faster as the game goes on. The goal is to place towers to halt the enemy unit's progress to the goal. The flow field will update every time a tower is placed, causing the enemies to reroute to where the danger is lowest.

There are some issues currently with the towers identifying and attacking the enemies, and if I were to continue working on this, I would make it far more visually appealing and easier to understand what is going on. I would also add more towers and variations with the influence map, to better demonstrate what the concept is capable of.

bottom of page