Implementing influence maps
Another way to use graphs is to represent how much reach or influence an agent, or, in this case, a unit, has over an area of the world. In this context, influence is represented as the total area of a map covered by an agent, or a group of agents from the same party.
This is a key element for creating good AI decision mechanisms based on top of military presence in real-time simulation games, or games where it is important to know how much of the world is taken up by a group of agents, each representing a given faction.
Getting ready
This is a recipe that requires experience of graph building, so it is based on the general Graph
class. That means that we will need to use a specific graph definition (no matter which one you prefer), or define our own methods to handle vertices and the neighbors' retrieval logic, as learned in Chapter 2, Navigation.
We will learn how to implement the specific algorithms for this recipe, which are based on top of the Graph
class general...