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

Animation state machines

We have already talked about behavior states, where we define the possible actions of a character and how to link them. Animation state machines is a very similar process, but instead of defining the actions, we define the animations of a character. While developing the character and creating the behavior states, we could assign the animations in the action code, defining at which point the character starts to run, and once that happens, the walk animation stops and the run animation starts playing. This way of integrating the animations with the gameplay code looks like an easier approach to do it, but it's not the best way and it gets complicated if we want to update the code later on.

The solution to this problem is to create a separate state machine just for the animations. This will allow us to have better control of the animations without worrying about changing our character's code. It is a good method to use between programmer and animator as well, because...