Which Game AI System to learn as a Beginner?

Redefine Gamedev
3 min readApr 9, 2022

When it comes to building an AI system, the game developer is presented with a lot of options. Be it a State Machine, a Behavior Tree, or even a Utility AI.

And these choices can be overwhelming…

By the end of this article you will get a clear picture of what is an AI System, what are the most common ways to implement decision making accompanied by their PROs and CONs.

The AI is much more…

Before we look into different decision systems, it’s important to note that…

… An AI System is much more than just its decision-making component. While an important part, implementing an FSM or a BT won’t make your AI Agent come to life. If you don’t know what FSMs / BTs are, don’t worry! Keep reading to find out.

Here are some of the other systems that are needed for a fully functional AI:

Pathfinding

When the AI receives an order to move from point A to point B a pathfinding algorithm is called. Its role is to inspect the environment around and provide a possible path that can be taken, without colliding with obstacles or other entities.

There are a lot of pathfinding algorithms, but by far the most popular in gamedev is A*.

Actions

Shooting, taking cover and leaping over obstacles. These are just some of the actions that can be performed by an AI.

Actions are a necessity. They have similar implementations to the regular player controller character since the decision-making part of the AI acts as a puppeteer. While, in the player’s case, it’s the human that has a similar role.

Besides pathfinding and actions, a complete AI system needs animations, sounds, effects, and much more.

Finite State Machines

Finite State Machines or FSMs are probably the first to appear in the Game AI world. They have their roots in math as many other systems found in a game.

At the core, a FSM is composed of STATES and TRANSITIONS. A state can hold an individual action as well as a sequence, depending on the developer’s needs. A state can connect with other states via transitions.

A transition is a link between states that can have one or more conditions. The power comes when adding relevant conditions to gain control of what the system can do.

One of the main pros of this system is the easiness to pick up and use. Create states and connect them. That’s it.

If you use a visual editor, this is even simpler. Most modern game engines already contain a State Machine implementation for AI, Animations or UI. They can even be repurposed from one use-case to another.

While all of this sounds great, what is the main drawback of using such a system? Well, as I discussed in this article, the complexity of a FSM can go out of control by adding more states and more transitions.

You should consider using FSM in the following situations:

  1. Your AI is not too complex — It will save you time and effort in implementation.
  2. You want to have lost of AI instances at the same time e.g. zombies, hordes.
  3. The AI designer has coding skills — To change what’s inside a state, coding skills are required.

If you want to know more about Finite State Machines, I’ve also written “Are State Machines still Relevant for AI?“.

Behavior Trees

[…]

Continue reading on redefinegamedev.com

Originally published at https://redefinegamedev.com.

--

--