In this recipe, we'll kill two birds with one stone and implement both an interface for group AI management and look at weighted decision making.
In many ways, the architecture will be similar to the Decision making – Finite State Machine recipe. It's recommended to have a look at it before making this recipe. The big difference from the normal state machine is that instead of the states having definite outcomes, an AI Manager will look at the current needs, and assign units to different tasks.
This recipe will also make use of an
AIControl class. This is also an extension of the
AIControl that can be found in the Creating a reusable AI control class recipe.
As an example, we'll use resource gathering units in an RTS. In ...