Book Image

Unreal Engine 4 AI Programming Essentials

By : Jie Feng, Peter Newton
Book Image

Unreal Engine 4 AI Programming Essentials

By: Jie Feng, Peter Newton

Overview of this book

Unreal Engine is a powerful game development engine that provides rich functionalities to create 2D and 3D games. Developers have the opportunity to build cross-platform mobile and desktop games from scratch. This book will show you how to apply artificial intelligence (AI) techniques to your Unreal project using blueprints as your scripting language. You will start with an introduction to AI, and learn how it is applied to gaming. Then you'll jump right in and create a simple AI bot and apply basic behaviors to allow it to move randomly. As you progress, you'll find out how to implement randomness and probability traits. Using NavMesh, you will impart navigation components such as character movement, MoveTo nodes, settings, and world objects, and implement Behavior Trees. At the end of the book, you will troubleshoot any issues that might crop up while building the game.
Table of Contents (16 chapters)
Unreal Engine 4 AI Programming Essentials
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Preface
Index

Navigation


Now that we have our soldiers in the world, we want to navigate them to their respective waypoints. This will be done through the AIController we set up on our soldier. If we focus again on Unreal Engine, we can get started! Follow these steps:

  1. Open the AIController class we created earlier and named SoliderAI.

  2. Then, we want to navigate to the EventGraph section. From there, we want our AIController to begin navigating to its first route as soon as it possesses a worthy pawn. So, let's add an event to drive this action (I encourage the use of events). The one we are looking for is called Event On Possess. This will also return the pawn it possessed, which we can use to compare with the Allowed Access list from waypoints.

  3. Pull from the exec pin, and let's assign a new event called RecieveMoveCompleted. This event will continue the pawn to the next route as soon as it completes the previous one:

  4. Now, after the Bind Event exec pin, let's put in Do Once to prevent this from being called...