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

Traces


We will use this to trace from the player's location to 255 units in front of the character. If anything collides with the trace, we will face the pawn to the right based on the pawn's rotation. This simple check will be enough to make our bot run along the walls indefinitely; so, perform the following steps:

  1. Pull the Return Value pin from GetActorLocation and drop it. Then, search for Vector + Vector.

  2. We now need to select Get Controlled Pawn and pull Get Actor Forward Vector from it. This contains vector information going in the direction that is in front of our pawn.

  3. So we will multiply Return Value by 255. This is the vector we want to add to the actor's location. This results in adding 255 units in the direction ahead of the pawn's current location.

  4. Now, we need to take the results of the addition of the End pin for the LineTraceByChannel node. This will trace directly in front of our pawn:

  5. Pull from the Vector + Vector node again, and this time we will plug it into the Dest pin for...