GameDev

AI in Video Games: 7 Best Examples and How It Works

AI in Video Games: 7 Best Examples and How It Works

Game Dev for Beginners: 3 Professions Worth Trying

Find Out More

What is Artificial Intelligence?

To understand how artificial intelligence (AI) works, it is necessary to understand its basic essence. There is a widespread belief that AI is a kind of "brain" created on the basis of computer technology. While this claim has some merit, the concept of AI as a brain structure has been criticized and can be perceived as oversimplifying. This phenomenon was reflected, for example, in the cult game Fallout: New Vegas, where such ideas were parodied. Artificial intelligence, at its core, is complex algorithms and models that analyze data and make decisions based on it. A deeper understanding of AI requires studying its architecture, training methods, and scope of application, which allows us to assess its real potential and limitations.

Game artificial intelligence (AI) is a set of software solutions used in video games to create the illusion of intelligent behavior in non-player characters (NPCs). Game AI is based on algorithms developed based on control theories, robotics, and computer science. These technologies allow NPCs to make decisions, adapt to player actions, and provide realistic interactions during gameplay. Effective use of game AI significantly increases the level of engagement and interest in games, creating unique and dynamic game scenarios.

Frédéric Pelletier, Director of Technical Production at Ubisoft Mobile, noted that artificial intelligence in video games covers all elements that are not under the player's control during gameplay. This highlights the importance of AI in creating more realistic and engaging gaming experiences, as well as its role in automating game mechanics. The use of artificial intelligence allows developers to create more complex and adaptive scenarios, significantly improving player interaction with the game and increasing engagement.

Modern artificial intelligence technologies, including machine learning, give systems the ability to analyze data in virtual worlds and simulate human-like behavior. Previously, such capabilities were only available in science fiction, but today they are actively used in various fields. Artificial intelligence is finding application in business, medicine, education, and many other areas, improving processes, increasing efficiency, and opening new horizons for innovation.

Firas Hosn, an artificial intelligence programmer at Ubisoft, notes that modern gaming AI technologies actively use machine learning to optimize navigation in game worlds and perform complex tasks. Artificial intelligence is now capable of replicating human behavior with a high degree of realism, significantly improving gameplay and increasing player engagement. The development of AI in games opens new horizons for creating unique and immersive gaming experiences.

The Evolution of Artificial Intelligence in Video Games

Artificial intelligence (AI) in video games has come a long way since its inception. Its origins date back to the 1950s, when Alan Turing, a pioneer of computer science, created the Turochamp algorithm for playing chess. This algorithm was able to analyze the game board and make decisions based on limited rules, predicting only two moves ahead. While Turochamp could play against humans, it could not compete with professional chess players. AI technology has evolved significantly since then, and modern games use sophisticated algorithms that create more realistic character behavior and improve gameplay. Modern AI systems can learn from data, adapt to a user's play style, and provide deep strategic play, making them an important element in modern video game development.

In the 1970s, video games began to rapidly gain popularity, leading developers to increasingly explore artificial intelligence (AI). In the classic game Pong, AI controlled a paddle in response to the player's actions, marking the first step toward more complex game mechanics. However, enemy behavior in games of the time remained fairly primitive. In Space Invaders, the aliens' movement speed was determined by hardware limitations rather than the complexity of the software code. This created the illusion of dynamic gameplay, when in reality, the enemies were simply slowly approaching the player. As a result, despite their simplicity, these games laid the foundation for the further development of AI in video games, which subsequently led to more advanced and engaging gaming experiences.

With the advent of Pac-Man in the 1980s, artificial intelligence began to develop rapidly. This game implemented a pathfinding system, allowing the ghosts to adapt their actions based on the player's actions. Each ghost had unique behavior patterns, significantly increasing the strategic component and complexity of the gameplay. Thanks to such innovations, Pac-Man became not only a cult game of its time but also an important step in the evolution of artificial intelligence in video games.

Photo: Alexander Limbach / Shutterstock

In Nintendo's Donkey Kong, players face a variety of enemies, each with unique abilities. The developers focused on increasing the difficulty level, which required players to carefully study enemy behavior patterns. However, artificial intelligence at the time lacked adaptive capabilities, requiring players to memorize specific enemy actions to progress successfully. This created additional challenges and required concentration and strategic thinking.

