Book Image

Hands-On Artificial Intelligence with Unreal Engine

By : Francesco Sapio
5 (1)
Book Image

Hands-On Artificial Intelligence with Unreal Engine

5 (1)
By: Francesco Sapio

Overview of this book

Learning how to apply artificial intelligence ( AI ) is crucial and can take the fun factor to the next level, whether you're developing a traditional, educational, or any other kind of game. If you want to use AI to extend the life of your games and make them challenging and more interesting, this book is for you. The book starts by breaking down AI into simple concepts to get a fundamental understanding of it. Using a variety of examples, you will work through actual implementations designed to highlight key concepts and features related to game AI in UE4. You will learn to work through the built-in AI framework in order to build believable characters for every game genre (including RPG, Strategic, Platform, FPS, Simulation, Arcade, and Educational). You will learn to configure the Navigation, Environmental Querying, and Perception systems for your AI agents and couple these with Behavior Trees, all accompanied with practical examples. You will also explore how the engine handles dynamic crowds. In the concluding chapters, you will learn how to profile, visualize, and debug your AI systems to correct the AI logic and increase performance. By the end of the book, your AI knowledge of the built-in AI system in Unreal will be deep and comprehensive, allowing you to build powerful AI agents within your projects.
Table of Contents (19 chapters)
Free Chapter
1
Section 1: The Unreal Framework
9
Section 2: Designing and Implementing Behavior Trees
13
Section 3: Debugging Methods
14
Debugging Methods for AI - Logging

To get the most out of this book

Being comfortable with using Unreal Engine 4 is an important starting point. The objective of this book is to take those who work with the technology to a level where they are comfortable enough with all aspects to be a leader and driver of that technology on a project.

Download the example code files

Download the color images

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text. Here is an example: "The next event to implement is OnBecomRelevant(), and it is only fired when the Service becomes relevant"

A block of code is set as follows:

void AMyFirstAIController::OnPossess(APawn* InPawn)
{
Super::OnPossess(InPawn);
AUnrealAIBookCharacter* Character = Cast<AUnrealAIBookCharacter>(InPawn);
if (Character != nullptr)
{
UBehaviorTree* BehaviorTree = Character->BehaviorTree;
if (BehaviorTree != nullptr) {
RunBehaviorTree(BehaviorTree);
}
}
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

void AMyFirstAIController::OnPossess(APawn* InPawn)
{
Super::OnPossess(InPawn);
AUnrealAIBookCharacter* Character = Cast<AUnrealAIBookCharacter>(InPawn);
if (Character != nullptr)
{
UBehaviorTree* BehaviorTree = Character->BehaviorTree;
if (BehaviorTree != nullptr) {
RunBehaviorTree(BehaviorTree);
}
}
}

Bold: Indicates a new term, an important word, or words that you see on screen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "Select BT_MyFirstBehaviorTree from the drop-down menu within the Behavior Tree variable."

Warnings or important notes appear like this.
Tips and tricks appear like this.