Book Image

Practical Game AI Programming

By : Micael DaGraça
Book Image

Practical Game AI Programming

By: Micael DaGraça

Overview of this book

The book starts with the basics examples of AI for different game genres and directly jumps into defining the probabilities and possibilities of the AI character to determine character movement. Next, you’ll learn how AI characters should behave within the environment created. Moving on, you’ll explore how to work with animations. You’ll also plan and create pruning strategies, and create Theta algorithms to find short and realistic looking game paths. Next, you’ll learn how the AI should behave when there is a lot of characters in the same scene. You'll explore which methods and algorithms, such as possibility maps, Forward Chaining Plan, Rete Algorithm, Pruning Strategies, Wall Distances, and Map Preprocess Implementation should be used on different occasions. You’ll discover how to overcome some limitations, and how to deliver a better experience to the player. By the end of the book, you think differently about AI.
Table of Contents (17 chapters)
Title Page
About the Author
About the Reviewer
Customer Feedback
Navigation Behavior and Pathfinding
AI Planning and Collision Avoidance

Enemy AI in video games

Now, let's move to the video game industry and analyze how the first enemies and game obstacles were programmed; was it that different from what we are doing now? Let's find out.

Single-player games with AI enemies started to appear in the 1970s, and soon, some games started to elevate the quality and expectations of what defines a video game AI. Some of those examples were released for arcade machines, such as Speed Race from Taito (a racing video game), or Qwak (a duck hunting game using a light gun), and Pursuit (an aircraft fighter) both from Atari. Other notable examples are the text-based games released for the first personal computers, such as Hunt the Wumpus and Star Trek, which also had enemies. What made those games so enjoyable was precisely that the AI enemies that didn't reacted like any other before because they had random elements mixed with the traditional stored patterns, making them unpredictable, and hence providing a unique experience every time you played the game. However, that was only possible due to the incorporation of microprocessors that expanded the capabilities of a programmer at that time. Space Invaders brought the movement patterns and Galaxian improved and added more variety, making the AI even more complex. PAC-MAN later on brought movement patterns to the maze genre.

The influence that the AI design in PAC-MAN had is just as significant as the influence of the game itself. This classic arcade game makes the player believe that the enemies in the game are chasing him, but not in a crude manner. The ghosts are chasing the player (or evading the player) in a different way as if they have an individual personality. This gives people the illusion that they are actually playing against four or five individual ghosts rather than copies of the same computer enemy.

After that, Karate Champ introduced the first AI fighting character and Dragon Quest introduced the tactical system for the RPG genre; over the years, the list of games that explored artificial intelligence and used it to create unique game concepts kept expanding, and all of that came from a single question, how can we make a computer capable of beating a human in a game?

All the games mentioned above are of a different genre, and they are unique in their style, but all of them used the same method for the AI called finite-state machine (FSM). Here, the programmer inputs all the behaviors necessary for the computer to challenge the player, just like the computer that first played chess. The programmer defined exactly how the computer should behave on different occasions in order to move, avoid, attack, or perform any other behavior to challenge the player, and that method is used even in the latest big budget games of