By the late 1980s, amid the growing popularity of personal computers and game consoles, video games began to diversify thanks to improved processors. However, artificial intelligence (AI) still needed significant improvement. Developers recognized that high-quality AI was key to creating successful and engaging games that could attract players and provide them with an interesting gameplay experience.

Long Lin, head of artificial intelligence at Electronic Arts, emphasized that artificial intelligence has become an important element of the gaming industry due to its ability to refine various algorithms. Real-time strategy (RTS) games play a key role in the development of game AI, as enemy behavior directly impacts the interest and tension of gameplay. The use of AI in RTS allows for more complex and adaptive scenarios, significantly improving gameplay quality and increasing player engagement.

In the 1990s, developers sought to create artificial intelligence that would appear intelligent. However, non-player characters (NPCs) still lacked the ability to learn. Most of their behavior patterns were hard-coded, significantly limiting their functionality. This was due both to programming difficulties and to developers' concerns that unexpected NPC actions could negatively impact gameplay.

Danny Lange, Senior Vice President of Artificial Intelligence at Unity, emphasized that artificial intelligence has always played a key role in game creation, significantly improving user interaction with game worlds. The development of the gaming industry, in turn, has become a catalyst for the improvement of AI technologies, as gaming provides an optimal platform for testing and implementing new algorithms. Thus, the symbiosis between AI and game design not only enriches the player experience but also drives innovation in artificial intelligence.

One of the first games to feature learning NPCs was Petz. In this game, players could train their virtual pets based on their actions. This approach led to the game's popularity, as the pet's behavior adapted to each user's unique playstyle. This element of personalization became the foundation for the further development of games with interactive characters, bringing new levels of engagement and realism to the gameplay.

The introduction of machine learning in the gaming industry opens new horizons, but also creates certain challenges. Players can become focused on one location, which leads to artificial intelligence ignoring other game elements. This presents developers with the challenge of creating more complex and adaptive algorithms that can provide an engaging and varied gaming experience. It is important that AI not only responds to player actions but also offers new scenarios and challenges. Machine learning allows developers to create dynamic worlds that change based on player behavior, making every gaming session unique and engaging.

How does artificial intelligence impact gaming?

Artificial intelligence (AI) in video games plays a key role in creating engaging gaming experiences. Its primary purpose is not limited to simply competing with players but also to creating interesting and dynamic gaming situations. Properly configured AI significantly improves gameplay, making it more immersive and interactive. Using AI in video game development allows for the creation of adaptive opponents that adapt to the user's playstyle, increasing engagement and interest in the game.

In his book, "Programming Game Artificial Intelligence with Examples," Matt Buckland emphasizes the importance of AI in games. He argues that to create a truly engaging gaming experience, AI must not only provide a challenge but also lose more often than it wins. This allows players to feel clever, cunning, and powerful. This approach fosters positive emotions and increases player engagement, making gameplay more interesting and memorable. Effective AI must strike a balance between challenge and accessibility, a key aspect of successful video games. One of the most important functions of artificial intelligence in video games is the management of non-player characters (NPCs). Developers use various methods to enhance NPC intelligence. The most common is the finite state machine (FSM) algorithm, which has become popular in the video game industry since the 1990s. This approach allows NPCs to respond to player actions and the environment, creating a more realistic and engaging experience. Effective NPC management not only improves gameplay but also increases overall immersion, which is critical for modern developers.

Using a finite state machine (FSM), developers explore all possible artificial intelligence (AI) behavior scenarios and tune its responses to these situations. For example, in shooters, NPCs might attack the player upon their appearance, then retreat if their health drops below a certain threshold. This approach creates a more realistic interaction between the player and the NPC, significantly improving gameplay and increasing user engagement.

In a finite state machine (FSM), non-personal characters (NPCs) can perform key actions depending on the situation at hand. These key actions include seeking help, avoiding threats, navigating the game world, and attacking enemies. Games such as Battlefield, Call of Duty, and Tomb Raider clearly illustrate the effective use of this algorithm to create realistic NPC behavior, which significantly improves gameplay and player interaction.

Source: Harbing Lou / Harvard University. Infographics: Maya Malgina / Skillbox Media

