background top icon
background center wave icon
background filled rhombus icon
background two lines icon
background stroke rhombus icon

Download "Create a Role playing game in Unreal Engine Part 32 - AI behavior states"

input logo icon
Video tags
|

Video tags

Unreal Engine 4
Unreal Engine 5
Game system
Game development
Tutorial
Ability
Abilities
Create a game system
Beginner
Intermediate
Advanced
Damage
Great
XP
Experience points
Animation
Animations
Status effects
Free course
RPG
Role playing game
Combat
Component
Flexible
Scalable
Good practice
Buffs
Debuffs
Stats
Attributes
Properties
Gameplay tags
Full game
Foundation
Create a game
Experience
Status effect
Class
Statuseffect
Buff
Debuff
Base
AI
Opponent
Behavior
States
Subtitles
|

Subtitles

subtitles menu arrow
  • ruRussian
Download
00:00:01
[Music]
00:00:05
before we continue with the video if you
00:00:07
like what i'm doing here on this channel
00:00:09
please consider subscribing it helps the
00:00:11
channel a lot
00:00:12
anyway let's get back to the video
00:00:15
welcome to my create an rpg series in
00:00:18
this episode we will be further working
00:00:21
on our ai
00:00:22
making it a little bit more aware of its
00:00:24
world by giving it perception through
00:00:27
census
00:00:29
so we do this by opening up our
00:00:31
blueprint for our ai character
00:00:35
i'm going to be closing the other tabs
00:00:36
to make it a little bit more cleaner to
00:00:38
work with and what we want to do is we
00:00:40
want to add a component we'll type in
00:00:42
ai perception
00:00:44
and we can keep that name as the
00:00:46
component name
00:00:47
now
00:00:48
for this component we want to change a
00:00:50
few things
00:00:52
first of all we want to actually set up
00:00:54
so that it has the sense of sight
00:00:57
so we'll add a census config over here
00:01:00
and we'll choose
00:01:02
the site config like so
00:01:05
opening that up we want to change some
00:01:07
of the parameters on this one so
00:01:09
detection by affiliation we will click
00:01:11
in all the different check boxes so we
00:01:13
have all of them here
00:01:16
now
00:01:17
that is more or less all we need for the
00:01:20
config on the sounds now we need to set
00:01:23
up some functionality for what happens
00:01:25
when it registers certain things and how
00:01:27
to react to it
00:01:28
so going to our event graph we can now
00:01:31
say
00:01:33
is its own perception
00:01:43
okay let's do it this way i think right
00:01:45
clicking over here we can add an event
00:01:46
and we can say
00:01:48
on perception updated
00:01:52
so this will give us
00:01:54
all the actors that it's
00:01:56
in this frame updated its information
00:01:58
for so we'll go and loop that
00:02:05
and we're going to be keeping this
00:02:06
fairly simple just so you know so
00:02:09
er
00:02:10
that the there won't be
00:02:13
too much heavy lifting we just want a
00:02:15
very simple functional ai that can do
00:02:17
some simple things for us
00:02:19
uh so this is an area that could be
00:02:21
vastly improved upon later on if that's
00:02:24
important for your game
00:02:26
anyway for each of these elements that
00:02:28
we're going through here we can say we
00:02:30
want to
00:02:33
get actor perception i believe there we
00:02:36
go
00:02:37
so this one will return our perception
00:02:39
data for this specific character
00:02:42
and
00:02:43
it will contain an info which is a
00:02:45
structure which we can break
00:02:49
the
00:02:50
structure in here we have some
00:02:53
perception information
00:02:54
among them is the last sensed stimuli
00:02:58
and we can
00:03:00
loop on this
00:03:01
to go through all of those that are
00:03:03
available for this character
00:03:06
and here you can do things like you can
00:03:09
compare against what kind of sense it is
00:03:11
and stuff like that if you go
00:03:13
and
00:03:14
get sense
00:03:18
class yeah that one
00:03:20
and here you could check which kind of
00:03:22
um
00:03:23
stimuli that caused this if you want to
00:03:25
do it however we're gonna be keeping it
00:03:27
so simple we will only actually have one
00:03:29
sense so this doesn't make a whole lot
00:03:31
of sense for us
00:03:33
no pun was intended
00:03:36
anyway so what we can do instead is we
00:03:37
just break the ai stimulus information
00:03:40
that we have here
00:03:41
and we can
00:03:42
check against the if it was successfully
00:03:45
sensed or not so we'll just put a branch
00:03:48
and hook it up to that information and
00:03:50
see that it success successfully um
00:03:54
sends this character that we're
00:03:55
currently
00:03:56
updating for which is the one
00:03:58
over here
00:04:01
yeah and if it does we can say we we
00:04:03
have done something
00:04:05
um one of those things could be if we go
00:04:08
to our
00:04:09
blackboard again we can say we want to
00:04:11
have a new key and we can say that it
00:04:12
should be of type object and we can say
00:04:14
that this is
00:04:16
player target
00:04:20
going into our object here and dropping
00:04:22
it down we can change the object from
00:04:24
being not the base class of object but
00:04:26
instead of base class
00:04:28
of actor
00:04:30
the reason we do this is because
00:04:33
actor allows us to do some more
00:04:36
we we have some functionality in the
00:04:38
behavior tree that is available to
00:04:40
actors not objects
00:04:43
so that's why we're changing into an
00:04:45
actor
00:04:47
going back to our
00:04:50
character now for our ai we can now say
00:04:53
well if we happen to successfully set
00:04:57
send someone we can update our
00:04:58
blackboard so we need to get our
00:05:00
blackboard first
00:05:03
like so and then we can say
00:05:05
on this blackboard update a value so set
00:05:08
value as object
00:05:10
[Music]
00:05:13
and the object will be our player target
00:05:15
that we created so we can drag up from
00:05:17
here and say
00:05:19
make literal name
00:05:22
and
00:05:24
we can here type in the name of this key
00:05:27
or we can
00:05:28
more preferably just copy it from here
00:05:30
by pressing f2
00:05:32
and pasting it in like so
00:05:36
so now we have the the the name of the
00:05:39
the blackboard key here assigned and
00:05:41
that's what we're going to be setting
00:05:43
when it is true and the value that we're
00:05:45
going to be setting here is going to be
00:05:48
the
00:05:50
the target of our sensed stimuli so we
00:05:53
can get it from
00:05:56
over here for example so our active
00:05:58
perception
00:06:01
and let's reroute a little bit so it's
00:06:03
easier to
00:06:04
read like so
00:06:08
so now we're setting the player
00:06:09
character to be this
00:06:12
and this doesn't need to be more
00:06:14
complicated than this for now so we can
00:06:16
just test this out
00:06:18
and
00:06:19
how we do that is we're going to be
00:06:21
first hiding our character
00:06:24
so that he doesn't see us to begin with
00:06:27
and that also gives us a little bit of
00:06:29
time to set up
00:06:32
debugging information as well
00:06:34
so if we press play now and we press the
00:06:39
oh no this depends on your
00:06:42
keyboard of course but um
00:06:44
it could be the tilde key
00:06:47
or it could be the apostrophe key i
00:06:49
think it's an apostrophe key
00:06:51
yes it says apostrophe in the top left
00:06:54
so now we have the debug
00:06:56
enabled
00:06:57
and we can now see
00:06:59
behavior trees and ai and stuff like
00:07:02
that however
00:07:03
we don't see a whole lot here if we walk
00:07:06
out here we can see that we don't get
00:07:09
any registration information and the
00:07:10
reason for that is if we make it smaller
00:07:14
we need to have
00:07:16
our
00:07:17
third second
00:07:18
third-person character the ai character
00:07:20
to be the one that's selected in our
00:07:22
world outline
00:07:23
uh so what i did here is when i'm in uh
00:07:26
game mode over here i can press shift f1
00:07:28
to
00:07:29
get into
00:07:31
the editor mode and from then i can
00:07:33
select over here in our world outliner
00:07:37
and
00:07:38
in this
00:07:40
state now we can see here among other
00:07:42
things we can see the blackboard
00:07:44
[Music]
00:07:46
information we can see that
00:07:48
third person character 167 has been set
00:07:52
as our player target
00:07:53
and this happens to be the same one we
00:07:55
are if you see here i'm hovering over
00:07:57
and we can see that that's our
00:07:58
identifier if we hover over the other
00:08:00
one we can see that third person
00:08:01
character two is the identifier of this
00:08:03
one
00:08:04
and to show that that actually is
00:08:06
working we can do it like this we can
00:08:07
make sure that we get the
00:08:09
debug information working correctly to
00:08:12
begin with like so now we can see that
00:08:14
the player target is set to none i walk
00:08:16
out here he sees us and we have been set
00:08:18
as a target
00:08:20
so now we know that that part is working
00:08:22
at least
00:08:25
from here we might want to actually have
00:08:27
some logic that allows us to change now
00:08:29
from being a roaming character to an
00:08:31
attacking character the the ai that is
00:08:35
so to prep for some of this we can go to
00:08:38
our ai character and say
00:08:40
we want to change how
00:08:43
sorry not our character our um
00:08:46
controller and say we want to have some
00:08:48
functionality here that changes when we
00:08:50
have new targets essentially
00:08:53
uh to alleviate or
00:08:55
allow this we will start off by creating
00:08:58
a enum so we'll go to blueprints and
00:09:01
enum
00:09:02
and this one we can call e underscore
00:09:05
[Music]
00:09:07
ai state
00:09:10
and we can start off by creating a
00:09:12
couple here so we can say
00:09:15
um
00:09:17
what would be good ones
00:09:20
let's say
00:09:22
since roaming as our default state we
00:09:24
can say roaming as our first one
00:09:27
and
00:09:28
attacking
00:09:30
no not like that
00:09:31
attacking as our other state that we
00:09:34
want to go through
00:09:37
now
00:09:39
with these states we have an ability to
00:09:42
possibly switch on the states to allow
00:09:44
us to do different things
00:09:48
but to make this convenient so we can
00:09:50
change the state from different places
00:09:53
we can create a blueprint interface for
00:09:55
us so that we have this switch done
00:09:58
easily
00:09:59
so going to
00:10:00
blueprints and
00:10:02
blueprint interface we can call this bpi
00:10:04
underscore
00:10:07
ai
00:10:08
change state very clear what it's doing
00:10:10
then
00:10:12
the only thing this is going to do is
00:10:14
change
00:10:16
ai sticks
00:10:20
input will be
00:10:22
an enumerator of
00:10:24
what did i call it
00:10:27
um
00:10:29
ai states maybe yes that's what i call
00:10:32
it so the enumerator ai slight
00:10:35
ai state
00:10:36
and we'll say that this is our
00:10:39
new ai state
00:10:41
as the name
00:10:44
we will go to our controller we close
00:10:47
the blueprint interface and we can add
00:10:48
this interface now to our controller and
00:10:50
say
00:10:51
bpi ai change state
00:10:55
we can now implement the interface
00:10:57
we now have a convenient way to change
00:11:00
the state for this ai
00:11:02
so what do we want to do well we want to
00:11:04
change the the state right but we don't
00:11:06
have a variable for yet so let's create
00:11:08
one and say
00:11:10
current ai states so this will be the
00:11:12
state that we're always in
00:11:14
and we'll make it a type a i
00:11:18
e e a i state this is very difficult for
00:11:21
me to say
00:11:22
and we can essentially say whatever is
00:11:24
being sent in here that is going to be
00:11:26
our new state
00:11:29
that's all very good
00:11:31
now we might want to have
00:11:33
a different behavior tree now to
00:11:36
handle that we're going to be in
00:11:37
attacking form
00:11:39
so let's create a new behavior tree
00:11:43
under artificial intelligence barrier
00:11:45
tree we can call this one baby tree
00:11:47
attacking
00:11:49
so now we have two different trees
00:11:51
we can open this one up make sure that
00:11:53
it has the same basic
00:11:54
blackboard because we can share them
00:11:56
among trees if we want to
00:11:58
and what we can do here now is we can
00:12:00
say we want to switch on this
00:12:03
state
00:12:04
and if we are going for roaming we want
00:12:06
to copy this one and if we're
00:12:10
attacking we want to change to our baby
00:12:12
tree for attacking
00:12:14
so now we have a very convenient way to
00:12:16
switch among these and this means we can
00:12:18
also remove this now and instead say
00:12:21
change ai
00:12:23
state
00:12:25
interface call
00:12:26
and say roaming as our new state so when
00:12:28
we begin play we say that that's our
00:12:30
goal that's going to be our states to
00:12:32
begin with
00:12:33
and if we click play it should hopefully
00:12:35
still be roaming around over here which
00:12:38
it seems to be doing because that's not
00:12:40
where it started
00:12:42
so
00:12:44
that's all good and fine for now and i
00:12:46
think that might be a good place to
00:12:48
leave it for now so i hope to see you in
00:12:50
the next episode
00:12:52
hopefully found this video helpful if
00:12:54
you liked the video leave a like if you
00:12:56
did not like it leave a dislike leave
00:12:58
any suggestions or comments you have
00:12:59
down below subscribe and share this
00:13:01
video if you want to see more like it in
00:13:02
the future that is all for now keep on
00:13:05
learning take care
00:13:07
[Music]

