Utility based AI - Falmouth-Games-Academy/comp250-wiki GitHub Wiki

Overview

To prioritise,
To choose from all that is there,
This is the method

Utility AI is a method for determining what an AI should do based on the information given to it. Behaviour Trees and Finite State Machines can provide a similar behaviour. However, both of those require a structure consisting of nodes connected to each other, causing information to need to traverse across them to get to the desired state. With utility based AI, the states are directly accessed. The variable factor with the highest priority will determine which state will be chosen.

Approaches to utility AI

There are two main types of approaches to utility AI1. Absolute utility and relative4 utility. The first is evaluates every option and uses the option with the highest priority. The second again evaluates the priority of each option and gives them a probability, in which that option will be chosen. Using these two approaches you can create a dual utility reasoner which assigns two. A priority value/rank and probability/weight. It is also known as weight-based2 random or weighted random.

Different curves

There are different ways to create response curves5 to affect the weight and or rank given to an option for the AI to take. In this article6 the author demonstrates how different mathematical formulas on inputs values given to the AI can affect the choice the AI picks, through the visual aid of graphs to show lots of states at once. The same is shown in by7. They both convey how this can keep things modular and simple.

In their examples, they show how it could be applied to a game which involves fighting an enemy through healing priority. Healing priority coupled with health is mapped to a backwards 'S', stretched out and less defined. It shows that the AI would not care much about finding a health pack at the beginning when they start to lose health, so the priority would be less than 0.2 (between 0 and 1, 1 being very high priority). As their health approaches halfway, the priority to get more health also increases but now at a faster rate, to a priority of 0.5. Then finally as their health gets below 50%, the priority starts to drop off as the AI knows that it's going to lose soon so will spend the last of its life trying deal the last amount of damage, whilst it can, as it probably doesn't have time to heal. These curves can be applied to both absolute utility and relative utility1 as they're just one part which influences decision making.

Vs Behaviour trees

Are Behavior Trees a Thing of the Past, looks at how behaviour trees differ from utility based AI. The author(s) note that behaviour trees are harder to maintain as they are more error prone and hard to debug. On the other hand, utility based AI could still be improved upon with machine learning but at the time of the article, games have yet to implement that. However, games have been using utility based AI for a while: Killzone 2, F.E.A.R, Civilization, Quake bots. There have also been attempts at combining behaviour trees with utility based AI3.

Sources

1 I. Millington and J. Funge, Artificial Intelligence for Games. London: CRC Press, 2016, pp. 37-38. [Online]. Available: http://gameaibook.org/book.pdf#page=59 [Accessed: 13- Feb- 2019]

2 Dill, Kevin, et al. "Design patterns for the configuration of utility-based ai." Interservice/Industry Training, Simulation, and Education Conference (I/ITSEC). No. 12146. 2012.

3 K. Dill and L. Martin. A game AI approach to autonomous control of virtual characters. In Interservice/Industry Training, Simulation, and Education Conference (I/ITSEC), 2011.

4 D. Mark. Behavioral Mathematics for game AI. Charles River Media, 2009, pp. 221. [Online]. Available: http://gameaibook.org/book.pdf#page=59 [Accessed: 13- Feb- 2019]

5 B. Alexander. The beauty of response curves. AI Game Programming Wisdom, 2002.

6 A. Aitchison. At-a-glance functions for modelling utility-based game AI. 2013. [Online]. Available: https://alastaira.wordpress.com/2013/01/25/at-a-glance-functions-for-modelling-utility-based-game-ai/ [Accessed: 14- Feb- 2019]

7 D. Graham. An Introduction to Utility Theory. Game AI Pro. 2013 [Online]. Available: http://www.gameaipro.com/GameAIPro/GameAIPro_Chapter09_An_Introduction_to_Utility_Theory.pdf [Accessed: 14- Feb- 2019]

⚠️ **GitHub.com Fallback** ⚠️