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

A brief history of and solutions to game AI

To better understand how to overcome the problems that game developers are currently facing, we need to dig a little bit into the history of video game development and take a look at the problems and their solutions that were so important at the time. Some of them were so avant-garde that they actually changed the entire history of video game design itself, and we still use the same methods today to create unique and enjoyable games.

One of the first relevant marks that is always worth mentioning when talking about game AI is computer chess programmed to compete against humans. It was the perfect game to start experimenting with artificial intelligence, because chess usually requires a lot of thought and planning ahead, something that a computer couldn't do at the time because it was necessary to have human features in order to successfully play and win the game. So, the first step was to make it able for the computer to process the game rules and think for itself in order to make a good judgement of the next move that the computer should do to achieve the final goal, that is, winning by checkmating. The problem is that chess has many possibilities; so, even if the computer had a perfect strategy to beat the game, it was necessary to recalculate that strategy, adapting it, changing, or even creating a new one every time something went wrong with the first strategy.

Humans can play differently every time; this makes it a huge task for the programmers to input all the possible data into the computer in order to win the game. So, writing all the possibilities that could exist wasn't a viable solution, and because of that, the programmers needed to think again about the problem. Then, one day, they finally came out with a better solution, that is, to make the computer decide for itself every turn, choosing the most plausible option for each turn; that way, the computer could adapt to any possibility in the game. Yet, this involved another problem €“the computer would only think the short-term moves, and not create any plans to defeat the human in the future moves; so, it was easy to play against it, but at least we started to have something going on. It was decades later that someone defined the word Artificial Intelligence (AI) by solving the first problem that many researchers had by trying to create a computer that was capable of defeating a human player. Arthur Samuel is the person responsible for creating a computer that could learn for itself and memorize all the possible combinations. That way, there wasn't necessarily any human intervention and the computer could actually think on its own, and that was a huge step that is still impressive even by today's standards.