Description:

This is the series to watch if you want to create a role playing game in Unreal engine with rich, deep RPG systems and advanced functionality. In this episode we will be creating an some AI behavior states to switch between. Beginner tutorial series: https://www.youtube.com/playlist?list=PLNBX4kIrA68nyGfIKgyizftebllhKc4ZX Creating game systems: https://www.youtube.com/playlist?list=PLNBX4kIrA68lvWElEzhRaCOtCjZ7L05xv Join the Discord server here: https://discord.com/invite/zBeebU7uv3 Support the work of LeafBranchGames on Patreon here: https://www.patreon.com/LeafBranchGames

Preparing download options

popular icon
Popular
hd icon
HD video
audio icon
Only sound
total icon
All
* — If the video is playing in a new tab, go to it, then right-click on the video and select "Save video as..."
** — Link intended for online playback in specialized players

Questions about downloading video

mobile menu iconHow can I download "Create a Role playing game in Unreal Engine Part 32 - AI behavior states" video?mobile menu icon

  • http://unidownloader.com/ website is the best way to download a video or a separate audio track if you want to do without installing programs and extensions.

  • The UDL Helper extension is a convenient button that is seamlessly integrated into YouTube, Instagram and OK.ru sites for fast content download.

  • UDL Client program (for Windows) is the most powerful solution that supports more than 900 websites, social networks and video hosting sites, as well as any video quality that is available in the source.

  • UDL Lite is a really convenient way to access a website from your mobile device. With its help, you can easily download videos directly to your smartphone.

