Influence maps - with example (Wargame)

Influence maps are a visualization of danger by a computer-controlled entity in many types of games. For simplicity think about your game map as a tile map with dimension (n,m) with a player vs player controlled AI.

In this scenario, player can move his units by one cell and if near an enemy unit, attack it. Same rules are for enemy units, with a centralized enemy AI (no single agents).

With this in mind, here my quick example:

It’s a small demo of how to create a small AI (I mean, not real AI, just a first version of computer opponent) for turn based and real based strategy game.

For source code =>
And for more explanation on my blog =>

Please give me feedback and ideas, I’m always open to discussion!

This seems very similar to pathfinding; can you elaborate on the differences?

Yeah it’s really similar. In my mind influence maps could be really useful when you don’t need to compute a path between game entity and target, but decide what is next move.

In path-finding world, imagine your game entity have two enemies, out of sight. In this case AI could:

  1. move game entity randomly until enemies are in sight, so use ray-cast or path-finding
  2. cheat a little and compute a path for each enemy and then decide what enemy is more dangerous

With influence maps you can compute in one update a map of danger for your game entity and for example decide that two enemies too near are much dangerous than one alone and so on.

Bonus: I find influence maps really cool to understand and debug AI “reasoning”

find needed link)