Different algorithms are more suitable in different places and here we want to take an overview of usefulness of utility AI for different game mechanics and genres. Of course all types of algorithms and toolsets can be used in many different situations but it is important to use what is more useful, more efficient or faster/easier to use for the job. We made this library and use it for our internal projects and are selling it too so you know our biases too and everybody else have theirs too but we try to be clear and objective as much as we can.

Features which Utility AI can add to almost all types of games

Live worlds

Utility AI allows you to make worlds which their NPCs live for themselves and have their own desires, goals and act in their own and their societies interest.

Deep Worlds

Having complex AI and live worlds would mean that the worlds become very deep and when you play in them, you feel immersed in a universe or situation or point in time unlike anything else you’ve ever seen.

Story telling systems

The best stories have conflict, events and situations. The best tool to create these situations is utility AI because it is not rigid and it can react to what happend in the environment. Specially if you combine it with tags, smart objects and influence maps then it can use the environment effectively and know a great deal about the world which helps it make decisions which seem real and in context.

Personality Changes

A character’s personality usually changes in real life and in stories. We love to see these and these changes surprise us. they bring us pain and pleasure. We also get excited about them. In general when something unexpected or unknown happens, feelings of hope and fear increase.

Utility AI can easily make this possible without you trying too much to offer specific changes in the AI design. If your AI has personality attributes and the considerations check those attributes to decide what to do, then you can alter the behavior by changing the attributes.

Let’s say you decide if a healer NPC goes near a danger zone to help a woonded soldier or not by checking its health and braveness and if he has health pack or not. With Utility AI you can easily change a healer’s braveness the more it saves people or the more he doesn’t get killed or even better when somebody important to the NPC dies or a dramatic event happens. Imagine a dragon attacking a city and you want it to cause all NPCs to get frightened, you can reduce the braveness of characters by half and the very weak souls can remain in a shelter enough to die of starvation. It is very hard to code this without utility AI.

Player generated behaviors even for NPCs

Since utility AI by nature is very parameterized and all actions are considered all the time, if you allow players to define events, items or NPCs behavior by modifying their attributes then they can change behaviors enough that a new sort of user generated content is made.

Consider the healer example in the personality changes part, if a player can craft their own items and the item can increase people’s braveness then you can have a pill which people take to get brave and this can value a lot. You can buy 100 of them for yoursoldiers. That is if you think it is a good strategy of course.

To keep the game balanced you can increase the cost of larger changes which the items affect or require lowering of character XP for the crafter or ask them to sacrifice something big/do a hard quest for the ability to make powerful items. Let’s say there is a crafting ability and the first increase in braveness requires one reduction in crafting but the second increase requires 2 and then third one requires 4 and it goes up exponentially. In this way you can enable players to make content for the game in a way that is very meaningful and valuable but without utility AI designing and using these sorts of things is very hard.

Easy behavior modification

Adding new behaviors or modifying the current ones is much easier with Utility AI since you can add the action to the list of actions and order doesn’t matter. Other than order, the fact that you add it to a single place and you cannot forget a transition makes it easier too.

The AI still needs to have correct considerations and curves for a correct score but this exists for every action no matter when it is added and also allows you to compartmentalize the score calculation per action which helps. Every consideration is explicit so if the new action should not happen when the character has a gun, no order or lack of existence of a transition indicates that implicitly but the action itself has a consideration for that. Every programmer or designer with experience knows explicit things are easier to know about and change since they are in fron of you and you cannot miss them.

Natural behavior

Because Utility AI considers all actions all the time, the behavior tends to become more natural and considering all the context which is possible but harder to get using other ways of making AI.

Immersive Worlds

When characters of a world act as if their own life matters and the events in the world really change things around, you feel that things are real and get immersed in it. Specially when events have lasting impact, you take them more seriously. Utility AI helps you to incorporate these things in a much easier way than AIs with rigid structures.

Usually events either change attitudes and personal characteristics of people or change their environment and utility AI can easily deal with both thanks to curve shape changes, reading of attributes from variables dynamically and also things like tags and influence maps which help it to make decisions based on the environment. If you want to cause players to be afraid of a place which is attacked on a regular basis, it is enough to put this data somewhere in a knowledge base and then add actions which do something in relation to these sorts of data and modify other actions based on them.

For example, bring water home action can avoid those areas and guards can guard toward that direction more heavily but also running away action can be added for the time people are in the dangerous areas at night. Doing this in a scripted AI system with rigid structures like behavior trees or state machines is really hard and tuning something like a goal oriented system for correct behavior is next to impossible. This becomes much harder if you want these to be dynamic and not predefined.

Utility AI helps you to compartmentalize each action’s considerations and scoring mechanism and easily make them effected by these events and other changes. It is still work to do but much less than the other options.

Examples in Different game genres

Third person shooters and FPS games

Shooters did not need very complex AIs back then where the actions were limited and the cover points were pretty well-known and static but these days that the maps are dynamic and the number of weapons is huge. It would be very helpful if your AI could decide its action based on some heuristics to see what action is the best in this moment in time.

Utility AI allows you to do that so your NPCs can play and decide like a human does and appear very smart and interesting to play against, by your actual players. The NPC can surprize the players and force them to apply new tatctics just like when they play against real humans.

Adventure games

The main point of most adventure games is to make you feel you are going through a jurney and the more natural and immersive it becomes, it’s better. Utility AI allows you to make NPCs which are not very simple and stupid and have their own desires, have personalities and modify their behavior based on what you will do and what happend.

RPG games

