TEKVA
CoursesBlogConsultancy
Learn More
← Back to Blog

How the AI in video games work

12/11/2025

I don’t know about you, but I’m always like “wow” when I think about AI in video games. On the rare occasion that I play nowadays, I always have to stop a second and think how does this even work? Especially on games like FIFA and Call of Duty.

So, being the little nerd I am, I went and researched how they work and I’m here to present my findings…

For this post, I’m going to use my favourite game - FIFA - as a reference, but the concepts carry over to absolutely any game.

Step 1 - Perception

Okay, we’ve loaded up our favourite game (FIFA in my case) and we’ve started playing against the “CPU” or “AI” in an offline mode. The game has started and we start doing our thing, before the AI can do anything, it needs to gather data about what it currently sees in the game world. 

Blog Image

In fact, it's collecting data at every second of the game. In the case of FIFA, it’s collecting things like:

  1. Distance of the AI character from the ball
  2. Distance to the closest teammate
  3. Distance to the goal

Step 2 - Finding its Options

With all this information that the AI character has, the developers of the game can help it make a decision. This is actually quite easy to do in a video game because there are only so many things you can do.

For example, in FIFA, depending on if you have the ball or not, you can either: shoot, run, tackle, pass, dribble.

So all the AI has to do is calculate what the best action is from this limited amount of options at any given moment, which is quite easy to be honest. Developers often use decision trees to help find possible options for the AI.

Blog Image

Step 3 - Making a Decision

There will usually be multiple things the AI can do at any moment. To determine what it will do, it will assign a sort of utility score for each possible action. Here is the utility scores for the scenario shown below:

Blog Image

  • Pass utility: 0.7
  • Shoot utility: 0.5
  • Dribble utility: 0.3

Above, the AI has 3 possible options.

  • It could dribble, but it has data captured in Step 1 states there are 3 defenders in front, so the utility score will be low.
  • It could shoot, but the data captured in Step 1 shows a bad angle to goal, so the utility score will be low again.
  • It could pass, the data shows there are 3 teammates in open space, so the utility score will be high.

The AI would in this case opt to pass the ball as it has the highest utility score. However, if you decided to set the difficulty of the AI to a lower level, it may prefer to choose an action with a lower utility score.

Step 4 - Movement

What about movement? How do we stop the AI from running in random places on the pitch?

There are tons of methods actually, using algorithms like A* for example, but I will happily spare you the details about that.

One thing a game like FIFA can do is set fixed paths that an AI can use depending on what footballing position the player plays.

Blog Image
Blog Image

Developers can program the AI to stay among this path as much as possible, only leaving the path if it has the option to do something like tackle or dribble into open space.

Conclusion

At a high level, that’s really all there is to it.

I made no mention of Machine Learning, because most video games don’t really use it. But with the recent explosion of AI we’ve seen recently with ChatGPT etc, we can really expect AI to get a lot smarter - it will be interesting to see how this will change our gaming experience.