Developers strive to create a more personalized gaming experience using the Monte Carlo Decision Tree Search (MCTS) algorithm. This algorithm was created to solve the repetitiveness problem inherent in finite state machines (FSMs). MCTS carefully analyzes all possible moves of non-player characters (NPCs) and the corresponding player responses, which makes the AI ​​behavior more varied and unpredictable. Due to this, players are provided with unique game situations, which significantly increases engagement and interest in the game. The use of MCTS promotes deeper interaction between players and NPCs, which in turn improves the overall gameplay and creates a more immersive atmosphere.

The MCTS (Monte Carlo Decision Tree) algorithm became widely known thanks to IBM, which used it in the development of Deep Blue, the world's first chess supercomputer. In 1997, Deep Blue achieved a historic victory over world chess champion Garry Kasparov, marking a significant milestone in the development of artificial intelligence and computer technology.

In strategy games like Civilization, the number of possible scenarios significantly exceeds chess matches. In such settings, the MCTS (Monte Carlo Tree Search) algorithm efficiently selects random moves from a variety of options. This avoids excessive computation and makes artificial intelligence more adaptive to various game situations. Using MCTS in strategy games provides a more flexible and diverse approach to decision-making, which, in turn, improves the quality of gameplay and makes it more engaging for players.

Justin Farren, executive producer at Wargaming, notes that the use of artificial intelligence allows for numerous experiments, evaluating hundreds of thousands of different actions. This helps identify those that provide the best gaming experience for users. Integrating AI into gameplay opens new horizons for improving gamers' interactions with games, making them more engaging and tailored to their preferences.

Source: Harbing Lou / Harvard University. Infographics: Maya Malgina / Skillbox Media

Modern Advances in Game Artificial Intelligence

Game artificial intelligence (AI) is now accepted as a common element, although its development has not yet reached expected heights. The algorithms used in video game AI have not undergone significant changes in recent years, which holds back the creation of truly intelligent game characters. The development of more complex and adaptive AI systems can significantly improve gameplay, providing players with a more realistic and engaging experience. It is important to continue exploring new approaches and technologies to enhance the level of interaction between players and game worlds.

The video game industry currently under-integrates modern research in artificial intelligence. This, according to Jacob Shrum, an associate professor of computer science at Georgetown Southwestern University, represents a significant omission. The implementation of advanced AI technologies can significantly improve the quality of gameplay, enhance player interaction, and create more realistic game worlds. The gaming industry must pay attention to advances in AI to remain competitive and offer unique user experiences.

Modern games continue to use traditional AI methods, but they can now take them to a higher level thanks to significant computing power. For example, games like Dark Souls 3 and Super Mario use the same core algorithms, but with varying levels of complexity and scaling. This allows for more realistic NPC behavior and improves overall gameplay. As a result, players receive a more immersive and dynamic experience, making each game unique.

Bruce Hill, programmer of The Sims 4, emphasizes that most game AI is created with the goal of providing a positive gaming experience. This makes AI actions predictable even for novice players.

In Dark Souls 3, bosses have a unique ability to anticipate player mistakes and react accordingly. This makes combat challenging and exciting. Despite their complexity, the boss mechanics in Dark Souls 3 are based on the same principles as simple enemies like Goombas from Super Mario. In both cases, enemies react to the player's actions, creating a dynamic gameplay environment where every decision matters.

Companies, including Google's DeepMind and Facebook's research division, are actively developing artificial intelligence capable of mastering complex video games. Research spans a wide range of games, from classic Atari titles to modern esports titles like Dota 2 and CS:GO. These efforts are aimed at creating AI that can not only analyze game strategies but also adapt to changing conditions, opening up new horizons for the application of technology in various fields. The development of AI for video games contributes to the improvement of machine learning algorithms and provides valuable data for further research in the field of artificial intelligence.

The successful application of artificial intelligence in the gaming industry was demonstrated at the OpenAI Five championship in 2019. In this tournament, an AI was able to defeat the professional esports team OG in the game Dota 2. The AI ​​used reinforcement learning methods and achieved significant results by learning without prior programming. This event marked a significant milestone in the development of AI technologies and their integration into the gaming environment, highlighting the potential of machine learning for creating complex gaming strategies.

OpenAI's artificial intelligence has accumulated 45,000 years of gameplay, learning through trial and error. Greg Brockman, co-founder of OpenAI, noted that the AI ​​initially focuses on recognizing visual elements. This process significantly simplifies the tasks it is tasked with. This approach allows the AI ​​to effectively adapt to various game situations and improve its skills.

