Building an AI for Games: The Basis

Carol Salvato
AL Game Code
Published in
4 min readJan 4, 2021

The field of artificial intelligence (AI) for games can address the most diverse subjects and subfields of intelligent systems. From the classic systems widely used in games like decision trees and state machines to more complex systems like neural networks, genetic algorithms and cognitive architectures. However, all of these systems, with the most diverse structures and complexity, have something in common when applied to games. The communication structure between the game and the AI is the same.

As the objective of this blog and its articles, and of our channel, is not only to share the progress of research in development but also of software and games, combining this with a little entertainment. Along with our way of researching, creating, implementing, and testing intelligent systems in games, we will use the main basis for applications, the basis of communication between the system and the game.

Leia este artigo em português aqui.

Abstraction, Generalization, and Functioning

The way the game will talk to the mind is one of the first and most important topics to be defined. When talking about a mind capable of playing different games, it is difficult to think of a single way in which the game will communicate with the agent. A lot can change depending on the type of game. For example, a game in 2D and another in 3D can have a very different quantity and shape of input data. Or the Snake game and a game like Minecraft, which are very different in almost every way. In most works in this field, it will be possible to find an image similar to that of Figure 1, which represents the most basic structure of communication between agents and environments.

Figure 1 — Illustration showing the representation of an agent (Mario) and an environment (game stage).

Perhaps the best and simplest way to define this abstraction so that it works in any environment is based on some key concepts linked to object-oriented programming and the objects themselves in digital games. We will work on the idea that digital games are basically composed of environments, objects, agents, and states. Both the environment as well as objects and the agent can have states, but mainly the agent can and must have actions (which in many works of literature is also considered a state).

Figure 2 — Image commonly found in works in the area that illustrates the communication between the agent and the game environment.

The environment and objects can be static or dynamic, since the agent will always be dynamic, having the ability to receive data from the environment and act on it. An agent is everything that has the capabilities already mentioned to perceive the environment and act on it. An intelligent agent, on the other hand, must be able to organize the information of the environment in patterns, use that information to select the best action, and learn to adapt his knowledge and behavior through feedbacks.

Figure 3 — Environments of your objects, and the agent (Pacman) that is part of the objects in the PacMan game environment.

What the agent will perceive the environment and how he will act depends a lot on each game. We will see more practical examples throughout this research. Today we seek to define in a simple and quick way this initial concept of communication between the environment and the agents, keep following the articles to learn more about each abstraction and specific application and how we can model a system for all types of games.

Read more in AL Game Code blog.

References to learn more:

AI for Games: Third Edition (Ian Millington)

AI for Game Developers (David M. Bourg, Glenn Seeman), 2004.

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

--

--

Carol Salvato
AL Game Code

Game Developer | Game Designer | Master's student in Artificial Intelligence and Cognitive Systems for Games{ carolsalvato.com }