[MUSIC] >> So greetings. My name is Sam Deiter
with Epic Games, and this is Making Games
with UE4 and Action RPG. So in today's session,
what we are going to be first covering about
is the five W's of Action RPG; this is going to go over
what Action RPG is, why it was developed,
who made it, where you can get it, so on.
Then we are going to be talk about the gameplay
ability system, because at the core
of Action RPG is the gameplay ability system that is used
in all of Epic's games. Then we are going to talk
about creating a new potion, because this will show us
all of the components that are required to create an
ability for the ability System. Then we will talk a little bit
about mixing both C++ and Blueprints together
in the same project. Finally, we will wrap up
with live coding with Live++. So what is Action RPG? I could sit here
and talk about it, but might as well just show you by clicking Play
on the Editor over here, and we will give this
just a second. I am going to hit F11 to go
into full screen -- and this is Action RPG. You can see I can
change my weapons, I have some skills
that I can use, like a fireball. Let us see if I can -- go back to my other sword,
I can roll. I also have
a full inventory here where I can purchase new items. I can purchase
different potions. You can see I have
stackable contents. I can also make
a full round trip -- so this is actually
the main menu, and then I can click
and start the game, and it will pop me
right back in. So Action RPG is a third person
hack and slash mobile game and sample project,
and it was built to show you the Epic way of how to use UE4
to make video games. It is also currently available
for both PC, Android, iOS, HTML 5 and Mac.
So why was Action RPG made? Well, it was made to show best
practices for UE4 development. We get asked a lot of times,
how do you do things at Epic? How should I set this up? How would you go about
setting this up? Since we cannot share
the Fortnite source with you, this is the next best thing. This sample was built
to show you how you should be setting up
all of your UE4 projects. Another question
we get asked is, how do you mix both C++ and Blueprints together
in the same project? What should be Blueprintable,
what should be left in C++? How do I do this?
What should I be doing? Again, Action RPG serves as a
great example of how to do this. Many of the abilities or effects that you are seeing
in Action RPG are comprised
of Blueprintable nodes that we had somebody
set up for us in C++, and then it allowed us, when we
were developing this project, to not have to keep
bugging the engineers to have them change things
or add things for us. It also serves as our first
example of how to use Epic's gameplay ability system, and this is the same gameplay
ability system used in all of Epic's games
in some way, shape or form. Finally, over the last year, we have done
a lot of improvements over our multi-platform
development. Action RPG,
as it stands right now, it can be published to Windows,
Android, iOS, HTML 5 and Mac, and when I say "published,"
to publish it, all you have to do
is come up here, File > Package your project, select the platform
you wish to export for and then go have a coffee.
Then that is it. You come back and do it again
for the next one. It is literally that simple. When was Action RPG released? It was originally released
in July 2018 with the 4.20 version of UE4, and it has actually
since been updated for the 4.21 version
of UE4 in November of 2018. We did fix more
than just two items; these are two of
the more notable items. We made the AI
a little more interactive, made it move at varying rates
so it did not just kind of all look
like the exact same animation. We also had some really
severe scaling issues for the Pixel XL series
and iPhone X, so we fixed that. And 4.22, which will be
coming in March of 2019, we have new item pickups, we have new platforms
specific to UI -- for example, if I come over here
and press Play, the UI that you see
right down here on my screen is will actually be different, depending if you are playing
on a mobile device, or if you are
playing on, say, the PC. Again, tons of things
change every single update; these are just a few
of the things that I thought were the coolest. So who developed Action RPG? Well, Action RPG was originally
developed as a prototype by some of our technical artists at our Epic Games
South Korean studio. It was then picked up
and worked on by both
the Learning Resources team, the Evangelist team
and the Game Play and Scripting team
to bring it to the sample you are
seeing today. But those are not
the only people that have worked on Action RPG. Many different people
from many different disciplines across Epic have helped out
in the development of this game; whether it is making sure that we are doing things
the Epic way, or helping us solve
some problem that we did not really
understand how to fix. So where can I find Action RPG? You can actually download
the project, which you see over here
on this screen, in its entirety
from the Marketplace tab of the Epic Games launcher. If you just want to
check it out right now, you can actually download
the completed game from both the Android and iOS
stores on your smartphone. So now that we have talked a little bit
about what Action RPG is, where you can get it
and why it was developed, let us talk a little bit about what the gameplay
ability system is. So the gameplay ability system,
at a high level, it is just a very flexible
framework for building very, very simple
or very, very robust abilities. It was developed in-house by the game play
programmers at Epic, and it is designed
to be extended to meet the needs of many
different types of games. Again, this is the exact
same ability system that we use in all of our games. Fortnite uses this.
Not the exact same system, but it uses the framework
that this system has to develop all of the abilities
that you see in there. So while the gameplay ability
system does sound amazing -- because it is --
there are a few things that you need to be aware of
before you can use it. First off,
it actually needs to be set up. What I mean by that is, there are a series of things
called "base attributes." Now a base attribute would be
something such as Mana, or Health, or Attack Speed,
or Attack Damage. These base attributes need to be
set up in C++ before artists and designers
can actually utilize them. Once these are set up, the artists and designers
for your project can then tweak
these base attributes, using Blueprints
to pass the data back and forth. This is exactly how abilities
are made on games like Fortnite. Engineers will set up
the base abilities; they will set up how much
damage you can have, how much shield you can have,
how high you can jump. Then designers and artists
will then use Blueprints, Cascade, Niagara,
to modify and tweak these effects to give you
the games that you play today. The cool thing is, they do not
have to go back to the Engineer to get any additional help.
Everything that they need to do is already set up
inside of the ability system. So this right here is
a breakdown of the ability that you would find
in the ability System, first in the yellow right here,
we have the RPG Item Type. This acts as a container
for the entire ability. This is basically --
think of this as a box that I throw everything that is related
into this ability into this box. The other thing
that this does is, the RPG Item Type defines
the UI visuals, the item cost
and the granted ability. If I come over here
and hit Play again real quick, and I hit tab,
I will click on this weapon, you will see the cleaver
in Edge of Death right here. The RPG Item Type
is going to set that. It is also going
to set the cost -- see, this costs 100 souls
right there. Next we have the game
playability here in green. The gameplay ability can be
thought of as the visuals. This controls the timing. We will go into this once we
duplicate an effect to make one, but this is what
makes your effect pretty. You know, when the player
goes to swing their hammer on the ground, and you see
a big explosion happen, or you see the earth look
like it is shattered, this is where you are
going to trigger that effect. Finally, over here in blue,
we have the gameplay effect. This is where, actually,
the entire thing takes place. This is what actually
does the damage. Without this part, it would just
be pretty visuals on the screen. Here in the gameplay effect,
you effect attributes -- and remember,
attributes are those things that need to
be set up in C++, and they are things like Damage,
Health, and Mana. The values for these attributes
are read through a data table, and this is a really easy way
to modify the damage across a wide variety
of different skills, and we will go into that
in a little bit when we make an ability. So with the breakdown of the
ability System out of the way, let's talk about
creating a potion. This is pretty simple. What we will be doing is,
we are going to be just duplicating
some existing Assets. We are going to add a new
attribute to affect the Mana, because we will duplicate
the Health asset. Then we will change the icon,
description and cost. Again, this requires no
Blueprint or C++ knowledge. If you ever
opened up Unreal, maybe made
a new Material, maybe you have duplicated
a couple of Assets -- this is exactly
what we are going to be doing. And this little bit of the talk
can actually be applied to creating weapons and potions,
so there is actually a lot that you can do with
just these few simple steps. So before we go into it, the potion will be
made up of three items; we are going to have a Gameplay
Effect, a Gameplay Ability, and an RPG Item Type. Right now what we are
going to do is, before, when I was talking
about the ability, I talked about
the RPG Item Type, which started at the top. Now I am going to start down
at the bottom by creating the gameplay effect, because without
the gameplay effect, it will just be pretty
pictures on the screen. So I will come over
to my Content Browser, and I am going to search
for "potion" and then I am going to look
for GE_potionhealth and hit Ctrl+B. I am going to right-click on it
and duplicate this guy -- I am going to hit F2
to redo that really quick -- and we will call
this GDC potion Health. I am going to double-click on it
to open it up, and pull it over here
on this monitor. Let us break this down. First off,
Action RPG only utilizes things that are in the
gameplay effect, while these
other categories do work; we have not made any
abilities that need to utilize
these properties just yet. Right up here,
our duration policy -- it is going to default
to Instant, but you see we have Instant, Infinite and Has Duration --
this is just basically, what is going to happen
when I do this? For us, we will
keep this on Instant, because as soon as I pop
my Health potion, I want to instantly affect
my player's stats. But say I wanted to do something
like a damage over time -- I could set this down here
to Has Duration, and then say over
the next five seconds, I want to affect the
player's Health and Mana; which I will
not do for this. I want to have this Instant. Next, here under the Modifiers
-- so the Modifiers are
where you are going to Modifying your base attributes.
Now remember when I said the base attributes need
to be set up in C++ -- this is what I am talking
about right here. These are all
the base attributes that you can adjust
inside of Action RPG. So you see we have Set Health, Set Mana, Attack Power,
Defense Power -- and so on. What we are doing here is,
we are going to Add -- see, you have Add, Multiply,
Divide, Override and Invalid -- basically, what I will do is, I will take my player's current Health and then add whatever I currently
have set for the values of my Health potion
to what my player currently has. Over here under this
Modifier Magnitude -- right here,
this is just a scalar value, and this will make sense
in just a second. But basically,
what I am doing is, when I pop this Health potion, I am actually attacking myself
for 600 damage. Now that might seem
a little bit weird, but let me explain why. First off, let us look
at this curve table. The curve table
that we have here, basically, we have a Default
and a Medium and a Heavy attack. This was actually made
in Google Sheets, and downloaded as a .csv file,
and the reason that I did this is because
this is a great way for me to quickly be able to
adjust damage at various levels without having
to actually adjust damage for every single one
of the weapons or Actors inside of my game. What I can do here is, basically
you see this number, 600? Well, the ability System
does not care that I am doing heavy
attack damage to myself. All it cares about
is this number 600, right? I could modify this number here,
I think if I set this to 5000, I end up doing
1.5 million damage to myself. If I set it to 0.001, I end up
doing 0.30 damage to my Health. It does not really matter
that it is attack damage. All the ability System cares
about is this number right here. I am going to set
this back to 2, so basically I am
going to be applying 600 Health points to myself. So like I said,
I wanted this potion to affect both my Health
and my Mana, so let us set up
the Mana part. I will come over here
to my Modifiers, and press the Plus button. This is going to add
another element to my array. Now what I am going to do is, I am going to come
to my attribute, and we are going to say,
Set Mana. We are going to leave
our Modifier OP as Add, because you want to add to it. I am going to set our
Scalable Float to a value of 2, we are going to select
our Attack Damage Curve Table, and then set it
to Heavy Attacks, so we get 600 points applied,
and would just verify that is what we are
doing up here, so 600-600, that is perfect. We are going to Compile
and Save, and we are done with that one. Next we are going to work
on our Gameplay ability. Remember,
this controls the visuals, so what sound effect, what particle effect
that I am going to play. It also is used with animation
montages, so I am going to come here to my GA potion Health,
right-click, Duplicate, and we will call this
"GDC potion Health", then I will double-click
to open it up. Again, in here, the only thing you will really be worried about is the animation montage
and the gameplay effects. Before we go
into the effects, I want to open up the montage
really quick. So I am going to hit spacebar
on my keyboard to stop this playing,
and scroll down. If you see this Use Item
Notify -- basically what this is doing is,
it says, in this montage, when the montage
reaches this point, I want you to apply an effect.
What I want you to do is, I want you to actually
apply whatever target Gameplay Effect class
is inserted right here. Basically,
when I hit this point, I want you
to apply both 600 Mana and 600 Health points, right?
I want to use my potion. So here, what we will do is
type in GDC, and we are going to take our
GDC Health potion, hit Compile and Save.
It is literally that simple. I am just moving a couple
of Assets around. All right. So now we need
to make our RPG potion item, which is a Data Asset, and it is used to tie
everything together. This is where we will set the
UI, the visuals,
the cost and things like that. I am going to come over here
to my Content Browser, I am going to type
in the word Portion, and I am going to look for our
Potion_Health, and just hit Ctrl+B to find
it in the Content Browser. I am going to right-click,
Duplicate, and we will call this
our "Potion GDC Health" -- and I will double-click
on it to open it up. Over here in our Item Type, I am
going to leave this to potion, but if we were making a
weapon, we would actually want
to set this to Weapon or Skill, depending on what type of item. This is just going to let
our inventory system know how to actually treat this item. Next over here is the Item Name. This is what is going to show up
actually in the UI. We will just call this
"GDC Mega potion". All right? Then we will say "Recovers
100 Percent HP and Mana". Over here in our item icon, I
am just going to change this -- to this icon right here, so it stands out
a little easier when I go to show it to you
in the UI a little later. One thing that I want
to note -- sorry. Next I will set the price, I am just going to set this
to 50 Souls, just to make it
a little more expensive. Max Count --
this is actually kind of cool. Normally, in any type of game,
you might want to limit the amount of items
a player can have; maybe you only want them
to have one of these items, or maybe they can only have 20,
or maybe infinite -- well, what max
count does is, this allows you
to set that. If I set this to 5, that means
at any one time, the player can only have five of these
items in their inventory. If they picked up
an additional one, it just would not go anywhere, they would not be able
to do anything with it. They can only have five. But since I do not really want
to limit the player in that way, I am going to leave this at 0, which means they can have
as many as they want. Again, this is a built
in functionality of the gameplay ability system; this is why this system
is so robust. I can just simply edit some data
to limit how many items my player can
have. Instead of having to go into
a Blueprint, develop some logic, make sure the logic
does not conflict with anything else
in the Blueprint, or introduce any bugs, or
something like that. The next thing that I want to do
is, under my granted ability here, I just want to search for my GDC
potion Health, and click Save. Now what I am going to do is,
this is what the UI should look like
when we pop in the game. Let us go ahead
and pop in the game, I am going to go ahead
and hit F11, I will hit Tab, I will come over here
to my potions and see my GDC Mega potion. I am going to grab two
of those guys, hit Confirm, hit Back to go into the game,
fire up a couple of fireballs. Make sure you take a look here
at my Mana and my Health. I will let one of these guys
beat up on me a little bit, and do a little bit of damage
to me -- all right. Now I am going to hit R --
watch my Mana and my Health, and we will see it go
right back up to 100 percent. Let us do that one more time, just so everybody
can have a look at it. Let this guy hit me
a little more. All right. I am going
to hit it one more time, and you can see both
my Mana and Health have gone back up
to 100 percent. Now lets say you
made a bunch of weapons, you made
a bunch of potions. Now you want to try
to mix a little bit of Blueprints together
with some C++. But you do not know
where to go. Maybe you are not
sure how to start. Well, Action RPG provides a
great example of how to do this. Many of the things
that we are doing in Action RPG with our Character,
with our potions, actually have some Blueprintable
actions inside of them. For example,
there is a potion pick-up here. Right here, I will
double-click to open it up. This looks a little bit
more complex than what I have
on my screen here. But basically, this node,
this node, this guy, this guy -- let us see --
this guy, this guy, this guy, this guy,
this guy and this guy -- basically all these nodes
that I just selected are the nodes that are
highlighted over here in blue. These are all nodes
standard in UE4. If you download UE 4.20,
4.22, 4.23, you are going to find
all of these nodes. What you will not find, though, are these nodes
that are highlighted in orange; Add Item Inventory,
Set Slotted Item, Make RPG Item Slot --
these are custom to Action RPG. The reason I am bringing this up
is because if I was to come in here
into my Event Graph and right-click
and type in "Inventory", you can see I do not actually
have any inventory stuff besides this,
which is actually just an event. This is a custom event
that is called "Inventory". I do not actually have any
RPG inventory items. If I uncheck context
sensitivity -- let us see here -- right down here you can see
I have my Add Default Inventory, Add Inventory Item,
Fill Empty Slots -- all of the nodes
that are unique to Action RPG. Once you start to dive
into mixing Blueprints in C++, make sure you
disable context sensitivity so you can actually find the
nodes that you are looking for. If you happen to be jumping
around one of these Blueprints and you cannot find it,
like this Set Slotted Item node, that is how you are going to be
able to find this information. So let us say, next you have
made a bunch of Blueprints, you are, like, you know what? I really want to know how they
make something Blueprintable. You start to wonder
a little bit about C++. Well, Action RPG can actually
help you with that. Due to the size of Unreal,
it can be a daunting task to actually go through
all of the many, many source files
to figure out which property
you are looking at, where it is, and how it is
Blueprintable -- that is because
it could actually be seven files that you need to go deep in order to find the property
that you are looking for. Since Action RPG is such
a small slice of a game, it is very easy
to see where the properties were developed
in their .CPP files, because it is usually one-to-one;
you will see one .CPP file, and you will find
that property. For example,
in our potion Data Asset -- I am just going to type the word
"potion" here again -- and double-click
our potion GDC Health. Ssay we are looking
at this item, and for whatever reason,
you decided to add something
in between Item Name. You want to call
this "Item Uber Name", or something like that. Well, this how Action RPG
can help you. This is actually the header file and the .CPP file
for this Action RPG item. Here, this is literally
the entire file. There is nothing more than
this for the header file, and all that is doing
is actually setting up this
little drop-down right here. The .CPP file is actually
a little bit bigger, but the property we have
highlighted, this UPROPERTY
(EditAnywhere, BlueprintReadOnly, Category =
Item) fText equals Name -- that might sound like gibberish to a lot of people
in the crowd -- all that is literally doing is defining this property
right here, the ability
to put in something here. So the reason I am bringing
this up is, I could come in here and maybe just comment
this property out by doing
a slash-slash Recompile, and then Item Name
will disappear. This is a great way for me
to figure out how I can actually make something Blueprintable
inside of C++, if you were not sure about it. Again, I only had
to open up one file. I did not have
to open up a file, and then realize I had to open
an additional dependency file, and then keep going down
the chain until I found it. That is, again, because Action
RPG is such a small project. All right. Let us say you want
to take this one step further, and you want to experiment
a little bit with C++, but you are tired of --
you know, you are doing it on your laptop,
compile time is taking 20, 30 minutes just for you
to change one line -- well, Live++ from Molecular
Matters can help you with that. With Live++, you can actually
recompile all of your C++ code without actually having
to close the UE4 Editor. This means that you can make
very rapid changes to your code, see what those changes are,
comment stuff, add new stuff -- again, all without having
to close the Editor down. Live++ is actually
a little more reliable and scalable than our
legacy Hot Reload system; this means that you can use it
on very small projects, or extraordinarily
massive projects. To activate the Live++, you just need to come here
to Compile, then under General, just click
on Enable Live Coding. So how would I use Live++? Let us take a look
at this example. Let us say you are
doing something, and your Mana bar right here,
it is not clamping, right? It is not going
all the way to 0. We know where this is. We know it is in the RPG
Attribute Set .CPP file; this is actually the call
for the Mana right here. But we know of a fix,
but again, compile time might take us
20 minutes to get back, because we have to
compile the engine. We do not have
the time to do that. Well, Live++
can help us with that. All I did now is, I just
input this command right here. I hit Ctrl+Alt+F11
to recompile, and it took about
six seconds for me to be able to jump back
into the Editor. I think it took me 14 seconds to get back
into the game so I could take
this image right here. But you can see,
I went back in, I have this,
now my Mana is clamped. Now say that did
not work, right? It would be super simple for me
to just comment this out, recompile
and try something else. So before you think that Live++ is the answer
to all of your prayers, there are a few things
you need to be aware of. First off, you cannot add
a uProperty to a Blueprint, or comment out a uProperty. This will require
a full Engine recompile. You also cannot change the information inside
of a header file, you can only make changes
inside of your .CPP files, and currently it is
only supported for Windows. So in case I went a little
too fast for you today, or you would like more in-depth information about
the ability system, how to set it up
and how to use it, everything I talked
about today and more is actually documented on the
Action RPG documentation pages. Make sure you take note
of the following link, or if you just want
to Google Search it, all you have got to do is type in "UE4 Action
RPG Documentation", and it will take you to this
landing page right here. On this page you will
find information about how to set it up
for your project, and also a breakdown
of what every single thing inside the ability system that
we utilize in Action RPG does. We also have
a bunch of tutorials that go over things
like adding a pickup, adding a new potion --
which I covered today -- creating a new weapon -- and this will be updated
as new things come out, because we update this
with every release of UE4. So really quick before
I let you out of here, I want to recap
what we talked about today. So first we started off
with the five W's of Action RPG, what it is, who made it,
why it was developed. We then talked a little bit about the gameplay
ability system, what it is, what it does,
and how Action RPG utilizes it. We then went over
creating a new potion, which shows us
all of the three components that are needed for ability. Finally, we talked a little bit
about mixing both C++ and Blueprints, and how you can use Action RPG
to serve as a guide to see how you should be doing
that in your UE4 projects. Finally, we finished
up with a little bit of live coding with Live++. So that is all I have today. Thanks, everybody, for coming. I will be over here
if you have any questions, and enjoy the rest of your GDC. [MUSIC]