Skip to content

Utility AI

Utility AI, also known as Needs-Based AI, is a behavioral artificial intelligence technique that defines a collection of needs that have a necessity curve assigned to them and a Score value that can grow or decrease over time.

Type of Game

This AI technique is mostly suited for organic simulation games, such as The Sims.

At any point the need task to use is determined by comparing all Scores and applying the easing curve to it. The need task with the highest resulting value will be picked and executed.

Two Needs

Let's say we have an Utility Board with just two needs, with very different curves:

  • Cook some Rice: The need to cook and eat grows over time, as the hunger increases.
  • Call a Friend: The need to call a friend decreases as the socialization value is met.

Note that the Call a Friend curve slightly increases a bit at the end. This is because once a character is socializing, it keeps wanting to socialize, unlike with hunger, where once a human is full, it doesn't want to eat anymore.

Utility AI graph example

If we were to execute this graph, if the hunger level was high it would likely pick the Cook some Rice task. However if the socialization needs are very low it would likely pick the option to Call a Friend.

Curves allow to tweak the resulting value and model different responses based on a set of dynamic values that change over time.

Game Maker's Toolkit on Utility AI

Mark Brown from Game Maker's Toolkit put up a very nice and rounded video covering how the AI of The Sims work. It's filled with good ideas and high-level knowledge that designers can use to get started.

Game Maker's Toolkit video on Utility AI

Pair with other AI systems

Utility AI pairs very well with other AI systems, such as Behavior Trees or GOAP. Each need node can contain other sub graphs from other systems that delegate the complexity of executing the action that fulfills the need.