Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Unreal Engine 4 AI Programming Essentials

You're reading from   Unreal Engine 4 AI Programming Essentials Create responsive and intelligent game AI using Blueprints in Unreal Engine 4

Arrow left icon
Product type Paperback
Published in Mar 2016
Publisher
ISBN-13 9781784393120
Length 188 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Jie Feng Jie Feng
Author Profile Icon Jie Feng
Jie Feng
Peter Newton Peter Newton
Author Profile Icon Peter Newton
Peter Newton
Arrow right icon
View More author details
Toc

Table of Contents (16) Chapters Close

Unreal Engine 4 AI Programming Essentials
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Preface
1. Introduction to Game AI 2. Creating Basic AI FREE CHAPTER 3. Adding Randomness and Probability 4. Introducing Movement 5. Giving AI Choices 6. How Does Our AI Sense? 7. More Advanced Movement 8. Creating Patrol, Chase, and Attack AI 9. What Have We Learned? Index

Adding the Enemy AI


Let's go back to Unreal Engine and focus on Content Browser. We now need an opponent. To add this, follow these steps:

  1. Right-click and select Blueprint.

  2. At the lower end of the window, let's drop all the classes and search for AIController.

  3. Select AIController under Controller and hit Select in the lower-right corner.

  4. We will name this AIController Enemy.

  5. Open Enemy AIController and go to the EventGraph section.

First, we must find Hero and then store it in a local variable to be used at any time. To do so, follow these steps:

  1. Right-click in an empty area within EventGraph and search for Event Begin Play.

  2. Pull from the exec pin and search for Get All Actors Of Class.

  3. Set the Actor Class pin to Hero.

  4. Pull from the Out Actors array and search for ForEachLoopWithBreak:

We want a filter for the Hero class within the MyCharacter pawn returned. To do so, follow these steps:

  1. Pull from the Array Element pin and search for Cast to MyCharacter.

  2. Then, pull from the As My Character pin and search...

You have been reading a chapter from
Unreal Engine 4 AI Programming Essentials
Published in: Mar 2016
Publisher:
ISBN-13: 9781784393120
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime
Visually different images