The question of whether artificial intelligence can win in real-time strategy games like StarCraft remains relevant. The answer is yes: AI is capable of succeeding in such games. However, the complexity of gameplay mechanics requires the AI ​​to employ significantly more advanced solutions and algorithms. Developing effective AI systems for real-time strategy games involves deep learning and adaptive strategies, making this area of ​​research particularly interesting and challenging.

Despite a number of advantages, including multitasking and fast reaction times, developers sometimes intentionally limit the capabilities of artificial intelligence. This is done to create a more engaging and interesting gaming experience for users. Such limitations help maintain balance in the game and make interactions with game characters more immersive.

Tatiana Short, game designer and co-founder of Kitfox Games, emphasizes that the ideal artificial intelligence is one that remains invisible to the player, but at the right moments creates a sense of real intelligence. Such AI can enhance gameplay, making it more engaging and realistic. Developing artificial intelligence that seamlessly integrates into the game is becoming a key aspect of modern video game development.

Modern game developers focus not only on creating complex artificial intelligence systems but also on effectively integrating them into gameplay to achieve emergent gameplay. A prime example of such an implementation is Red Dead Redemption 2, where interactions with NPCs (non-player characters) lead to a variety of unique gameplay situations and unpredictable events. This strategy allows players to experience unique stories and interact with the world around them, significantly increasing the level of engagement and interest in the game. Effective integration of AI in game projects is becoming a key element in creating deep and memorable gaming experiences.

An example of the successful implementation of complex game systems is Dwarf Fortress. This game uses advanced mechanisms to create unique gameplay situations, including procedural level generation and diverse character states. Thanks to these systems, players are faced with unpredictable challenges and dynamically changing gameplay, making each session unique and exciting.

Dave Mark, the director of the Artificial Intelligence Summit at GDC 2015, emphasizes that much of the work of developers in the field of AI is closer to creating artificial behavior than to true artificial intelligence. This statement highlights the importance of understanding the difference between mimicking human behavior and creating autonomous intelligent systems. AI development often involves algorithms that, while seemingly intelligent, are in fact merely simulating responses to specific conditions. This raises questions about the future of AI and its potential in various fields, such as gaming, medicine, and automation. Middle-Earth: Shadow of Mordor stands out with its unique Nemesis system, which allows enemies to remember interactions with the player and evolve. This transforms each encounter into a unique experience, with opponents becoming more challenging and adapting to the player's playstyle. Thanks to this mechanic, players encounter dynamic and unpredictable combat, significantly increasing replayability and immersion in the world of Middle-earth. The Nemesis System makes every game truly unique, offering the opportunity to observe the evolution of enemies and their reactions to the player's actions.

Image: art for the game F.E.A.R. / Warner Bros. Interactive Entertainment

The Nemesis System offers a unique approach to gameplay, creating the illusion that enemies evolve and remember their encounters with the player. This adds significant depth and realism to the gaming experience. Richard Lemarchand, professor of game design, emphasizes that it is this aspect that makes the system so engaging for players, allowing them to experience more intense and dynamic battles.

F.E.A.R. set new standards for artificial intelligence in first-person shooters by giving NPCs the ability to develop long-term strategies. This significantly improves enemy behavior, making it more thoughtful and unpredictable. Thanks to this, players encounter more realistic and exciting battles, which increases the overall level of engagement with the gameplay.

Alien: Isolation takes innovative approaches to artificial intelligence, allowing the Alien to change its actions in response to player behavior. This creates a unique element of unpredictability, significantly enriching the gameplay and increasing the tension in the game.

Gary Napper, Principal Designer at Creative Assembly, emphasizes an important principle in the development of artificial intelligence: "We don't aim to deceive players; if you hear the Alien nearby, it means they can hear you too." This statement emphasizes the realism and interaction of the AI ​​with players, creating a tense atmosphere and enhancing the gaming experience. The development of such mechanisms allows for improved interaction between the player and the game, making the encounter with the Alien more exciting and tense.

Game Development: Choose Your Profession on a Free Mini-Course!

Want to Become a Game Designer or a 2D Artist? Learn more with a free mini-course!

Learn more