Chapter 1, The Basics of AI in Games, gets the reader up to speed with the basic terminology we'll be working with. In order to build up to the more advanced concepts in the book, we first lay the groundwork and expectations for the following chapters. This introductory chapter provides a preview of some of the concepts covered and prepares the reader with the necessary knowledge to be successful in the sample projects and code to follow.
Chapter 2, Finite State Machines and You, jumps right into one of the most essential concepts in game AI--the finite state machine. The chapter starts with a conceptual overview and then dives into an implementation of a state machine in Unity using the built-in features, such as Mecanim and StateMachineBehaviours. This chapter is the first to take the user through an actual example and sets the tone for how future chapters will explain the concepts they cover.
Chapter 3, Implementing Sensors, builds on the concept of the AI agent by providing the reader the knowledge and techniques to make their AI more believable. In this chapter, the reader learns how to implement sensing for their agents, allowing them to collect data and information from their virtual surroundings, thus enabling more complex interactions with their environment. The output of the agent is only as good as the input, and this chapter ensures that the reader can implement sensing mechanisms to give AI behaviors solid inputs to base their algorithms on.
Chapter 4, Finding Your Way, takes the reader's knowledge to the next level. With the skills from the previous three chapters to build on, the reader is now given the tools to have their AI agent navigate the game world. A few different alternatives are explained in detail, such as node-based pathfinding, the near-standard A* algorithm approach, and finally, Unity's NavMesh system. Examples are provided for each, and the user is given the necessary knowledge to pick the right approach for each situation.
Chapter 5, Flocks and Crowds, covers the history and implementation of a standard flocking algorithm. Along with some history on the topic, the user is walked through a sample project that implements flocking to create convincing boid systems to model birds, fish, locusts, or any other flocking behavior. In the later portion of the chapter, the reader is introduced to implementing simple crowd dynamics using Unity's NavMesh system. Once again, sample scenes are provided to illustrate the different implementations.
Chapter 6, Behavior Trees, showcases another handy tool in the AI game programmer's tool belt: the behavior tree. The chapter teaches readers the concepts behind behavior trees, walks them through a custom implementation, and applies the knowledge learned in two examples: a simple math-based example and a more fun and frankly silly example we call HomeRock, which emulates a popular online card game to showcase behavior trees in action.
Chapter 7, Using Fuzzy Logic to Make Your AI Seem Alive, sets the stage with a long and descriptive title, right? This chapter covers the fundamental concepts in fuzzy logic and the approach for converting fuzzy values to concrete values and explains a simple approach for implementing fuzzy logic in Unity. The first example illustrates the simplest possible version of the concepts, and the second example illustrates a morality/faction system like you'd find in an RPG to illustrate the usefulness of fuzzy logic.
Chapter 8, How It All Comes Together, takes concepts the reader has learned throughout the book and throws them into a sample tower defense example project. This chapter illustrates how, by taking a handful of AI techniques, you can quickly throw together a game that implements AI NPCs and enemies and gives them rudimentary decision-making abilities.