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

Blackboard


This stores the memory for an individual agent or agents. This works hand in hand with the Behavior Tree. It allows easy and direct access to variables from any of your Task nodes. Imagine that your Behavior Tree is your EventGraph, and Blackboard is your variable that you use in EventGraph. With the Instance Synced function, you can replicate the variable to every instance of the Blackboard class within the world. Now, let's start creating our Blackboard:

  1. We need to create a new Blackboard (which is under AI assets when you right-click within Content Browser) and name it DogBrain. This will store our State as Enum DogState for the Behavior Tree branches, Mailman as ThirdPersonCharacter if we have one found, Foodbowl as itself if we have found, and lastly our latest search Locations as a vector for EQS. You may see the elements we created as follows:

  2. Let's save this all. We have to create Behavior Tree now that we have the bare components that make up our Behavior Tree. Let's go...