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
 Newton Newton
Author Profile Icon Newton
Newton
 Feng Feng
Author Profile Icon Feng
Feng
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 FREE CHAPTER 2. Creating Basic AI 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

Fleeing and attacking


So, we will take from our old bit and add a small change, which will make the character run away from the Target instead of towards it. This will basically demonstrate the probability that you can give your AI reactions to various stimuli. Perform the following:

  1. We will get our State variable. Then, we want to subtract 1 from this, getting a 0 or 1 index. Next, we want to create a Select node and plug the results of the subtraction into the node.

  2. From there, we want Option 0 to be 1 and Option 1 to be -1. This will make the character either Run or Flee from Target. Now, zoom in to the Get Direction Vector node.

  3. Let's multiply Return Value by the Get Direction Vector node results. You must first convert Int to Float. Then, multiply this by the vector. Then, pull the vector back into Make Rot from X:

Back to the action

Let's focus back on Enemy EventGraph at the bottom. We want to implement a way for our AI to wander. Perform the following steps:

  1. Start by searching for Get...

lock icon The rest of the chapter is locked
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 ₹800/month. Cancel anytime
Visually different images