Artificial Intelligence is an important part of any game. What AI is covers a large aspect of the game as well. One focus on the game for me has been creating the AI for computer controlled Demigods. This is the skirmish AI for Demigod.
In Demigod, we sought to create a skirmish AI that would be interesting and fun to fight against. We wanted to make sure the Demigods fought well, but we also wanted the AI to feel different when you fight against it. The AI doing the same thing every time you fight against it limits your replayability.
We are using a type of Goal based AI referred to as Goal Oriented Action Planning or GOAP. A goal for the AI is an issue the AI wants to fix. If there is a “health” goal, the AI might want to use a health potion. In GOAP, there are a number of goals and the AI creates a series of actions to fulfill ALL of the goals. We are using a system based on this concept for Demigod.
An AI agent has a number of sensors examining the world. These sensors populate a number of goals for the AI agent. Whenever the AI agent is idle, the AI agent will create a plan to fulfill all of the goals given to it. The AI has a number of actions and determines which action to do in what order. This is the “P” in GOAP.
One of the great things about the system is that the AI will often do things you would not expect. Based on what an agent can do and what an agent thinks it can do, you can get some interesting and often unpredictable results.
It also makes extending the functionality of an AI very achievable. If we change the abilities of a certain Demigod, we simply tell the AI for that Demigod what changed and away it goes. We do not have to spend time rebuilding complicated scenarios for what demigod should do in what situation!
This is exciting stuff for us. The use of GOAP has been a huge boon for making Demigod. We are really gunning to make the skirmish AI in this product something awesome.