Artificial Intelligence in Unreal Engine 5....2
Contributors....6
About the author....6
About the reviewers....7
Preface....31
Who this book is for....32
What this book covers....33
To get the most out of this book....35
Download the example code files....36
Conventions used....36
Get in touch....37
Share Your Thoughts....38
Download a free PDF copy of this book....38
Part 1: Introducing Artificial Intelligence in Games....41
Chapter 1: Getting Started with AI Game Development....42
Technical requirements....43
Prerequisite knowledge....43
Hardware requirements....45
Software requirements....46
Introducing AI....50
Understanding AI in game development....53
Explaining AI techniques in video games....55
Pathfinding....56
Rule-based....58
Finite state machines....59
Behavior trees....60
Machine learning AI....62
Reinforcement learning....63
Generative AI....64
Summary....64
Credits....65
Chapter 2: Introducing the Unreal Engine AI System....66
Technical requirements....67
Getting to know the Unreal Engine Gameplay Framework....67
Actors and components....68
Main GF elements....70
GameplayStatics....72
Presenting the Unreal Engine AI system....73
Navigation System....74
Behavior trees....76
Mass Entity....78
State tree....80
Smart objects....82
Environment Query System....84
AI Perception System....86
AI debugging....87
Understanding advanced AI features....90
Learning Agents....90
Neural network engine....91
ML Deformer....92
ML cloth simulation....93
Summary....94
Part 2: Understanding the Navigation System....95
Chapter 3: Presenting the Unreal Engine Navigation System....96
Technical requirements....97
Introducing AI movement....97
Understanding the Navigation Mesh....98
Modifying the nav mesh....103
AI agents....109
Avoidance....110
Understanding pathfinding....111
Testing the Navigation System with a project template....114
Setting up the project....114
Analyzing the nav mesh....116
Analyzing the character controller....124
Testing the project....125
Summary....125
Chapter 4: Setting Up a Navigation Mesh....127
Technical requirements....128
Introducing Unreal Agility Arena....128
Explaining the project brief....129
Starting the project....131
Creating an AI agent....133
Creating the agent....136
Adding the navigation logic....138
Setting up a basic level....139
Creating the level....140
Adding the nav mesh....142
Adding the agent....143
Testing the gym....145
Adding navigation modifiers....146
Creating the level....146
Incorporating a modifier....148
Improving the level....153
Creating custom modifiers....156
Applying the custom modifiers....159
Testing the level....161
Working with navigation link proxies....162
Creating the level....162
Adding a Nav Link Proxy....165
Testing the gym....167
Summary....168
Chapter 5: Improving Agent Navigation....170
Technical requirements....171
Generating navigation meshes at runtime....171
Creating the level....172
Adding a moving platform....178
Making the nav mesh dynamic....185
Influencing navigation with query filters....188
Creating the level....189
Creating the query filter class....190
Modifying the agent....192
Implementing agent avoidance....193
Creating the level....194
Adding the agents....195
Activating avoidance....198
Testing a worst-case scenario....198
Summary....200
Chapter 6: Optimizing the Navigation System....202
Technical requirements....203
Understanding the nav mesh debugging tool....203
Enabling the AI debugging tools....204
Inspecting the AI debugging tool....206
Analyzing nav mesh resolution....211
Refining nav mesh generation....215
Influencing nav mesh resolution....216
Changing nav mesh resolution....219
Changing the tile size....220
Making further improvements....224
Tweaking resolution....224
Disabling mesh influence....226
Summary....232
Part 3: Working with Decision Making....233
Chapter 7: Introducing Behavior Trees....234
Technical requirements....234
Explaining behavior trees....235
Behavior tree structure....236
What is a behavior tree in Unreal Engine?....239
Behavior tree node instancing....240
Order of execution....240
Understanding behavior trees in Unreal Engine....242
The root node....243
Task nodes....243
Composite nodes....245
Decorators....248
Services....250
Understanding the Blackboard....251
Summary....254
Chapter 8: Setting Up a Behavior Tree....256
Technical requirements....256
Extending the Unreal Agility Arena....257
Updating the project brief....258
Creating the project....259
Creating the character....261
Handling the battery status....263
Implementing the character....265
Creating a behavior tree....277
Creating the AI controller....277
Creating the Blackboard....280
Creating the behavior tree....283
Implementing behavior tree tasks and services....285
Implementing the FindRandomLocation task....287
Implementing the SpeedControl service....289
Implementing the BatteryCheck service....292
Setting up a behavior tree on an agent....297
Editing the behavior tree....298
Creating the AI agent Blueprints....305
Testing an agent in a gym....312
Summary....316
Chapter 9: Extending Behavior Trees....317
Technical requirements....317
Presenting best practices for authoring behavior trees....318
Listing best practices....319
Implementing a gunner character logic....323
Implementing a Target class....333
Creating the Blueprints....335
Understanding decorators....347
Explaining the BTAuxiliaryNode class....347
Creating C++ decorators....348
Creating Blueprint decorators....349
Implementing the CheckTagOnActor decorator....350
Understanding services....354
Creating C++ services....354
Creating Blueprint services....355
Implementing the SetAmmo service....357
Understanding tasks....359
Creating C++ tasks....359
Creating Blueprint tasks....360
Implementing the PlayMontage task....361
Implementing the FindAvailableTarget task....363
Debugging behavior trees....365
Creating the Blackboard....366
Creating the behavior tree....367
Creating the AI controller....377
Debugging the behavior tree on a gym....377
Summary....382
Chapter 10: Improving Agents with the Perception System....384
Technical requirements....385
Presenting the Perception System....385
AI Perception System components....387
AIPerceptionSenseConfig types....388
Stimuli source....389
Adding perception to an agent....390
Creating the BaseSecurityCam class....390
Creating the BaseSecurityCamAIController class....393
Debugging perception....397
Enhancing the roamer behavior tree....398
Enhancing BaseDummyAIController....401
Creating security camera Blueprints....402
Creating the gym....405
Enabling perception debugging....410
Creating perception stimuli....418
Creating the target actor....418
Testing the gym....422
Summary....424
Chapter 11: Understanding the Environment Query System....425
Technical requirements....426
Introducing the Environment Query System....426
Explaining generators....428
Explaining contexts....429
Explaining tests....430
Setting up an environment query....431
Creating the gym....431
Creating the AI controller....433
Creating an environment query....433
Handling environment queries within a behavior tree....436
Displaying EQS information....441
Summary....446
Part 4: Exploring Advanced Topics....448
Chapter 12: Using Hierarchical State Machines with State Trees....449
Technical requirements....450
Introducing state trees....450
Extending state trees....454
Understanding the state tree flow....456
Data binding....456
Creating and managing state trees....458
Enabling state trees plugins....459
Implementing a noise emitter actor....462
Using advanced state tree features....481
Creating the C++ AI controller....482
Implementing the AI controller Blueprint....485
Implementing the state tree....493
Assigning the state tree to the AI controller....505
Creating the guard Blueprint....505
Testing in a gym....506
Summary....509
Chapter 13: Implementing Data-Oriented Calculations with Mass....511
Technical requirements....512
Introducing the Mass framework....512
Mass framework plugins....513
Understanding Mass elements....514
MassGameplay....516
Setting up Mass....517
Enabling plugins....518
Creating a MassEntityConfigAsset....519
Creating a spawn EQS....522
Creating the gym....524
Testing the gym....527
Spawning Blueprints....530
Creating the audience Blueprints....531
Creating a MassEntityConfigAsset....536
Enabling the automatic processor registration....540
Creating the gym....541
Summary....546
Chapter 14: Implementing Interactable Elements with Smart Objects....547
Technical requirements....548
Introducing Smart Objects....548
Presenting the main elements of the Smart Objects framework....549
Creating a Smart Object Definition data asset....551
Enabling the plugins....552
Creating the workbench definition asset....552
Implementing smart object logic....555
Interacting with smart objects....560
Creating the toss coin task....560
Creating environment queries....562
Creating the Blackboard....567
Creating the behavior tree....567
Creating the character Blueprints....575
Testing smart objects in a gym....576
Summary....577
Epilogue....579
Appendix – Understanding C++ in Unreal Engine....581
Technical requirements....581
Introducing basic concepts....582
Understanding C++ classes....583
Properties....585
Functions....587
The C++ Header Preview....587
Explaining advanced features....588
Casting....589
Interfaces....590
Delegates....591
Exploring core mechanics....595
Garbage collection....595
The reflection system....597
Summary....600
Index....602
Why subscribe?....638
Other Books You May Enjoy....639
Packt is searching for authors like you....643
Share Your Thoughts....644
Download a free PDF copy of this book....644
Tap into the cutting-edge artificial intelligence features of Unreal Engine 5 and unlock their potential to craft captivating and engaging experiences in your games and applications in this part-color guide
Have you ever wondered how to create engaging gameplay experiences that involve formidable AI opponents, capable of challenging and pushing players to their limits? If the answer is yes, then get ready to enter the realm of AI creation with Unreal Engine 5.
Within the pages of this book, written by a brilliant author and game development expert, you’ll find the secrets of Unreal Engine's cutting-edge AI framework. With this newfound knowledge, you’ll be able to create immersive and dynamic gaming experiences. This step-by-step guide will teach you the art of crafting intelligent and responsive virtual opponents that challenge and engage players on a whole new level. As you follow along with practical examples, the book will guide you through the creation of fully functional AI systems. You’ll be able to harness the power of behavior trees, NavMesh systems, and sensory perception models, breathing life into your virtual characters.
By the end of this book, you’ll be equipped with the knowledge you need to unleash the full potential of AI in Unreal Engine. Get ready to revolutionize your gaming creations and captivate players with AI-driven wonders that push the boundaries of what's possible!
This book is for game programmers, as well as Unreal Engine developers with little to no knowledge of AI systems in video games, who want to explore this topic in depth. Developers who are proficient in other game engines and are interested in understanding the principles of the Unreal AI framework will also benefit from this book. You’ll need basic knowledge of Unreal Engine and C++ and a strong passion for game development to get the most out of this book.