Roll playing games intend to simulate a situation which you can immerse yourself in. their ultimate goal is to help you feel that you are in an environment or situation. However the AI for NPCs fall short of this by having stupid dialog or a very strict and limited behavior. Utility AI is the cure for this to give the NPCs their own desires and lives.

Utility AI allows you to give your NPCs lots of behaviors and desires so they act in a believable manner. You can give them considerations which checks what other NPCs and players are doing and the personality of the NPC itself when it wants to choose what to do.

In RPGs events and quests matter a lot. Utility AI can help your NPCs a lot to react based on what events and quests have happend or are going on, and act based on those. Another good thing is that if a designer adds a new quest which causes say a rain of fire, it can easily add an action to the list of actions for NPCs to go home or to a shelter when this happens without getting worried that if it is executing in the correct place in a behavior tree, or if all needed transitions are added in the FSM of the characters.

Card and board games

This genre also benefits a lot from being able to code the AI in the way that a human thinks. Imagine that you are making a poker or blackjack. How the AI should decide what card to play next or what to do in general? Should it draw another card or not? Utility AI allows you to encode how a player plays into your AI.

You can code considerations which highlight what situations a card is a good one to play. Then you allow them all to compete with each other and the best action for the situation is chosen. You don’t have to exactly say when this action should happen which is very hard when you don’t know what the opponent will exactly do. In a simple platformer you have a set of limited actions which you will work against but in a card game or a board game either you have to have a huge amount of memory and analyze the complete space of the game which works with games with less randomness like chess or go but not as well for games with randomness in their rules but a very good AI which is fun to play with can be made using actions and considerations relatively easily if you research how human players think when choosing their next move and how do they assess usefulness of each action.

Simulation games

This is the genre that had one of its most famous games made using Utility AI. The sims uses Utility AI and you can find lots of materials about it online from GDC talks to university papers. Utility AI is literally simulating how people make decisions so they are best suited to simulate how intelligent entities behave in a world. All other algorithms should try to mimic how the brain works but utility AI is simulating it directly. It is possible to mimic the behavior with other algorithms partially but utility AI is the best way to do this.

MMOs and MMORPGS

MMORPGs are essentially role playing games so whatever applies to RPGs applies to these as well. Only worlds are deeper and expectations are higher because NPC behaviors are compared to human behaviors and they usually are immersion brakers and not immersion makers. Utility AI can help you break this and make NPCs which are deep, have many actions and act according to their interests and what happend in the world and not based on a simple and small tree. Also you can share the behavior between NPCs with minor personality changes since the behaviors are not rigid anyways and just different NPCs decide a bit more differently compared to others.

A brave soldier and his coward comrade can use the same behavior but the brave one have a higher accuracy of attacking and tends to choose more risky behaviors.

Sandbox games

Sandbox games are known for lots of choices and possibilities. A good AI for a sandbox games should be able to deal with unexpected situations and act smartly or interestingly in them. The best Ai to react to dynamic unknown situations is Utility AI.

Survival games

Again a survival game is a specific sort of sandbox game which somehow is an RPG too which is about surviving so whatever which applies to them, will apply to these as well.

Metaverses or metaverse games

The idea of the metaverse is that different experiences made by different players can be mixed up and interact with each other. The only AI algorithm which can work in an unexpected environment given that the way it calculates considerations and execute actions is compatible with the environment is utility AI. The rules are not hard coded and are softly specified so you check if any enemy object is around and shoot at them and having low high health or lots of enemies and no cover gives the shooting action a high score. The only key is to identify enemies in a way that all experiences can specify it. Using tags is a good way of doing this. If that is the case that all enemies of your NPC/agent have an enemy tag attached to them then your AI can react to them even if it doesn’t know how exactly they would behave. Faction names or even a mamory of what actions an agent took can be used for this as well. This will not be perfect and not as good as when you exactly know what will be the behavior of those enemies but still Utility AI is the only system which allows you to do this.

In theory any AI which checks conditions which are calculated based on dynamic parameters will be more adaptable to experiences which not all of them are authored by you. but in action a state machine or behavior tree or even a planner will only work if the conditions are known to produce the best result for that situation. Their transitions have order and are more explicit. This can be helpful in a very scripted situation but not when the situation is unknown or has too many parameters. They don’t work based on heuristics and that is the major difference between them and utility AI.

If you have a state machine which transitions from a state based on heuristics and not only when it is sure that this specific transition to another state is the best one then it is effectively limited utility AI which each action can only be switched to a selected number of others and not all of them. Also if a behavior tree’s nodes are selected in a similar manner then it is the same thing and the only difference is that the actions and their score comparisons have implicit orderings and each action will only activate after a threshold or if you basically have a root with all actions as its children evaluated in parallel and then one selected based on their score, then it is utility AI.

In the same spirit, Utility AI can be turned into a behavior tree or state machine or can become a bit more rigid in its structure if you use appropriate considerations. Imagine a consideration which gives a score higher than 0 for an action only if the currently executing action is shooting, that can be used to have some actions effectively only available in the graph of your decisions as children of the shooting action. Usually such a graph doesn’t exist in utility AI or at least it is not easy to draw but if you want to turn your utility AI into that, you can.

But that is not the point. The point is not to show each AI algorithm can more or less implement the others if you stretch it with some degree of success. It is not a useful practice and it is better to use the tool which is suitable for that specific sort of way that you want to offer your AI behaviors. And in this sense and compared to other known algorithms, utility AI works best in unknown environments which the decisions don’t have definitive answers. Wait the real world is like that! 🙂 And this is another difference of utility AI compared to the others. It is derived from a theory which tries to decode human behavior in the real world which what we want to simulate and not an abstraction created to be able to model a decision tree with accuracy.