Table of Contents....5
About the Author....7
About the Technical Reviewer....8
Acknowledgments....9
Introduction....10
Chapter 1: Introduction....12
1.1 Artificial Intelligence....12
1.1.1 Intelligent Agents....13
1.1.2 AI in Video Games....15
1.2 Unity....18
1.2.1 Installing Unity Hub....19
1.2.2 Activating Your Unity ID and License....20
1.2.2.1 Manual Activation....24
1.2.2.2 Guided Activation....27
1.2.2.3 Installing Unity....30
Chapter 2: The Basics....34
2.1 Vectors....36
2.1.1 Addition....38
2.1.2 Subtraction....39
2.1.3 Scalar Multiplication....40
2.1.4 Dot Product....41
2.2 The First Project!....42
2.2.1 The First Scene!....46
2.2.2 The First Script!....48
2.2.3 Moving Toward a Point....53
2.2.4 Steering Behaviors....58
2.3 Test Your Knowledge!....61
Chapter 3: Paths and Waypoints....63
3.1 Graphs....63
3.2 Waypoints....67
3.2.1 A Simple Path....68
3.2.2 A Labyrinth!....75
3.3 Breadth-First Search....92
3.4 Exercises....101
Chapter 4: Navigation....102
4.1 Weighted Graphs....102
4.2 Navigation Mesh....106
4.3 A Star for Navigation....117
4.4 Programming Agents....119
4.5 Test Your Knowledge....124
Chapter 5: Behaviors....125
5.1 Guards! Guards!....127
5.1.1 Field of View....127
5.1.2 Agents, Behave!....131
5.1.3 Chase!....137
5.1.4 Investigate!....139
5.1.5 Patrol!....140
5.2 *Knock-Knock* – Who’s There?....143
5.3 Goodbye, AI....147
Index....148
Game developers will use this book to gain a basic knowledge of programming artificial intelligence using Unity and C#. You will not be bored learning the theory underpinning AI. Instead, you will learn by experience and practice, and complete an engaging project in each chapter.AI is the one of the most popular subjects in gaming today, ranging from controlling the behavior of non-player characters to procedural generated levels. This book starts with an introduction to AI and its use in games. Basic moving behaviors and pathfinding are covered, and then you move through more complex concepts of pathfinding and decision making.
Developers and programming enthusiasts with a basic knowledge of Unity and C# who want to understand and master the foundations of artificial intelligence in games