Utility AI

What is Utility AI?


Utility AI is a popular AI type for video games which uses factors to calculate an overall utility value for every possible action. The Action chosen is then based on either the highest utility or a weighted random selection based on the relative utilities.

Dave Mark popularized Utility AI and has some excellent talks that go into great detail:

Total AI's Utility AI System


Total AI accomplishes a Utility AI system with four main parts:

  • UtilityAIPT: Generates the Plans for Utility AI. These plans do not chain so they all consist of one Mapping. It will return all possible Mapping Types that meet the Input Conditions. Currently it uses the Mapping Types Target Factors to select the best Entity Target/Inventory Target. A future feature will allow all targets to be chosen as separate Plans, allowing the Utility Modifiers to also figure in Targets.

  • UtilityAIDT: The Decider Type should have UtilityAIPT set as its only Planner Type. It also requires a "fake" Drive Type. Create a "Default" Drive Type and set in in inspector. This allows Utility AI to play nice with the rest of Total AI. The Drive Type can be ignored though and does not need to be reduced in Mapping Types.

  • Mapping Type's Utility Modifiers: Generates a utility value based on the current state of the Agent and the World. The logic is contained in its Utility Modifier Type. See Utilty Modifier Type Script.

  • UtilityAIUFT: Combines each Mapping Type's Utility Modifiers into a weighted average utility value. This can be modified to handle more complex combination methods of Utility Modifiers. UtilityAIDT calls this to get the Utility value for each possible Mapping.