mobile menu iconWhich format of "Create a Role playing game in Unreal Engine Part 32 - AI behavior states" video should I choose?mobile menu icon

  • The best quality formats are FullHD (1080p), 2K (1440p), 4K (2160p) and 8K (4320p). The higher the resolution of your screen, the higher the video quality should be. However, there are other factors to consider: download speed, amount of free space, and device performance during playback.

mobile menu iconWhy does my computer freeze when loading a "Create a Role playing game in Unreal Engine Part 32 - AI behavior states" video?mobile menu icon

  • The browser/computer should not freeze completely! If this happens, please report it with a link to the video. Sometimes videos cannot be downloaded directly in a suitable format, so we have added the ability to convert the file to the desired format. In some cases, this process may actively use computer resources.

mobile menu iconHow can I download "Create a Role playing game in Unreal Engine Part 32 - AI behavior states" video to my phone?mobile menu icon

  • You can download a video to your smartphone using the website or the PWA application UDL Lite. It is also possible to send a download link via QR code using the UDL Helper extension.

mobile menu iconHow can I download an audio track (music) to MP3 "Create a Role playing game in Unreal Engine Part 32 - AI behavior states"?mobile menu icon

  • The most convenient way is to use the UDL Client program, which supports converting video to MP3 format. In some cases, MP3 can also be downloaded through the UDL Helper extension.

mobile menu iconHow can I save a frame from a video "Create a Role playing game in Unreal Engine Part 32 - AI behavior states"?mobile menu icon

  • This feature is available in the UDL Helper extension. Make sure that "Show the video snapshot button" is checked in the settings. A camera icon should appear in the lower right corner of the player to the left of the "Settings" icon. When you click on it, the current frame from the video will be saved to your computer in JPEG format.

mobile menu iconWhat's the price of all this stuff?mobile menu icon

  • It costs nothing. Our services are absolutely free for all users. There are no PRO subscriptions, no restrictions on the number or maximum length of downloaded videos.