00:00What's up guys, welcome to this new Unreal Engine 5 tutorial
00:02Today, I'm going to show you how to create your first Unreal Engine 5 game
00:06This video will cover everything you'll need
00:08By the end of the tutorial, you will have a complete game with many features and mechanics, such as a player character, enemy AI, a dash ability, coins to pick up, a map, and much more
00:20If you are a beginner starting to learn Unreal Engine, this video will be perfect for you
00:24And just to give you an idea of who I am, I'm one of the top Unreal Engine instructors on YouTube with one of the biggest Unreal Engine communities out there
00:32I have created games that have tens of thousands of downloads and millions of views
00:35For example, one of my games got over 3 million views in just one..
00:40Today, I show Speed, the biggest streamer in the world with over 13 million followers, played it live on stream
00:47Chat, I heard this game is one of the best games out right now, so let's see how it is
00:52Bro, no, so trust me when I say you're about to learn from one of the best
01:01It's going to be a very easy view to follow, so let's get started
01:06 Alright, so the first thing that we need to do is create a new Unreal Engine project
01:10In this case, I am going to be using the latest version, which is 5.5, and I do recommend that you use the same version as me or above
01:18 With that said, let's select the Game section and the Third Person template
01:24The Third Person template will be a great starting point for learning and creating our game because it will
01:28Already include a functional character movement, so let's make sure that we have Blueprint selected, and under target platform, let's select the Desktop Quality preset
01:41It will depend on your hardware; in this case, I am going to leave it on maximum
01:46Then, sorry, we can leave this enabled because it will include some nice models that we can work with to start with
01:53After that, select a project location, fill in the name, and with that done, we can go ahead and hit Create
02:01And there we go, we have our new project created
02:03 As you can see, there are a lot of buttons, a lot of icons, and a lot of stuff, so let’s go ahead and see how we can navigate through the Unreal Engine interface
02:13The main thing on our screen is our viewport, which renders..
02:18Our level, and on here we can see the whole world
02:21So, if we go ahead and hold the right mouse button on top of the viewport, we can turn our camera
02:30While holding the right mouse button, we can start to move with the W, A, S, D keys and move around like a drone, as if we were playing a game inside Unreal
02:45Simple as that, so remember, right mouse button and the W, D keys
02:50Now, in our viewport, we can also select different actors
02:54Actors are objects, okay? And we can essentially select this one, for example, and we have a nice outline
03:04This icon over here shows that we can use these arrows to move the actor in our level
03:10Now, we are not limited to only movement
03:13Because up here, as you can see in this section of the screen, we have a lot of different tools and parameters
03:21For example, we can switch into the rotation mode, and this icon changes
03:25Now, I can rotate the object along this axis instead of moving it
03:30The same goes for scaling: I can select this and change the scale of the object along this axis, as you can see
03:42Additionally, we can turn on snapping for rotation, movement, and scaling, and also adjust the camera speed of our viewport
03:53Cool! Now you can move around in your level, select different actors, move them, and change their properties
04:00Next, we have the Outliner
04:02It is essentially the list of actors in your level, so whatever actor you want to find will be here if it is in your level
04:14For instance, let's say you're trying to access the Player Start
04:19You don't need to go into the viewport and look for the Player Start, which is here
04:25You can simply go to the search bar and search for "Player Start," and there we go
04:30You can go ahead and select this
04:33Okay, so it's very, very useful when dealing with larger levels, and make sure that you have everything organized in folders so it will be even easier to find things
04:41Next up, we have the Details panel
04:43As you can see right now, it's empty
04:46This is because it only displays the parameters of a selected object
04:48So if I go ahead and select this..
04:50For example, as you can see, we have all these parameters filled with the location, rotation, and scale of this actor in this level, including the static mesh model, the materials, and so on
05:02This is quite important
05:05In this section, you can go ahead and change all about the object or actor that you have selected
05:14For example, the scale could also be changed from here, the static mesh could be set to this, and the material could be whatever else, right? So, this is quite important when customizing your object in the level
05:27Next up, we have the Content Browser, or Content Drawer
05:30As you can see, there is a big button at the bottom of the screen
05:35If I click on this, this panel opens up, and this is essentially your library for this project
05:42Panel over here, you will find all the assets that you have imported in this Sprite, and of course, it will be organized in folders
05:49So, for example, if I wanted to find the character models, I can go to the Characters folder, Mannequins, Meshes, and here we go, we have all the characters
05:57Now, one thing that I always like to do with the Content Browser is to click on Dock in Layout
06:04If I click this, as you can see, this pops up, and now I can simply go ahead and drag this tab to the bottom of the screen
06:11And there we go, it's always attached and ready to be used
06:13Let me just make this a bit smaller, and boom
06:16I always like to have it over here because I am always using this Content Browser to drag and drop things into the level or create new items
06:24So, yes, when we right-click..
06:26Click, we can go ahead and create new assets, for example a new Blueprint, a new level, a new material, and so on, with a ton of different asset types
06:33Now, how can we go ahead and drag new actors into our level? Well, we can go to, for example, level prototyping matches and drag one of these assets into the level
06:43That's how easy it is
06:45And now, of course, with the tools that I showed you, you can go ahead and start to move this around and change how it looks
06:52Now, a quick tip about the Content Browser is to keep it very organized from the start, so make sure that you go ahead and split everything into different folders, and it’s all very well laid out
07:05That way, it will be easier for you to go ahead and develop your game
07:11But the skill of organizing your projects will be..
07:13Acquired by just playing around with your game, so you will see how this process will be way easier as we go with the tutorial and overall developing your games
07:22And last but not least, we have the play mode options
07:24If we hit this big green button, we enter play mode
07:30If I just click on here, I enter play mode and can go ahead and play my game
07:35As you can see, this is super cool, and I can just go ahead, move around, put, and push these cubes to play my game
07:42When I press Escape, I quit and return to my editor mode
07:47Now, when you press play, you can also press F8 to eject, which allows you to have your mouse control again and go ahead and change stuff while you are in play mode
07:57Just keep in mind that if you change stuff while you are in play mode, those changes may not be saved
07:59Actors are in play mode
08:02When you stop playing, they will reset back to normal
08:04So, for example, if I have this cube and move it to here, right? When I click this button to go back to my play mode, as you can see, it moved
08:14But when I press Escape, it goes back to normal
08:16All right, so there we go
08:19Now you should be able to move around your viewport, select actors, move them around, and change their properties
08:27For example, the material—I could go ahead and put in this blue one
08:31There we go
08:35As you can see, it's super easy to customize things, right? But of course, it is time to begin creating our game
08:39For this tutorial, if we press play, as you can see, we have this character movement, which works really, really well
08:44But the character right now is the default man
08:50For Unreal Engine, so let's go ahead and import our custom model and custom animations
08:54What I am going to do is leave a link in the description where you can download all the resources that we will be using in this tutorial
09:03It will be a zip file, so simply unzip that file and then open up the folder, and you can access all the models and everything
09:10 In the Content Browser, let's open up the Character A folder, and right over here, let's right-click and create a new folder, and let's call this Villager
09:15Open up this new folder
09:20 This is where we're going to go ahead and import the new models, animations, and textures
09:25Let's open up the folder that I will leave in the resources, and open up the Player Character folder
09:32As you can see, we..
09:34I have an FBX, which is essentially the player model, so simply select this and drag it into the Content Browser
09:38As you can see, a new window will pop up with all the configuration options for the import
09:45Now, in this case, let's leave everything at the default, so do not change anything
09:49The only thing we need to make sure of is that, under the Common Settings, Automation, and Animations, the option "Import Only Animations" is disabled, and the Skeleton is set to None
09:58With that said, click on Import, and boom, as you can see, we have the new character
10:03Now, we have some issues; this is because the textures did not import
10:08As you can see, this is simply because we need to go ahead and import them separately
10:14So let's go ahead and open up the folder once again, and as you can see, I..
10:20I also left the textures, so simply drag them into the Content Browser, and there we go — we have a new folder with two textures, which is just great
10:26So now, the only thing left to do is to apply these textures to the materials that have been automatically created
10:32Let's double-click to open up the material, and start to apply this texture
10:37Now, the Material Editor in Unreal is really nice because it works with nodes, which means that any beginner can pretty much pick up the basics pretty fast
10:47As you can see, we have this Output node, and this will essentially handle the base color, metallic, roughness, and all the properties on how the material output will look
10:58So in this case, we simply need to drag the texture to the Base Color input
11:02which is how it looks, so let's right-click to add a new node and search for Texture Sample, and simply click on this
11:08As you can see, when we select this node, the Details panel, as you might remember, fills in with all the properties of what I'm selecting
11:17In this case, we can go ahead and select a texture, so let's find the Villager texture, which is just simply T_Villager, the one with the colors
11:29Then, simply drag the RGB channels, which are all the colors, to the Base Color
11:32Boom, if I apply and save, as you can see, Villager now has all the colors and everything like that, which is really cool
11:40But we are missing one important step, which is to also add the Specular, Roughness, Metallic, and all of this to make sure that the..
11:52The material will behave correctly with lighting and so on, so this is pretty straightforward
11:57We're going to simply right-click and add another texture sample, and for this texture sample, let's select the other texture that we have for the Villager, which is MRSS
12:10Okay, and simply, we can connect the red output into the metallic and the green output to the roughness, and boom, that's it
12:19Now, the character will have more of a, as you can see, plasticky look, which is really, really cool
12:26And yes, this texture on these two channels contains the information for metallic and roughness
12:35Now, this is not the case for every texture that you use in your game
12:39Probably, you have different textures for each property, but in this case, Unreal Engine made it very..
12:45Efficient, and yes, by the way, I'm using an Unreal Engine PR sample character, which is called Cropout
12:50Okay, if you want to check that out, so boom, make sure to apply and save the texture
12:56Close this, close this, and now we have our character, but of course, it's not where we want it to be, right? We want to replace it with our mannequin, so let's go to the Content folder and open up the Third Person Blueprints
13:06And boom, we have this Third Person Character Blueprint
13:12Now, Blueprints in Unreal Engine mean two different things: the first ones are the actual nodes, which you might know as Blueprints, which are the code and the logic, but we also have Blueprint classes
13:24In this case, the Third Person Character Blueprint is indeed a Blueprint class, so double click to..
13:32Open this up, and when we open this up, we have the Event Graph tab, which is essentially what you might know as Blueprints, which are, you know, all the nodes and so on
13:42Additionally, we also have the Viewport tab, with many components, and as you can see, a mesh, a camera, and so on
13:49Blueprint classes can also contain components, including nodes and logic
13:52So, make sure you understand the difference between the two
13:59 Okay, so in this case, if we go to the Viewport, we can simply select the mesh component in this blueprint
14:05As you can see, we have a Details panel
14:08If we scroll down, we'll see the Skeletal Mesh asset, and we can simply change this to our Villager, and boom! Things break
14:15Why? Well, this is because it's using other..
14:17Animations for the other skeleton, so yes, the mannequin uses a different skeleton
14:23Okay, which is how the character is built and rigged for animations
14:29So, simply in the AnimBP class, click on the X, and if you compile, this thing will go back to normal
14:37Now, we will see what the AnimBP class is in a second
14:41But now, when I press Play, as you can see, we are just kind of walking around with our new character, which is cool
14:48Of course, the animations are still not there, so now it is time to add our animations
14:51You can go ahead and find the animations once again in the Resources folder, as you can see under Player Character
14:59We have animations and a bunch of different animations
15:01Before we go ahead and drag them into our project, let's..
15:05Go ahead and, once again, create a new folder
15:10So, under Characters, let's open up Villager, and right over here, let's right-click and create a new folder
15:15Let's call this Animations
15:17Now, yes, inside this new folder, we can go ahead and select all the animations and drag them in
15:25Make sure that you leave everything by default except two different fields, which are to import only the animations and the skeleton
15:33This is very important; make sure that you select the Villager so it will know which skeleton to import the animations onto
15:40With that done, we can click on Import, and boom, we have all the cool animations
15:48If I go ahead and click to open them up, you can see that they work perfectly fine, which is really cool
15:53Alright
15:58So now that we have all the animations that we need imported into our project, it's time to use them in our player movement
16:03First of all, let's go ahead and select the skeleton mesh that we added earlier for testing the materials and delete it because we don't need it anymore
16:13We go ahead and spawn our player when we press play, and now yes, it's time to create our first animation asset
16:18Inside the animation section, let's right-click and go into the animation assets
16:20Right over here, as you can see, we have a bunch of assets that we can create from
16:27In this case, we want to create a blend space
16:28Now you see that we have a blend space option here, but there's actually a simpler version, which will be much easier to start with, so if we scroll..
16:37Down to Legacy, we can find BL_Space_1D
16:39Select this, and now over here we need to pick the skeleton, which in this case, as you might know, we're going to be using the skeleton mesh of the villager
16:51Select this and rename it to something like Villager_Unreal_Blend_Space_1D, and open this up
16:52There we go
16:55So, what is a blend space? Well, a blend space is an animation asset that will enable us to transition between different animations depending on the player's speed
17:09If we are not moving, therefore our speed is zero, we will play an idle animation
17:16But if we are moving, therefore our speed is greater than zero, we can play a walking animation or even a running animation, depending on our speed values
17:25And this is all controlled in this timeline over here
17:29The horizontal axis, and that's why we chose the one-directional approach, because it only contains one axis, not two, which include a vertical axis, and that's more complicated, but we don't need that right now
17:42Okay, so in the asset details, we need to configure this horizontal axis with the values that you want to have
17:52In this case, the name of this axis will be "Speed," as that's the parameter we want to control in the blend space
17:58Now, for the minimum, this will be zero, and then for the maximum, it will be the maximum speed
18:02Now, how do we find out what the maximum speed of our character is? Well, we can simply go back to the Content Browser, go to Content > Third Person > Blueprints, and open up our third person character Blueprint
18:14Right on the Component section, if we scroll down, we can see a Character Movement Component
18:22If we select this, in the Details panel, we can scroll down and find this value, which is Max Walk Speed, set to 500
18:28So, our speed will be 500 for the maximum value of this axis, and that's it
18:33This timeline will now go from 0 to 500, so this means that now in the Asset Browser, I can find all the animations for our player
18:45 We can drag the Idle animation and put this Idle in place
18:49Right now, this Idle is with a speed of 17.27—well, that's not correct
18:52We want to play the Idle animation when the speed is zero, so I can simply drag this all the way to the left, to where the speed is zero, as you can see
19:04Now, I can get the walk animation and put this at the end, where the speed is 500
19:09Now, if I hold Left Control over this timeline and move my mouse around, you can see that as the speed increases, we transition into the walking, and it's super cool, as you can see
19:23We will get a very, you know, smooth transition; it's going to be very easy to play around with
19:29So, with that said, we can save, close, close, and go back to our Animations folder
19:34Alright, cool
19:39So now, how can we go ahead and use this blend space in our character? Well, for that, we need to create an Animation Blueprint
19:44Yes, there are also Blueprints for animations, so in this folder, let's right-click, go to Animation, and create a new Animation Blueprint
19:55And here, once again, we need to find a specific skeleton, which will be our Villager
20:01We create, and let's name it
20:03This above villager, and boom, so let's double-click to open this new Animation Blueprint, and boom, we find ourselves with the AnimGraph
20:13Now, once again, animations in Unreal Engine are super cool because they are done with Blueprints, which is really nice for all types of developers
20:25In this case, as you can see, we have this graph over here with a node, and this is the Output Pose
20:33This means that whatever is fed into this node will be what is displayed in our character animation
20:38So, if I were to literally just go in the Asset Browser and drag the walk animation and plug this in, if I compile and use this, we will only see the walk animation
20:52Now, it stopped because this node is not set to Loop, but if I set this to Loop in the Details panel, it will..
21:00Continuously work, and I mean, this could technically work, right? We will literally just have a looping walking animation, and that will be our output pose, and then we can use this in the third person
21:12But of course, we are going to use our blend space
21:15But before we use our blend space, let's see how we can apply this animation blueprint to our, you know, character blueprint, because right now it still doesn't work
21:23So, let's go to Content > ThirdPerson > Blueprints and open up our ThirdPersonCharacter blueprint
21:27If we go to the viewport and select our mesh, we can see the Skeletal Mesh component, and this is what we previously deleted with the X over here
21:37But now, of course, we need to go ahead and apply the Animation Blueprint, which has the correct setup
21:44Animations and skeleton mesh for this character, and now boom, as you can see, we have exactly the same animation that we're feeding into this output
21:52And if I press play, we have the animation working
21:57Now, it looks very bad because, well, when we are not moving, this animation is still playing
22:01So this is where we need to link the Blend Space
22:06Delete this node and drag the Blend Space into here
22:10Now, if we connect this here, boom, we are using the Blend Space
22:16So, this is our value of speed right now; it's set to zero, therefore the character is not moving
22:21But if I set this to 500 and compile, boom, this makes the character move
22:26So, this is working just fine
22:32I mean, if I set this to zero and press play, we are playing the idle animation, but we still..
22:37We need to connect the speed parameter here with our actual velocity in the game
22:41So, how can we do this? Well, through variables
22:44Let's right-click on this value and promote it to a new variable, and let's go ahead and name this 'speed', all lowercase, and connect this
22:49There we go
22:55Now, this value will be fed from this variable
23:00Okay, and if you don't know, a variable is simply a named data item
23:06For example, this variable could contain any type of number, and this will be fed into the speed
23:13A float is a variable type, and a float is simply a number with decimals
23:22So, we can be super precise with our speed
23:25We will check out variables a bit later on when we go into the Blueprints and so on
23:27But in this case, let's..
23:30Go to the Event Graph now
23:32These are actually Blueprints, okay? So, Blueprints are not only in certain Blueprint classes like our Player Character; they will always be available, for example, in Animation Blueprints and so on
23:43They're used a lot across different types of assets
23:47In this case, what we need to do is, in real time, while we’re playing the game, get our current speed of the player and feed this into this variable so the Boolean space will update, and then the output post will match the one that we want, if that makes sense
24:04So, the only thing you need to do right now is just update this variable with the current speed of the player, and we can do this, as I just mentioned, in the Event Graph, where we can actually run Blueprints
24:15So right now we have two different nodes
24:17We have the Event Blueprint Update Animation and the Try Get Pawn Owner
24:23Basically, this node is the event that updates every single frame
24:27Okay, so every frame
24:29I mentioned that we are running at 60 frames per second, so it will be executing the following code
24:39Therefore, this will be constantly looping and checking for some data
24:41In this case, we can go ahead and use this to constantly, in a loop, update this variable with our player's movement
24:51Then, we have the Try Get Pawn Owner
24:55This node essentially gets the owner of this animation blueprint
24:57For example, in our third-person character blueprint, if we select our mesh, you can see that the Anim Class is Villager in..
25:07In this case, the owner of this animation class is this Blueprint, so we will be getting the owner, and that's super cool
25:15Why? Well, because this is a Pawn, and a Pawn essentially is something that can move, therefore we have the property of velocity
25:20So, this means that I can go into the "AP Villager" blueprint, drag, and say "Get Velocity," and get this velocity over here
25:30As you can see, and literally with that, I can go ahead and plug this into my variable
25:39But we have a single issue: this is a vector, and our variable is a float
25:43So, there are different variable types
25:46Here's a quick note to fix this: we can just use the vector length, and it will convert the velocity into a float, which will be essentially this speed
25:54So then I can just drag this, and we have two options
26:00You can get the variable or set the variable
26:02In this case, we want to update the variable, so 'Set' will be the one that you want to select, and then we can plug the update to the 'Set.' Drag the return value of our velocity to our 'Speed,' and now, when I compile and press play, as you can see, every frame this is being called, and therefore, we're getting the owner's speed
26:21So, the third-person C++, you know, velocity, converting this into a nice float and putting this into the 'Speed.' Now, if you didn't understand the workflow of this, don't worry because we will go more in-depth in Blueprint notes when we go into the AI and so on, which will be right after this
26:38Okay? But now, what you just need to know is that, boom, we have this length, and we can go
26:45Ahead and move around, and when we are now moving, the speed is zero; therefore, in our blend space, we play the idle animation
26:50But when we move, we have a different type of speed, so we go ahead and move, which is really, really cool
26:57So there we go
26:59Now, this is cool, but right now, at this moment, we are slightly limited because if we press play and jump, as you can see, we are not really playing a jump animation
27:09It's just kind of bugging out because our speed is increasing but not in the correct way
27:14Of course, we are flying, right? We're falling, and we don't want to play the walk animation even though our speed is high, because we are just falling
27:19We want to play the jumping animation
27:24So, how can we do this? Well, creating multiple..
27:29States, so let's go back to our Characters folder, Villager Animations, and open up the Villager
27:34Right over here, we can go to the Behavior Tree graph
27:40In the Behavior Tree graph, that's where we basically place all the animation nodes, and in the Event Graph, that's where we go ahead and get all the logic to fill into these animation graphs, as you might have discovered already
27:53Right, so what we need to do right now is go ahead and create different states
27:58 We will have a state of, you know, on the ground, which will be like walking and idle, which is this state, and then we'll have another state of jumping
28:04Then we're going to have another state of falling, and then another state of landing
28:08Right, so this is exactly what we need to do
28:14 So, how can we achieve this? Well, we can just right-click on this graph and type "State Machine," and we can create a new state machine
28:19So, let's go ahead and click this and rename it to something like "Locomotion," because this will essentially be the locomotion of our character, right—the movement
28:27So, let's go ahead and connect this to "Result," and just move this apart and compile
28:33Now, you will notice that we have a warning, and our character lost the cool animation that he was previously using
28:41This is because we are now fitting the output post with this state machine, which is essentially empty
28:46So, let's double-click to open up this state machine and start adding some states
28:51From the entry point, we can create a new state and name this to something
28:58As idle and walking, and now we have a new state which will be, by default, connected to the entry point, and it will simply contain the idle and walking animations
29:12Now, right now, of course, there's still nothing inside of this, you know, walking node
29:16So, if I double click, I can open up this new state, and we can put something once again into an output node
29:22In this case, we want to drag our animation blueprint space, so in the Content Browser, we can drag this, connect this to the result, and boom, we're good to go
29:33We just need to, you know, plug in the speed variable as we did before, and that's it
29:39Compile, save, and we are back to normal
29:41This is because, in our Locomotion State machine, we have an initial state, which is the idle walking, and this contains our blend
29:48So now in here, we can delete these two nodes, and we have a fully working State Machine
29:54Of course, this still won't fix our problem of jumping because we haven't set up the other states for jumping
30:00If we double-click to open the Locomotion State Machine again, we can start to create new states
30:04Let's right-click and add a new state, and let's call this "Jump." In this new state, double-click and drag the jump animation, then connect it, compile, save, and go back to the Locomotion State Machine
30:19Now we have a new state with our jumping animation
30:25So, how do we go from here to there? Well, we can simply connect the states
30:30If we hover over the border of this state, we can drag and create a transition
30:35Transition, so now we can connect this to this other state, and boom, we have a nice transition
30:42Now we need a rule for this transition to happen
30:45As you can see, it's identified with this little icon, so if I double-click on this, we can enter into a Boolean result
30:53Booleans in Unreal are basically true or false, well, in Unreal or any programming language, really, right? So if something is true, we will transition from item walking to the jump state
31:04So, how do we go ahead and set up this transition, and what do we specifically put on it? Well, it will simply be if the character is not on the ground, aka is falling, and our character movement component does have that value
31:20So if I go to the V-Graph, as you can see, we are, you know, getting the owner, right? So it's Our character is getting the velocity length and putting this into the Speed variable, so we need to do exactly the same thing for our characters, whether they're on the ground or falling
31:38We do have a variable for this now
31:41You will see that if we drag from here and say okay, get, you know, falling or whatever, we will not get anything
31:46This is because we need to get the specific class, because right now this is simply a generic Pawn
31:52Okay, now a Pawn is basically a character in Unreal Engine that can move, but it doesn't know what type of Pawn it is, because this could be another blueprint
32:03You know, this could be like an empty blueprint of a character that doesn't contain any logic
32:06So, how do we know that is the Villager blueprint, and how do we access all the logic? Well, we can..
32:14Do one thing, which is to cast
32:16Okay, so right over here, let's add a Begin Play, Blueprint Event, so when the game starts, we will go ahead and do something
32:23In this case, we want to copy and paste this node, and from here, do a cast to the Third Person Character Blueprint
32:26Boom
32:30So, what does this cast node do? Well, we simply access this specific class
32:34Right now, the owner could be anything because this mesh has the Animation class, but the Animation Blueprint doesn’t know what specific class it is; it just knows that it is on something
32:51So, in order to find out if we are in a Third Person Character, we need to use this cast node
32:58If we cast, we can now get all the properties
33:00Therefore, we can save this cast into a variable, and this will be simply the character
33:04BP, so now we have the whole character Blueprint in a nice variable that we can call at any time, and this character Blueprint contains all of this information
33:14So back over here, I can drag Character BP and get the movement component
33:19If I scroll down, we can find it over here
33:22This movement component is essentially this component, and it contains all these options
33:31Right, so over here I can say 'Falling,' and there we go, we have a movement variable which is 'Is Falling.' Make sure to not select the one of NavMesh, but to select the one of Movement, and boom, we have a nice Boolean
33:47Therefore, we can right-click, promote this to a variable, and this will be 'Is Falling?' question mark, because it's a Boolean
33:54Drag this here, and there we go—nice and simple
33:55Now, in the update, we are also checking if the player is falling or not so we can play the jumping animation, the falling loop, and the landing, and all this kind of stuff
34:12Right now, this is only accessible through the character's variable, not through the Trio Graph Point Owner because, well, our character's variable is a direct reference to our Third Person Character class with all the components
34:23Okay, so with that done, it is time to go ahead and make sure that we can transition
34:28So, back in our transition, we can simply get it falling and plug it in
34:33Now, if we are falling, we will play the jumping animation, so if I go ahead and jump, boom, we play the jumping animation
34:41But, of course, when it ends or we reach the ground, it doesn't go
34:45Back to our transition
34:47This is because we don't have a back transition, but of course, we don't want a bad transition just like that
34:54We want to be able to play a landing animation and more stuff, right? So, we have the jump state, but now, just when we finish jumping, we want to transition into another state
35:03So, let's add a new state, and this new state will be the Falling Loop
35:09All right, boom, there we go
35:11Why are we adding a Falling Loop? Well, I mean, here the ground is pretty close, but imagine that I climb up here and I jump
35:20As soon as the jumping animation finishes in midair—so, imagine that the animation ends over here—I will go back to idling in midair
35:27I only want to do so when I'm on the ground
35:34That's why we want to enter this
35:39New state: drag, fall, loop, connect this over here and make sure to select the default Loop, and on the details panel, enable Loop animation
35:47That way, this animation will loop, and it's important because we don't know how much time we're going to be falling, and then we want to add one last state for landing
36:00Now, if we double-click on this state, we can drag the land animation and connect it over here
36:04Of course, we don't want any looping or anything like that because this is just a one-time animation
36:13So once we jump, we immediately want to go to the falling loop without any condition
36:17We can go ahead and enable the automatic rule based on sequence, so that once we finish playing the jump animation, it transitions to the fall
36:27Alright, now to go from falling to landing, we need to do one thing, which is to check if we are no longer flying
36:37So, we drag this, we can get a boolean, and this will mean that this is not true
36:43So, if we are not falling anymore, we will go back to normal, and this will work
36:49If I jump, I go back to normal, as you can see
36:51But there's still one last connection to do, which is to connect from landing back to idle and walking
36:57So, I can put this over here, select this sequence, and enable the automatic rule based on sequence once again, because as soon as the landing animation finishes, we want to go back to idle or walking, and we don't want any condition
37:14And now, this works — if I jump and land, everything works as it is, but we're..
37:18Having one error when we, you know, exit the play mode, and it's basically trying to access the Character Blueprint variable, but it's not assigned
37:26This is because the Begin Play is starting after the update animation
37:31So, the only thing I need to do is right-click on this Character variable and convert this to a validated get; therefore, it will only go ahead and continue executing the code if this Character variable is filled in
37:47Because, otherwise, this will be null, which means it will contain essentially nothing
37:53Therefore, this will be empty, and you know, it will simply just cause errors
37:57Now, when we actually go ahead and press Play and move next, here we don't have any errors because we only continue if this Character variable is set
38:06And with that done, we want to do one little thing, because right now when we go ahead and walk, jump, and land, as you can see, the landing animation doesn't look very good because it's standing still, but we're still moving
38:17So, we want to make sure that this is an additive animation
38:21An additive animation is essentially an animation that plays on top of another one, and it merges them to create a nice transition
38:31 So, we go to the Characters folder, go to Villager, and then Animations
38:35We can go ahead and open up the Land animation
38:37When we scroll down, we can see that the animation type is set to Additive
38:42In this case, we want this to be on Local Additive, and we set this to be a Frame
38:47I'm not going to go from this
38:52Animation, okay
38:58Now I'm not going to go into a lot of detail into this, so I'm going to just plug in frame 15, for example, or even 20
39:03But basically, this is a simple setting to make sure that we have an additive animation going on
39:10Like I said, I'm not going to really explain in detail because you don't really need to know this for this tutorial
39:19Okay, so with that done, we need to do one little configuration because otherwise, boom, a character disappears
39:24Why? Because there isn't any additive animation to add on top of the landing, and it simply bugs out
39:30So, back in our Locomotion States, we can go to Landing and use this node, which is the Additive node
39:37It has to be set to Apply Additive
39:40Now, our base will be not our Landing
39:43This will be the additive, right? But our base will indeed want to be our blend space
39:48Okay, so let's connect this over here, directly the speed, and that's it
39:52This will mean that our base for the additive animation will be our current Locomotion, but our additive will be the landing
39:59Therefore, now when I walk and land, as you can see, boom, he lands and he continues to walk, and everything is perfect
40:08So, there we go, we have all the animations for our character set up, which is looking really, really cool
40:14Okay, so now we have all the animations for our character, and it looks incredible, right? And we actually only built this in a couple of minutes
40:25It's pretty straightforward if you learn the blend space and simply some states in the animation
40:28Blueprint, but now it is time to go ahead and continue creating our game
40:33And by the way, guys, if you are finding this tutorial helpful, I would really appreciate it if you could like the video and subscribe to my channel
40:41I have over 700 Unreal Engine 5 tutorials, and on top of that, join my huge Discord server with over 10,000 game developers to be in the best conversations
40:48With that said, let's get back to the video
40:51The next thing is an enemy AI
40:54Now, before diving into enemy AI, which we're going to make very simple, let's go ahead and cover a bit of the basics for blueprints
41:04I know that I covered them a bit in the animation blueprint because of the Event Graph, but I want to go a bit more in depth with them before we proceed
41:12Diving in with our AI, so for this, what I'm going to do is open up the Third Person Character blueprint, which is under here, and let's implement the logic
41:21Okay, so basically, notes in an Unreal Engine Blueprint will always go from left to right to whatever they're connected to
41:25Okay, so how do they work? Well, basically, as you can see, we have a main kind of plug, which is the white one
41:35This is the executable connection
41:38Okay, so as soon as this node executes, this will go to the next node through this white cable
41:43Okay, and you will see—oh, there's other cables that are connected to—what is going on? Well, basically, each node might have an input and an output
41:54Okay, the inputs will always be on the left side and the outputs on the right side
41:59Okay, so
42:04Basically, this Player Controller needs an input, and this other node is given that input, okay? As simple as that
42:09But if I was to disconnect this, you know, the main connection, which is the executable connection, right— the white one— this will simply not execute because we only have one pin, which is the input
42:21But this will never execute because we need this white one
42:27Okay, so with that said, let's go ahead and dive in on how we can make a simple flashlight
42:32Now, this flashlight does have nothing to do with our game; this is purely to learn blueprints for a second, okay? Because I want to do that before we dive into AI, and actually, a flashlight is quite interesting to make
42:47Okay, so let's go ahead and make sure that when we press a..
42:49We turn on this flashlight, okay? So, let's right-click on the graph to add a new node, and let's search for, you know, the E key, for example
43:00Right, scroll down until we find the E key, which is here, with a Style, and direct this
43:04Okay, so once we press the E key, we can do something
43:10So, just as a test, I could drag and add this Print String node, and it will print, you know, "Hello" on the screen
43:18So, I press Play and press E—boom! We get a lot of "Hello" at the top left of the screen
43:23Right, so as you can see, this is executing because this execution pin is connected
43:26Okay, but instead of printing "Hello," we want to enable a flashlight
43:31First of all, a flashlight is essentially a light
43:34So, how can we go ahead and just add a light into our world? Well, as you can see in the..
43:44In the component section, we have a lot of stuff that we can add, meaning that we can add a point light
43:50So, if I go to the Capsule Component, I can drag a Point Light, and boom, this will be a flashlight
43:56So, I can place this over here, right, and rename this to be "Flashlight." You can really add whatever type of component you want
44:02Now, what we can do is make sure that this flashlight is disabled by default because, if we press Play, as you can see, it's enabled
44:08So, in the Flashlight component, I can simply search for "Visibility" and disable it
44:14That way, when we press Play, it's initially not enabled
44:20But if I go back to the Blueprint graph and drag this flashlight—which I can just drag from the components—I can set the visibility to be enabled, so we..
44:26Enable this Boolean
44:32I can press Play and press E, and boom, we enable the flashlight
44:38As you can see, this is very simple
44:43When we press a key, we go and execute this node based on this white cable, and then we can go ahead and do something
44:51Right, so we access a component that we had and then go ahead and enable this
44:57Now, this visibility can work for pretty much anything
44:58Right now, I have the input as I mentioned before, because it's in the left side as the flashlight, but it could be the mesh
45:05If I drag this and do the inverse, it disables it when I press E
45:09Boom, the mesh disables because we are essentially passing a target to disable, and it doesn't really matter what
45:14That's it
45:17I just wanted to kind of cover that basic
45:19And now we..
45:22Let's dive into our AI
45:24All right, so now it is finally time to create our enemy AI
45:26In the Content Browser, let's right-click and create a new folder, and let's go ahead and call this folder "Blueprints." In this new folder, let's right-click and create a new Blueprint Class
45:35Now, what we can do is pick a parent class for this blueprint
45:41Think of this as just a preset, for example
45:43If we want to create an AI, in this case, we will go ahead and select the Character preset, which is the closest option available
45:51For example, we have the Actor class, which is just an object that can be spawned or placed in the world
46:00As I mentioned at the beginning of the tutorial, we also have a Pawn, which is an Actor that can handle input and movement
46:06Input from the player: the character is simply just a pawn that can have the ability to move around and so on
46:12So, of course, as I just mentioned for this AI, let's select the character class and now let's call this BP_EnemyAI and open this up
46:16As you can see, this is very similar to what we had with the Third Person Character Blueprint, but it's a brand new class that is empty, so we need to fill in some stuff
46:31Let's go ahead and select the mesh, and in the Details panel, we can go ahead and assign a new Skeletal Mesh
46:38Of course, this will be our villager
46:40Now, as you can see, when we added it, it was in the incorrect position, so what we can do is just go ahead and manually adjust it
46:48Now, there's a quicker way to do this, which is just to go to the Details panel and..
46:53In the location on the Z axis, just put -89, and then for the rotation in the set axis, put -90
46:59That's a quick way to snap it into place
47:05As you can see, if I compile and save, go back to my level, and drag it, I can rotate it so it's facing me
47:11When I press Play, we have the enemy AI over there, but of course, it's not even animating yet
47:14So, let's go ahead and make sure that we have the correct animation blueprint assigned to this enemy AI
47:21Let's go back to the blueprint, go to the mesh component panel, and check the class
47:25As we did with the other player, we need to add the Villager
47:30Now, yes, we have the enemy AI animating, which is really cool
47:35So, now it's time to make him chase me around
47:39So, let's go back to the enemy AI
47:43and open up the Event Graph, and I start to go ahead and implement the logic for this AI
47:47Now, for this tutorial, we are going to go ahead and make the AI very, very simple
47:52The AI will be able to detect the player, then simply chase him, and when he reaches the player, he will simply attack
47:58So, let's go ahead and delete this "To Nose," which is the "Big Play" and the "Take," and simply leave the "Begin Play." Right over here, what we are going to do is right-click and create a custom event
48:08A custom event is our own event that we can call at any time
48:13So, let's go ahead and select this and simply rename it to "Chase Play." Now, whenever we call this event, we can execute whatever code is over here, and of course, in this case, we want to make..
48:28Our AI moves to the player, so we can call this node, which is AI Move To
48:33This is a super nice node, which is the default in Unreal
48:37We will simply just move the AI to the destination
48:40As you can see, it contains some inputs that it needs in order to work correctly because they're on the left side of the node
48:48As you can see, we have the Pawn—what pawn it needs to move
48:52Well, we want to move the AI, so I can drag it and select Self, and simply get a reference to Self
48:57That way, this node will know that we want to move this Blueprint, which is the Enemy AI
49:01Now, for the destination, I do not want to set a manual location in my level
49:05I want to go ahead and assign, instead, a Target Actor that it can follow
49:10And of course, in this case, the target will be the Player character
49:13So I..
49:17You can simply say 'Get Player Character' and use this node, and now the AI will go to the Player Character's position
49:21Then we have the acceptance radius; this is how close the AI will get to me
49:27Let's increase this to 120, so he doesn't get too close, you know
49:33And that's it
49:39Of course, right now nothing will happen because we're not calling this 'Chase Player' event, but just as an example, if I set this 'Chase Player' event on the 'Begin Play,' when I press 'Play,' the AI will go ahead and chase me
49:45But as you can see, he doesn't
49:49Why? Well, this is simply because there's one thing that we need to add into our level
49:55This is not a bug in our code; this is simply a configuration that Unreal needs in our level to be able to make AIs move around
50:03So, if..
50:06We go up into the Quick Build section, we can go ahead and just add a bunch of stuff into our level so you can see, but in this case, we are interested in the Volume section and specifically the Nav Mesh Bounce Volume
50:19If we drag this into a level, as you can see, it's a simple box
50:24But if we select this, go to the Details panel, and then in the Scale, make sure this is locked, we can set this around 20
50:32Now, as you can see, this box will fill the whole level
50:34With the viewport selected, we can press P, and boom, we can see this green area
50:38This green area is all of the calculated paths that the AI can go through
50:44Okay, so this is an essential step when making AI; otherwise, the AI will simply not move
50:50Now, if I press Play, boom, he starts to..
50:55Chase me, as you can see, he reaches me and he stops, so everything is going ahead and working perfectly
51:00But you might have noticed that he's going a bit too fast, right? It doesn't really match his walking speed
51:06So back in the blueprint of our enemy AI, we can go ahead and select the character movement component and, in the details panel, edit its parameters
51:13As you can see, if we go to the Max Walk Speed, he has a speed of 600, and as you might remember, this is incorrect
51:23It has to be 500 to match our animations
51:26If now we compile and press Play, it will match the player's speed, and it looks way better
51:30Now, there's one last thing that we want to change about our character's movement, which is the rotation, as you can see
51:38He kind of..
51:40It snaps right, so we want to make sure that his rotation will be smooth, so it looks realistic and it looks kind of nice
51:46So, back over here, what we can do is select the character movement component, scroll down until we see the rotation settings, and simply enable Orient Rotation to Movement
51:55Then, last but not least, let's go to the class defaults and search for 'Yaw' and disable this
52:02We essentially just swapped the rotation setting of this AI, so instead of rotating using the default Pawn Movement, we will use the Character Movement, which is way smoother
52:12Okay, and now, yes, as you can see, he rotates way smoother
52:18It's not super obvious, but this looks a bit cleaner
52:20Okay, now, instead of making sure that he immediately, you know..
52:22It starts chasing me even when he's not seeing me, right? We need to make sure that he only chases me if he detects me
52:32How can we do that? Well, there's a really nice component in Unreal Engine that can easily handle this
52:36If we go and add a new component and search for Pawn Sensing, we have this component
52:41So we just click on it, press Enter, and add this new component
52:47As you can see, it added a lot of kind of crazy stuff
52:50This is essentially a set of gizmos representing the AI's vision, the AI's hearing, and all this other sensor data
52:57So, if we select this, we can go to this panel and change the parameters
53:04Let's go ahead and make sure that the AI cannot hear us, so let's disable hearing by setting it to zero
53:12Also, disable sound detection, okay, because..
53:13We're going to have a simple AI, and we're not going to include hearing or anything like that
53:16Then, for the sight radius, let's set it to 2,500, so he cannot see me from very, very far away
53:24And then, the field of view angle, let's set it to 85, so his vision is a bit more focused
53:32Now, when we press play, we still get the AI instantly going for us because we forgot one step, which is of course to link this event, which is on the AI Pawn, with our Chase Player
53:41So, at the beginning, delete this Chase Player
53:50As you can see, now he doesn't chase me, but also, when he goes ahead and sees me, nothing happens, because we need to link this on the AI Pawn event with our Chase Player
53:59How can we do that? Well, by simply adding this new event and then..
54:03Calling Chase Player, and there you go
54:07Now it will work because this event is called when this Pawn Sensing component sees a player, and the same play will call this node Chase Player, and everything will work
54:20So now, when I press Play, he doesn't do anything, but I go in front of him, and now he is constantly going ahead and chasing me, as you can see, which is pretty cool
54:31When he reaches my destination, he stops, but now, of course, we don't want him to stop; we want him to go ahead and play an attack
54:35So, let's go ahead and do this
54:38 Alright, so let's go ahead and import the attack animation
54:42For this, let's go up into Window, FAB, and find this Character Interaction Add-On Volume 1
54:47I will link this in the resources ZIP
54:48Basically, what you can do is simply go ahead and add this into the project
54:57Let's go ahead and click this, and after a few seconds, we should have it in our project
55:01This includes some really cool animations, and we have one that will be super useful for our attack
55:07There we go, and the animation is already imported
55:10Now, we have this new folder called Interaction
55:13The only animation we want will be here under Animations, close combat, tag CRAR, this one
55:16Okay, so literally, what we're going to do is make sure to delete everything except this animation
55:23But before we do that, what we actually want to do is go ahead and ensure that this animation works for our character
55:34Right now, this is using the UE4 skeleton, and we want to use the..
55:36Villager skeleton, so for this we can simply re-import it now
55:40It's super easy to do in Unreal Engine 5, and the only thing we need to do is right-click on this animation, click on 'Reimport Animations,' and the source will be U4, but the target will of course be our villager
55:54Now, simply let's search for 'crowbar' and of course select the 'Crowbar Attack,' and with that said, we can click on 'Export Animation.' Now, under content, we can click on 'Export,' close this window, and then we have it over here, working perfectly fine
56:09The only thing we want to do now is go ahead and delete the whole interaction folder
56:19Just press delete, delete, yes, and then after a few seconds and loading times, finding assets, we can go ahead and press delete again
56:29Just a few more seconds, which should be there
56:36We go, this animation is ready
56:39But the interaction folder is out
56:45So, as you can see, I just deleted everything except the animation that we need
56:54Thanks to the ASD Creator for creating this really cool animation that we're going to be using
57:00So, let's make sure to move this into the Characters folder
57:02Let's go ahead and drag this into the Characters folder, move here, drag this into Villager, move here, and then drag this into Animations
57:09Move here, right-click, select New Folder, and let's call this something like Attack
57:16Finally, drag this into the Attack folder, and let's name it "Aore Attack." It's nice and neat, and that's it
57:20Everything is configured
57:23So, now, how can we go ahead and make sure that..
57:27This AI will play this attack and mission when it, you know, sees us and reaches our destination
57:32Do we need to go ahead and open up the Villain's Animation Blueprint and create a new state and all that stuff? Actually, there is a super cool way to play one-time animations inside of Unreal Engine from blueprints without needing to create complicated states
57:50It's perfect for attacks, damage, things, and use in combat and so on
57:56Right, so over here, let's go back to our Content Browser and go into the Attack Animation folder
58:03Right over here, let's right-click, hit, and create a Montage
58:06Let's go and rename this to Attack Montage
58:09That's actually perfect
58:11Now we have this other type of animation asset
58:13So, what is this? Well, this is a Montage, and really..
58:18You can play montages from blueprints at any time
58:19Now that this is a montage, it's super easy because we can simply go ahead and open up our enemy AI, select it in our world, press Ctrl+E to edit it
58:33When we reach the destination, which is on success, right? On the AI move to, the chase player, we can call this node, which is the Play Montage
58:40Let's select this top one
58:46Now we just need some parameters, so first of all, what skeletal mesh we want to play on, but we want to play on our mesh
58:53Connect that there
58:56Which Montage we want to play? There's a dropdown, so we can select this Attack Montage that we just created
58:59And then, everything can be left as default
59:02And actually, now you will see that when we press play, nothing will happen
59:05Why? Well, because an animation montage requires one little thing in our Animation Blueprint to be able to work
59:13So, if we go to Animations and open up a villager, you go to the State Graph
59:20We just need to add this little thing, which is the default slot
59:24So, what is this? What does this have to do with montages? Well, montages are always played on a montage slot
59:32Okay, in this case, this attack is played on the default slot, as you can see; it says "Default." Right, therefore, we need a default slot in our Animation Blueprint to enable this slot to happen
59:44Okay, so just remember that anytime you want to play an Animation Montage, you need to add a slot
59:51Now, we need to add this slot always right before the output node, because, I mean, we cannot connect this right before the output
59:57Because there's not, uh, any inputs right here, but imagine we had an input over here
01:00:02Well, you know, the locomotion will always override the slot, so we will never see our animation montages
01:00:08But if we have this after, our animation montages will happen after, therefore they have a priority, so they will happen
01:00:15You know, so now, yes, when we press play, he will go ahead and play the attack, and boom, he is attacking me
01:00:20Now, it's pretty bugged; this is because the camera is colliding with him every time he attacks
01:00:27So, there's a quick fix for this: we can go to the enemy AI viewport, select the mesh, and then in the Details panel, we can scroll down and in the Collision presets, we can expand this and set it to custom
01:00:41And, as you can see, we have a whole bunch of..
01:00:45Check boxes in terms of ignore overlap or block
01:00:47In this case, we simply want to get the camera trace and set this to ignore; that way, the camera will not collide with it
01:00:55But there's another collision in this actor, which is the capsule component, so we need to do exactly the same thing: select the capsule component in the preset, set this to custom, camera ignore, compile, and save
01:01:06Now this will be fixed, and boom
01:01:08But as you can see, he bugged kind of at the beginning, right when he reached my destination, it kind of bugged
01:01:20This is simply because he's trying to play the animation multiple times without leaving time and space in between, which is just ending up in a kind of ugly-looking effect
01:01:30So, we can do simply create a..
01:01:35Create a new variable, and we can call it "Can Attack." This will be a Boolean, okay? So, this will simply be true or false, depending on whether the enemy AI can attack or not
01:01:45Now, let's select this "Can Attack," compile, and set this to true by default
01:01:48This is very important; otherwise, the enemy AI will never be able to attack
01:01:52So, right when we reach the destination, we're going to check "Can Attack" and add a branch
01:01:59A branch will simply be an if statement, so if this is true, we will proceed to attack
01:02:03Because if this is false, we will not do anything, as we can't attack
01:02:10It's as simple as that
01:02:17Okay, so let me leave some space, and then, once—actually, let's do it here—once we start attacking, we need to make sure to get this "Can Attack" variable and set it accordingly
01:02:24You can set attack to false
01:02:26That way, now the enemy AI will know that it is attacking, so we cannot attack anymore, and pass this part over here, which is then incomplete
01:02:31When the animation finishes, we can simply set this to true, or uncompleted or interrupted
01:02:38Imagine that the animation is interruptive; we want to go ahead and fix this
01:02:44So, with that said, if we go ahead and press play, he will chase me, and boom, he attacks me correctly
01:02:52He waits until the animation is finished, but it doesn't look very good
01:02:54First of all, we need to enable Root Motion in our animation
01:03:00So, let's open up an attack, scroll down, and enable Root Motion, and now you will see that the animation will look ten times better there
01:03:07We go, because the character will move in a 3D space to match the animation
01:03:12Now, this is not available in all animations; this only applies because the animation is well done, okay? But with that said, without getting too in-depth, what do you know about what is root motion? Let's simply continue with our attacks right now
01:03:28It's a bit too long, you know, we want to shorten the attack
01:03:31It waits too long, and it doesn't look too good
01:03:35So, what we can do is simply make sure that the Montage will set the cancel to true a bit sooner
01:03:44We can do this by adding a notify—modify notify
01:03:47So, we open this up, find where we want to go back to our animation to run here, and then in the notify section, we can right-click and add notify, Montage notify
01:03:56Save, close
01:04:04And right over here, instead of "Uncompleted," we can hold Control and move this to "NotifyBegin," and make sure to leave the interruption
01:04:13Now, as you can see, you will go ahead and make the animations a bit quicker, which is pretty cool
01:04:18Okay, this is a small tweak, you know, and now we have this enemy AI, which comes to me, attacks, and then continues, which is pretty cool
01:04:29As you can see, but of course it doesn't deal any damage, so we need to make sure that it will
01:04:37Go ahead and add a knockback
01:04:40So, in order to add a knockback to my player, let's go into the enemy AI, and right over here, we need to go ahead and create a specific component, which is going to be a Sphere Trace by Channel
01:04:50What is this? Well, let's simply add it, and I'll explain as we go
01:04:52Sphere trace by channel is simply a sphere that will go from one point to another, okay, and it will detect things in the way
01:05:02We can use this to detect our player, okay? So, if our player moves ahead and is detected by this, we can apply damage
01:05:11Over here, what we can do is simply add a start and an end point
01:05:18In this case, the start point will be the get actor location of this enemy, so whatever position it is right now in the world, and the end point will be the get actor rotation
01:05:29I want to get the direction that it is looking, so let's get the forward vector
01:05:37That's how we can get the direction it is facing, and then from here, we can simply multiply this by a value
01:05:46But we want to right-click on the second pin and..
01:05:49Convert this into a float, that way it's a simple number, and this will essentially be the distance on which the AI can reach me in terms of the trace
01:05:59Let's put in, right now, like 300, and let's simply now get the location and add this with multiplication
01:06:03This will give us our endpoint
01:06:07Now, for the radius, because this is a sphere, let's put like 25, and that's pretty much it
01:06:14Just to test, let's go ahead and click the debug type and set this for duration, like, you know, 5 seconds
01:06:21If I now press play, you can see that where it attacks, it creates this kind of beam, as you can see
01:06:30So, this beam will essentially go ahead and collide with me, as you can see, and if it collides with me, it will apply some damage
01:06:41So, that's a bit too long
01:06:43Let's make it maybe like 150, and it's just kind of playing around with what looks best
01:06:45Yeah, that's literally perfect
01:06:48Maybe a bit more, maybe like 180
01:06:50Also, as you can see, it's red and it's never turning green like it should because it's not detecting me
01:06:58That's because of the trace channel
01:07:01Right now, it says this one, but to be sure that it will detect only the player and not other things in the world, we will create our own trace channel that only the player can be detected as
01:07:13So, if we go to Edit, press Settings, we can scroll down to Collision, and under Trace Channels, create a new Trace Channel and name this Player
01:07:20Now, the default has to be ignored, so all the assets in Unreal by default will have this trace set to ignore, but then..
01:07:35The player is going to be the only one that has this trace to block, except close, go back to the enemy AI, compile so it refreshes, and then the trace channel is going to be "Player." Now, these two will not work because the player needs to have that Trace Channel enabled
01:07:50So, under the third person blueprints, the ThirdPersonCharacter blueprint, go to the viewport, select the mesh, scroll down, and now we have here
01:07:54As you can see, the Collision presets are set to Custom, and then the player will be blocked
01:08:00Now, yes, as you can see, when the AI attacks and launches a trace, it turns green because it's detecting the player, and it would not detect anything other than the player
01:08:11If it accidentally hits the wall, it will not launch the wall or..
01:08:17Anything like that, there we go
01:08:19So now we just need to add the impulse, so let's go back to the enemy AI
01:08:24As you can see, the Sphere Trace by Channel will give two outputs, right? Because they're on the right side of the node
01:08:31We'll get a return value, which is a Boolean, so have we hit something or not, and then an Out Hit, which has a lot of properties
01:08:37So, first of all, let's check if we have actually hit something, and we will only continue if we have hit something with a branch; otherwise, we might have bugs, you know, and errors
01:08:47Then, let's get the Out Hit and break this, because this is a structure, and this will contain, as you can see, a lot of information about what we have collided with
01:08:57Well, in this case, the AI has..
01:08:58Collided with, right? In this case, we simply want to get the actor, cast to the Character class, and then use the "Launch Character" node—it's as simple as that
01:09:07So, we are simply getting the Actor that the AI hit, casting it to the Character class, so I can access this node of the Character class, and then apply some velocity in which direction? Well, I simply want to copy the direction of the Sphere Trace because it's essentially just going to be the same, right? We want to go ahead and make sure that the AI will launch the character in the direction he's facing
01:09:38So, we can simply copy and paste this node three times, then add one little thing over here—set the Z to around 25—and reconnect this, so he will..
01:09:48Also, go a bit higher, and now when I press play and he attacks me, you will see that we cannot push the player, but it doesn't look very good because there's not enough force
01:10:03Let's go ahead and put this to around 1000, and now you will see that gradually, you will start to get a better representation
01:10:13As you can see, this may be too much, maybe like 500, and then perhaps a bit more, like 120 on the Z, which is set as upwards
01:10:23Okay, as you can see, now we get a better effect, but it's still not perfect
01:10:29Let's put the Z to maybe around 2000
01:10:32Honestly, you might want to add more push over here
01:10:35Let's see—wow, that's too much
01:10:38As you can see, it's really up to you what you set here, but it's just a matter of playing with the values
01:10:47Just playing with values in real time
01:10:50As you can see, we're getting a pretty cool, you know, kind of number
01:10:54Let's put in, like, 850 over here and keep playing with the values until we get what we want, and that looks pretty good, I'm not going to lie
01:11:05So, we can get pushed away, and you can go ahead and play around with the knockbacks
01:11:11The cool thing is that we can make this a variable, so it's easy to edit
01:11:16Just right-click and convert to variable, and this will be the frontal knockback
01:11:20Click compile, make sure it's set to 850, and then right-click and split this struct so we have everything as individual pins
01:11:32Then right-click and promote to variable, and this will be the upward knockback
01:11:37There we go, and I did not write that
01:11:39Property, there we go
01:11:40Cool, and make sure they also set it to 500, okay? So now it's easy to edit from any other part of the code, which is pretty nice
01:11:46And that's it
01:11:53That's really how we have our enemy AI
01:11:59Let's set the Debug Type to None, so we don't see those ugly lines, and we can simply go ahead and push the player
01:12:05And it's looking really, really cool
01:12:07Now, the enemy AI is kind of stupid right now because he's attacking with an invisible weapon
01:12:15Also, you might notice this one little thing: we're actually pushing the player before he swings his axe
01:12:20So, we're going to make a little notification over here, go ahead and open up the Villager Animations attack montage, and change the..
01:12:29Notify to be exactly where we want to hit, okay? So, around here, save, go back to our AI, select this controller, and then in the OnTouch section, change Uncompleted to be here, and in Notify Begin, let's change it to be here
01:12:51So, we essentially just swapped the logic to happen on the Notify Begin, where he launches the trace
01:12:59Okay, so basically at this point in the animation, he will launch the trace, which is where the Notify begins, right? At this point
01:13:12But then, when the animation is completed, we'll go back to the attacking normal, and I know that we had it before, so that the Notify was the ending point
01:13:23But we want to have it, you know, used for the attack traces
01:13:26It's going to be better, and now it's going to be way smoother
01:13:28As you can see, now it actually..
01:13:32It looks much better now, and yes, we can go ahead and import the AI's weapon, right? Because right now, he doesn't have anything
01:13:40So what we can do is use Fabric
01:13:42We go to Window, scroll down to Fabric, and open this up
01:13:47Now we can just find a cool weapon, okay? So we search here, maybe just type in "weapon." Now we can go into the pricing and set this to free
01:13:57You can see that I have a whole bunch of weapons, you know
01:14:05We have, for example, this axe that could be used, which is stylized, and that's important
01:14:11I don't know, we have a lot of options over here
01:14:13In this case, I want to choose this one
01:14:15Yeah, I kind of like it
01:14:17Okay, so let's go ahead and just make sure to put this to the side and simply drag this axe into..
01:14:26The level, and now after a few seconds, boom, it imported the axe, which is pretty, pretty cool
01:14:31We can close the Content Browser, and there we go
01:14:35So let's delete this from the level, and now we have it, as you can see, imported in this Content folder, which is pretty cool
01:14:42So first of all, let's rename this to "Axe." Alright, so how do we add this axe into the Enemy AI's character? Well, what we need to do is create a new socket in his skeleton, so go to Content > Characters > Villager, and open up the skeleton
01:14:58As you can see, we have a hierarchy of a lot of bones
01:14:59In this case, let's find the arm—let's see what, um, arm is
01:15:06Yeah, so we want to attach it to the right hand
01:15:08Okay, so right-click, add socket
01:15:11We name this socket "Weapon." Right-click on this new socket and add it
01:15:16A preview asset, okay, and this will be our axe
01:15:21This socket is essentially like an invisible position where we can go ahead and place, you know, attached weapons and so on
01:15:30As you can see, what we can do simply is add this preview asset to help us position this new socket
01:15:38So, let's go ahead and just put the preview animation to be the attack, so it's easier, and find a spot over here for our attack
01:15:48So, let's do it like here
01:15:50Now, it's just time to go ahead and start to rotate this around, so make sure that this is set on this Cube, so it's local
01:15:58Now, we simply just need to start rotating this, and of course, making this bigger
01:16:03Big is a bit too small, so really, this is nothing, just kind of that
01:16:08It can be perfect, I mean, if..
01:16:10You spend hours placing this
01:16:13I guess you could get perfect positioning, but overall, it's really just making sure that it looks nice
01:16:19And I mean, the thing is that this is kind of stylized, and it happens pretty quickly, so it doesn't really matter if it's, you know, not exact
01:16:28But as you can see, this is pretty perfect
01:16:30And if you want to copy my exact, uh, positioning, you can just copy these values and paste them into the weapon
01:16:35Now, when you press play, you can see that the Mei doesn't have the X because, as I just mentioned, the A is only a preview, so it can help us place the socket
01:16:46Now it's time to open up the enemy AI
01:16:50So I select this controller, go to the viewport, and now, selecting the mesh, we can add a new static mesh, and this will be the weapon
01:16:56Sure, this weapon is a child of the mesh
01:16:59Why? Well, this will enable us to attach it into the socket
01:17:02So, first of all, the you know, set MH will be the X, and then the parent socket will be the weapon
01:17:07And there we go
01:17:12It only appeared because it's a child of the mesh, and that's it
01:17:17Now, let's make sure that the weapon has the Collision preset set to No Collision, because we detect the player with a trace
01:17:24Now, with the sword or with the axe or whatever it is, and now, yes, he goes, he attacks, and it looks perfect
01:17:32As you can see, it looks like he's actually applying damage to me through the axe, but it's actually done through this invisible trace, which is really nice
01:17:40Right now, the enemy can go ahead and kind of slam us, but we cannot go
01:17:45Ahead and simply dash over right to escape around the enemy, so let's go ahead and implement a mechanic to dash and run away from him
01:17:55Let's create a new input
01:17:57How do we create a new input? Well, there are multiple ways, but really two main systems for creating input
01:18:03In this case, let's use the new enhanced input system
01:18:09Now, I call it new, but it has been out for already a year, so I don't know why I call it new, but I mean it's relatively new to Unreal Engine as a whole
01:18:15 Instead of the third person folder, we can open up the Input Actions and find all of our inputs
01:18:21So, we right-click, go to the Input section, and create a new Input Action
01:18:26We can name this "IA_Dash" and something like that
01:18:29Now, we don't need to go..
01:18:32Ahead and change anything about this input, we can just save and close
01:18:34Okay, now if we go back to the input, you can see that we have this IMC
01:18:41If we open this up, this is essentially a collection of all the inputs that the player can use
01:18:45So, this means that we could have a lot of inputs created over here, but the player couldn't use them because they're not in this collection
01:18:49So, let's add this new Dash input
01:18:54If we expand this, we can apply a key
01:18:58We can search here, for example, I don't know, the key you want to have—for example, the left mouse button, right? But an easier way is to click on this and then click the mouse or the key that you want to apply
01:19:12So, for example, the mouse button, and that's just an easy way
01:19:14So, there we go
01:19:16The input is configured, but we need to implement the logic, so we open up the Third Person Character blueprint and go to the Event Graph right over here
01:19:24We can just right-click and do "Input Action Dash" and select the first one, which is the one with the arrow, "Enhanced Action Events." Now, if we expand this, we can add the logic for when we start pressing the key
01:19:35So, what do we want? Well, we want to use the same functionality as we did with the Enemy AI, which is the dash
01:19:42So, if we go to the Enemy AI, we can essentially just copy these nodes, which is the whole formula, and the character then launches itself
01:19:48We just paste it in, connect it on the "Input Action Dash" event, and it will trigger whenever you hold the key down
01:20:00Then, we just want to..
01:20:04Kind of, uh, delete these variables and I don't know, put the values which are 50 and 500
01:20:09So, in here, it will be float A50, and then 500, or sorry, 200
01:20:14And that's it
01:20:16Okay, so let's realign with Q
01:20:20Okay, and there we go, boom, and that's it
01:20:27So now, when I go ahead and press the left mouse button, I go ahead and do this, and I can actually fly if I spam it
01:20:39 So, we need to do one thing, which is to only do this every so often
01:20:45How can we do this? Well, we could do the Boolean that we added for the enemy AI and time it, but an easier way is to add a "DoOnce" node, and this node will only allow a certain flow of code to happen if this gate is open
01:20:59What we can do is simply add a delay over here and say, okay, after 2 seconds, we're going to reset this node
01:21:06The AI, sorry, the AI not the player, can go ahead and dash again
01:21:11Now, as you can see, I cannot spam it—I can spam it, but less often, you know
01:21:19So maybe we simply need to increase this to like eight seconds, something like that
01:21:22Yeah, that's better
01:21:25As you can see, I can attach only every so often, which is way better
01:21:29Now, still, this doesn't look very good, first of all because we need to apply a more powerful effect
01:21:33So let's do that
01:21:38But then also, the animation doesn't look very good, so let's see what we can do to improve it
01:21:42All right, so we can do this by importing an animation
01:21:50So let's go up into the Window menu and click on Fabric, and simply go ahead and search for Infinity Rogue
01:21:53Then you will find this Infinity Rogue Animations
01:21:55If you don't find it, just make sure that
01:21:58You filter by free, click on Add to PR, and then select the closest version, which will be 5.3
01:22:09Add to PR, and after a few seconds, we should have it installed
01:22:13There we go, and we have this demo and Animations folder
01:22:15In this case, we want the Root Motion one, and we have some cool ones
01:22:22For example, this flip, and we have this flip, okay? So, this is the one that we want: okay, so this is the RM Forward Flip
01:22:29 We want to use Root Motion because this will move the character in the 3D space rather than using our Launch Character mode
01:22:41So, we can right-click on this, click on Animations, set it to the Villager, and then find the flip
01:22:48It's going to be RM Fore Flip
01:22:51There you go
01:22:53You can see it looks so cool
01:22:56On Explore animation, and then simply go to Characters, Villagers, Animations, and then just there, actually in Attack, and export
01:23:07Export and boom, close this window, and that's it
01:23:14It's looking pretty, pretty cool, as you can see
01:23:17So let's make sure to right-click and create an Animation Montage so we can play from, you know, any blueprint
01:23:27Now, we go back to the third-person character blueprint, we can go ahead and make sure to disable the Launch Character, and simply do a Play Montage, which is going to be this first one
01:23:40Then, simply, the mesh will be this one, and the Montage to play will be the flip
01:23:47We can just plug this into here, okay? And instead of doing a whole delay and that stuff, we can go ahead and just, first of all, break
01:23:56And get all these notes and put them here
01:23:59There we go, and then simply reset this once it's completed
01:24:01So basically, once the animation finishes executing, we can do it again
01:24:09Now, when I press play and I press the left mouse button, boom, the character ragdolls, but he doesn't go forward
01:24:20Why is the motion not working? Well, that's simply because we need to enable the root motion manually
01:24:27So let's go to the character folder, Villager Animations, Attack, and then in the original animation sequence—so not in the Montage, but the original one—in the Asset Details
01:24:38If we scroll down, we can enable root motion
01:24:40And now, yes, boom, he performs a back flip, which is pretty cool
01:24:45Now, this isn't such a big flip, right? So, what can we do to make it more impressive? Move him a bit further away
01:24:53Well, let's open up the animation, and right over here, let's scroll down and disable Enable Room Motion but enable Force Root Lock
01:25:05That way, now the animation will stay in position, and if we go back to the third-person character, what we can do is delete this node here and put this back in position
01:25:14That's why I didn't delete it completely, because we still need to do the movement through the Launch Character, right? Because the Room Motion isn't set to be exactly as we want, right? So now, as you can see, boom, we have this working like that
01:25:31Now, the thing is, it's doing a bit too much, in my opinion, so maybe 850 is a bit better, and maybe it's a bit too high, but you can play with that
01:25:42Now, yes, the character lands
01:25:45Again, when we do this, in here we are going to simply create a new Boolean, which will be like a dodging question mark, and then simply over here, let's set this to true
01:25:57Then, on complete, we can set this to false
01:26:00So, we can just move this to be on here, and then it goes here
01:26:07Okay, there we go
01:26:13So, we set it to false
01:26:18Then, in the animation blueprint, which is in the Character's Villager Animations folder here, we can go to Locomotion and look at the jump section or land or any of these
01:26:24All these transitions, and just check if we are not falling
01:26:31So, the jump and land are set to check if we are falling and if we are not dodging
01:26:40When you see it, you can also go ahead and get the character movement once again and say "Get"
01:26:46Dodging and simply promote this to a variable, which is dodging with a lowercase d
01:26:51Plug this here now
01:26:56Back in the state, we can get dodging and add a boolean
01:27:01Okay, now we need to go ahead and do the exact same thing, so copy the three notes on this other state, okay, which is landing
01:27:10So we are not on the air anymore, and we are not dodging
01:27:18Now, as you can see, it works, but the character does not go forward because I forgot to plug this here
01:27:30And now, yes, as you can see, we fixed that issue we're having with the transitions, and everything is perfect, and it's pretty, pretty cool
01:27:39Maybe I actually want to put this at a bit of force
01:27:42Yeah, this looks pretty, pretty cool
01:27:45That's pretty cool
01:27:47Now, maybe we want to actually wait a bit on our flip to start
01:27:50Making the flip, so maybe right when we jump, let's add a montage notify here
01:27:58Then, back over here, we can switch this to be on the notify begin, so he will start to flip actually when he needs to flip
01:28:07And it’s just working just fine, which is super cool
01:28:10So, we could go here and say, hey, and we dodge
01:28:15That’s super cool, right? We also don’t need this folder anymore, so let’s go ahead and delete it, as we did with the other animation pack, simply so that we can keep our project clean and avoid having unused files just lying around
01:28:31It’s just way better
01:28:33If we import it again later on, then we won’t have it cluttering the project
01:28:36All right, so now it’s time to add some sounds to spice up the experience
01:28:46In the content browser, let's right-click and create a new folder, which we will name "Audio." Right over here, let's go ahead and import some of the sounds that I will leave in the ZIP file
01:28:58Simply drag them, and boom, we have them over here
01:29:00Let's begin with the footsteps
01:29:02Right now, we have a simple footstep sound, but it's basically very repetitive
01:29:04What we can do is simply change the pitch slightly each time we play it, so it sounds like we have multiple variations of this sound
01:29:13Right-click, go to Audio, and create a MetaSound Source
01:29:18Let's name this "MS_Footstep." Open this up, and right over here, let's drag and drop a Play Wave Player, set to 1.0, mono, and then we can simply connect the footstep output
01:29:28Finished, and that's it
01:29:37It plays every time, but of course, we want to go ahead and make sure that it will play slightly randomly each time so we can get a random pitch and a random float
01:29:47Simply connect this here, connect this here, and then set the minimum to minus three and the maximum to three
01:29:53Now we save and press play; each time, it’s a bit different
01:29:58If you notice, let's go ahead and add this into the walk animation
01:30:03So, let's open up the Character's Villager Animations and walk animation
01:30:05Over here, as you can see, we have a track for notifies, so yes, we can add notifies for sounds
01:30:13Let's find the first footstep, which is around here
01:30:17Right-click, add notify, play sound, and select this in the details
01:30:19You can search for "Footstep" to find the next one around here, click Ctrl+V, boom, and that's it
01:30:27We have our walk animations, which is pretty cool
01:30:32Now, I also want to go ahead and accelerate the walk animation a bit; I think that 1.5x will be a bit better
01:30:41Oh, this is definitely better
01:30:49As you can see, I don't know, it just matches a bit better, the velocity and also the walking speeds
01:30:57Now let's make sure that the sound of footsteps is set to 3D because right now it's playing in 2D, so for example, for our enemy, we would hear it like in 2D, which doesn't look very good
01:31:11So, in audio, we can right-click and create an audio attenuation for our character, and here we can essentially define how far away we want to be able to hear
01:31:17Sounds and what's the minimum, you know, range and so on
01:31:25It basically just converts the sounds into 3D
01:31:29So for the minimum, let's put 200, sorry, 2000, and for the maximum, let's put 3000
01:31:34Okay, and with that done, we can save, close, and in our first step, we can click on Source, scroll down, and in Automation, we get to put a character
01:31:44Okay, now the sounds will be playing in 3D, which is really cool
01:31:46Now, let's do the same thing for our, you know, axe hit, push, and so on
01:31:51So let's duplicate the MetaSound and change this to be the axe hit, and simply change the wave asset to be the axe hit, and it will change the pitch every time
01:32:02Let's duplicate this, and this will be the axe hit
01:32:08Open this up and simply put in here the axe hit, which is great
01:32:16Volume, one, two
01:32:25Yeah, a bit better
01:32:33Also, make sure that we have the soundation for both of the axe hits, okay? So, with that said, we need to open up the enemy blueprint with Ctrl + E, and then over here, we can simply find where we start to play the attack, which is over here
01:32:42So, right after we set "Can Attack," we can say, "Okay, play S and at location." So, it's spawn in 3D, and we can say, "Okay, MS Core X," and when we start playing the animation, make sure to select the MS1, which is the one with the pitch—you know, with the random pitch
01:32:57Now, for the location, this will be "Get Actor Location," and that's it
01:33:02Now, just copy this node and paste it right after we launch the character, and change it to be the MSX Hit, okay? So, we'll play the hit, and now you can see it's perfect; it's super cool, right? Really, what we need to do now is add some cool particle effects to spice things up and just make everything look a bit nicer
01:33:29All right, so now it is time to add an effect when the enemy hits us and also when we go ahead and dash
01:33:37So, let's go up into Window, click on it, and right over here, let's click on the category settings and select VFX
01:33:43Then, let's go into the Preview section, open this up, and change it to free
01:33:48Now, as you can see, we have a whole bunch of them, but today we're going to be selecting this one, which is the Realistic VFX Pack Volume 2
01:34:00Simply go ahead and select the free license, which is personal, and add this to the project
01:34:04After a few seconds, we should have the pack imported
01:34:07There we go
01:34:10So now, here in Particles, we have a whole bunch of choices
01:34:12Different C categories now, we have some hits over here, so we can go ahead and expand this
01:34:19For example, leather is a pretty cool one, we have ice, we have asphalt, we have brick
01:34:23Yeah, now we have a whole bunch of them
01:34:25In this case, we need to find one that works for us, and remember that we are making a stylized game
01:34:34Okay, so in this case, I think that wood might work, and leather
01:34:36Okay, so let's start with wood and leather
01:34:40And of course, we also have blood, which is really, really cool, but in this game, it wouldn't fit
01:34:44Right, our game
01:34:47So, let's go ahead and just stick with our hits
01:34:51Let's go and open up the enemy AI with Control + E, and let's go into the hit
01:34:59You remember that we had the chase player, where they play montage, the spear trace, and as soon as..
01:35:04We hit the player, we launch the character, and play a sound
01:35:09Well, what we can add over here is that on top of this, we can spawn that effect
01:35:14So, if we go ahead and drag from here, we can say spawn emitter from location
01:35:18Now, there's also the spawn system at location as I mentioned, but this one uses Niagara, which is the new system in Unreal Engine
01:35:28This particle pack uses Cascade, which is the old version, and Unreal now
01:35:36This isn't a big issue; we can simply use this node
01:35:42So, we can use them, and for the first game you're going to make, this will be more than enough
01:35:48Okay, so with that said, let's go ahead and select the hit, and in this case, let's begin with the leather
01:35:55Let's go ahead and plug in the location, and in this..
01:35:56As you can see from the hit result, we have a whole bunch of values, including an impact point
01:36:05Let's go ahead and drag this to our location, and then for our location, what we can do is get the direction of the surface
01:36:10Now, how can we do this? Well, what we can do is get the normal and simply make a rotation from X, this way we're getting the normal of the mesh and the X, which is the front view
01:36:26We're simply going ahead and always applying it to the surface
01:36:33Then, leave out destroy and put out release
01:36:36Now, when the enemy hits us, respawn a little effect
01:36:42 It's super small, so let's make this like three, and it's pretty much like smoke at this point
01:36:47As you can see, it's pretty cool, this effect
01:36:54Better, maybe too big, but on top of that, we could also go ahead and play around with other hits
01:37:05We also were talking about the wood, so if we put this one on, you can see it's a bit different, and I think this actually looks way better
01:37:12So maybe let's set this to 1.5, and this actually looks like he's taking our kind of shirt away, right? Almost as if this was the leather
01:37:24I think it's literally perfect
01:37:26So, on top of this, let's go ahead and make sure that we add some camera shake
01:37:32Okay, so for the camera shake, what we can do is go into the Content Browser and open up the Blueprints folder
01:37:40Right over here, let's right-click and create a new Blueprint class
01:37:45Here, let's click on All Classes, and yes, we can go ahead and have more classes to choose from
01:37:49Again, think of this as presets so it's easier for you to understand
01:37:53Now, there's one for our camera shake, so let's type "Camera Shake." Scroll down, and we can see this Legacy Camera Shake
01:38:01This is the simplest version of all, so let's select this and name this BP_UnrealCameraShake
01:38:05Then, this will be like the hit
01:38:08Open this up, and we have all these options in the Details panel
01:38:13Make sure that "Class Default" is selected
01:38:15We do not need to apply any code into this blueprint class; this is simply the parameters that we need to change
01:38:26So, for the duration, let's put in 0.15, so it's nice and quick
01:38:30Then, let's go ahead and expand the rotation because we want to rotate the camera and shake it in, you know, different
01:38:37Right, but don't move it really, so it's going to be better to adjust the rotation
01:38:45Let's expand all the different axes, which are X, Y, and Z, and all this stuff
01:38:50Let's play around with the amplitude and frequency, so let's go ahead and set them to around 10 and 50, 10, 50, 10, and 50
01:38:55Finally, for the initial offset for the wave, let's set this to zero because it simply looks better if the starting offset is centered
01:39:01Okay, just it looks a bit better this way
01:39:10Now that we have the camera shake customized, we can go back to the enemy AI
01:39:14After applying all the damage, we can also add the camera shake
01:39:20We can say "Play Camera Shake," and we have this node, which is "Play World Camera Shake," and here we can simply proceed
01:39:26Select the BP Camera Shake Unreal Engine created, and then for the Impact Center, we can simply drag the same impact point that we had for our effect
01:39:35There we go
01:39:37Just make sure that this is the Impact Point
01:39:42As you can see, now the Inner Radius will be zero, but the Outer Radius, which is how far this camera shake will go, will be around 1,000 to ensure it reaches our camera because it's third person and a bit farther away
01:39:59Now, if we press Play and go to our player, you can see that we have a cool camera shake
01:40:07Maybe that's too much; it depends on what you want
01:40:11We could reduce this to, say, five and five on the impact intensity, and leave the bottom axis at 10
01:40:17He missed there
01:40:19We go
01:40:21I think that's it
01:40:22Literally perfect, and of course you can customize those values as you want, including the duration
01:40:24That said, we have a cool little camera shake and hit effect, which is really nice
01:40:33Now let's go ahead and spice things up in terms of the dash
01:40:38Right now, we have this cool flip, but let's go ahead and add a little sound to make it look a bit better, as well as an effect, just like we did before
01:40:49First of all, let's go ahead and open the third person character
01:40:52So, go to the Third Person blueprint, the Third Person Character Blueprint, and on the Event Graph, let's go ahead and find our Dash key
01:40:58Once we press the key, as you might remember, we ensure this only happens once, then we play the animation montage, and we go ahead and launch the character forward
01:41:05And then, once the..
01:41:14Animation is complete
01:41:22We reset this to "Once" so we can go ahead and dash again, and this will avoid spamming, right? On top of that, we have this Boolean that, as soon as it's complete, will turn on, and as soon as this begins, it will turn, sorry, off and on, so that in the animation blueprint, we will not play our jump, falling, and all that state
01:41:30Right, so right after we launch the character, what we can do is drag from here and say "Spawn Emitter Attached." This time, that way, we can now go ahead and find our hit in this case, leather, because it's pretty much, as we saw just before, kind of like smoke
01:41:51And let's put the scale to be like 2.5, 2.5, and 2.5
01:41:55Let's keep "Auto Destroy" on true, put this to "Outer Release," and then we can go ahead and..
01:42:04Attach this to a component so that the dash smoke follows us
01:42:09Let's attach this to the mesh, and then we can leave everything at the default
01:42:15So, if we click compile, press play, and dash, we have this really cool smoke, which is amazing
01:42:25I think it's literally perfect
01:42:27 With that done, it is time to go ahead and add a sound
01:42:32So, once again, let's go inside the audio folder, and right over here, we can import the dash sound, which will be available in the zip file
01:42:44Just drag it in, and we have this
01:42:46 Let's go ahead and create another MetaSound, so each time we play it, it will be random, and it will just feel a bit better
01:42:53Let's duplicate one of the existing ones, for example, the X hit, and then rename this to be
01:43:01Open the dash and simply, on the Wave Player, change the sound to be the dash
01:43:05Now, when we play, the sound is a bit different
01:43:08Let's play around with the pitch, so let's set it to around -5 and -3, and see how that goes
01:43:16As you can see, it's more like, you know, dark, but if we set this to around 3 and 5, or positive numbers, it becomes quicker, which is better for us
01:43:29Let's make sure that in the swords, we have attenuation enabled so it will be in 3D
01:43:34For the volume, let's set it to around 3
01:43:40That's perfect
01:43:47Now, let's go ahead and close this, go back to the third-person character, and right here, after we spawn the effect, we can play a sound at the location once again, so it'll be in 3D
01:43:55Let's proceed
01:44:04Ahead, find our MSCore Dash, and for the location, let's go ahead and just simply get the actual location because we don't have any impact point or anything, right? Because this is not a trace; we are simply playing the dash from any point
01:44:13And now, as you can see, we have a really cool effect going on
01:44:16Now, we can go ahead and, of course, increase the difference in pitches a bit, so we can set it to, like, three or eight or something, right? So, there's more variation, and it looks a bit different
01:44:30On top of that, I'm going to go to the original Dash, and we have some properties, so overall you can also change the main pitch from here, if you want to do so
01:44:48But in this case, we have it set from MetaSounds, which will be better
01:44:51Because it's going to be very random each time, but just so you know, we can also change stuff on the original Wave asset in terms of volume, pitch, and all that stuff, like the default sound itself
01:44:56Cool
01:45:01So with that said, we have everything good to go
01:45:06And for the last gameplay element that we are going to add before diving into our map, let's go ahead and add some little coins that we need to collect
01:45:17In terms of gameplay, these guys will be guarding some coins that we need to collect
01:45:22So we need to go ahead, quickly collect the coin, and dash out before he hits us
01:45:28Otherwise, he will push us away from the coin
01:45:30So let's go ahead and open up our Blueprint folder, right-click, and create a new Blueprint class
01:45:36Create an actor because this will simply be in the world and it will not move or anything like that
01:45:46Name this "BP_Coin" and open this up
01:45:48All right, so now over here, let's go ahead and make sure that we have a 3D model
01:45:53Now, we will import a cool coin in a second, but just so that we can start working on the coin before we have the model, let's simply add an empty static mesh with a cube or something like that, or even a sphere
01:46:10So, under Components, we can add a Static Mesh or directly a Sphere, whatever you prefer
01:46:14In this case, let's select Static Mesh and just rename this to "Mesh." Now, in the Details panel, let's select Sphere, and let's put in—I mean, we have, for example, this one, which is pretty cool
01:46:27Let's go ahead and change the scale with a lock
01:46:30On to around 3, so it gets a bit smaller
01:46:33Compile, save, and boom
01:46:37So now, if we drag this sphere, as you can see, we have it in the world
01:46:40Now, it's a bit too small actually, so let's go ahead and make this maybe 8 in size, compile
01:46:44Yeah, that's actually way better
01:46:47Now, let's make sure that this coin will spin while it's on the ground, so it looks a bit, you know, more fancy
01:46:51We can easily do this without any code at all
01:46:55We could easily make this with Blueprints, but there's an easier way to do so, which is by adding a simple component to this Blueprint
01:47:02So, if we go ahead and add this Rotating Movement Component, click Enter, and then make sure that the Rotation Rate has a value
01:47:10As you can see, this will rotate on the Z axis at 180°
01:47:14So, we compile and press Play
01:47:17Literally spinning on the Z axis, which is really cool
01:47:20Now it's going a bit too fast, so we can simply lower this value to around, I don't know, maybe 100
01:47:24Press Play
01:47:29There we go, that looks pretty, pretty cool
01:47:33Now I just noticed the footsteps are slightly too loud, so let's go ahead and open up the MS Footsteps and, on volume, we can set this to around 7 or 8
01:47:46Yeah, now it's just a bit better, you know
01:47:49Anyway, so we have a cool cube which is spinning
01:47:52Don't worry, we'll replace the model in a second, but now it's time to be able to go ahead and pick it up
01:48:01So, how do we go ahead and detect if we can pick it up? Well, let's go ahead and add a radius which will act as a trigger
01:48:08And once we enter this trigger, so when the player enters, we will go ahead and just add this
01:48:13Into the player, so to do this, let's go ahead and add a new component and search for Collision, then find the Sphere Collision
01:48:16Let's go ahead and rename this to Trigger
01:48:19As you can see, it's here
01:48:22To make it bigger, we can go to the Details panel, and on Sphere Radius, we can increase this to around, I don't know, 110
01:48:31Now we have this radius
01:48:34If we scroll down into the Collision settings, you can see that we have Overlap of Dynamic
01:48:38This means that it will not block the player from going in, but Overlap will simply detect what's going in and out, which will be perfect to add, you know, as a trigger
01:48:51So, we scroll down and can see the Events, and you can see that we have OnComponentBeginOverlap
01:48:56This is simply when something..
01:48:58Enter this on this trigger, so let's add this event
01:49:00When something enters this trigger, we want to check if it's the player
01:49:05Because imagine the enemy entered — we don't want the enemy to pick up the coin
01:49:09So let's go ahead and simply check if it's the player
01:49:14How can we do this? Well, there are multiple ways, but the easiest way is to add a tag
01:49:20So go ahead and open the third-person blueprint, go to Class Defaults, search for "Tag," and under Actor Tag, we can simply add "Player." Compile, save, close, and now we can easily check if this actor that entered has the "Player" tag — a super easy way to make sure that the actor entering is the one we want to interact with
01:49:40So, we can now add a branch with an "If." Statement, and only continue with this now
01:49:48Make sure that you spell this exactly the same as you did in the actor, okay? If it has any space or whatever, it will not work
01:49:59So, with that said, we're going to simply go ahead and add this into the player and remove it from the world
01:50:05First of all, let's go ahead and play a sound at a location
01:50:07As you can see, we have a bunch of presets
01:50:10If you don't see this, click on this icon over here and make sure that you have "Show Engine Content" and "Show Plugin Content" enabled
01:50:20Now, as you can see, we have access to a bunch of sounds
01:50:22In this case, the dockable window drop is pretty cool
01:50:26The dockable window open is pretty cool, and the pickup is pretty cool
01:50:31Let's go ahead and select the pickup, then set the location
01:50:40Make sure that we say "Get Actor Location," and to make sure that this is in 3D, we're going to expand this and set the, you know, attenuation to be "Character," as you might remember
01:50:49Then, right after this, we want to go ahead and destroy this actor, so "Self," right? Because it's going to be the coin
01:50:58And now, when I go to this here, we have a playable sound, and the coin is destroyed, as you can see
01:51:04So, on top of this, we might want to play a little effect, so we go to the "Realistic Effects" and go to "Particles." We have a whole bunch of them, so we have, like, "Sparks" too, which is kind of cool
01:51:16And I mean, some of these could work, but many of these are kind of looping, too, right? That's actually cool
01:51:24Okay, this is probably the best one, the "Sparks" one
01:51:27Okay, I mean, we have this one
01:51:29Which is pretty cool, but right now the Sparks is the one that I like the most
01:51:37Now, there are a few others; we could literally get an explosion or, you know, we could get some smoke, which is looking a bit broken right now, probably because I'm running Unreal Engine 5 on five, but anyway, so let's go ahead and add the Sparks
01:51:57So, select this, go back to here, and we need to do this before we destroy the actor because if we destroy the coin, well, it doesn't exist anymore, so it cannot execute any more logic, right? Makes sense
01:52:10So, let's go ahead and say Spawn Emitter at Location, and this will be the Sparks
01:52:12A good trick that we can do is make sure that we have selected the Sparks that we want and click on this drop icon, then for the location, it will be the GetActor location or a similar node
01:52:27Location and then auto-release, and now we can put this to around two, so it's a bit bigger
01:52:31Pick this up, okay? So I see what's going on
01:52:34So, this first is in the loop, and it had some delay, so these particles will not work as well as they could
01:52:46Now, we have a whole bunch of different ones, so let's see which one works best
01:52:51Okay, so this destruction metal is actually pretty cool, so it's under Destruction, and then Destruction Meshes
01:52:56Like this, swap this, and this will work way better because it spawns immediately, and there you go
01:53:01Wow, that actually looks pretty cool, I'm not going to lie
01:53:06What's up, man? Yeah, but I love the hit effect; it really ended up looking insane
01:53:11All right, there we go
01:53:14So, let's make sure that this is an actual coin
01:53:17So, once again, go to..
01:53:20Window Fab, and let's go ahead and make sure to select and search for Coin
01:53:24The price is going to be free, and we have a whole bunch of them
01:53:30In this case, this one looks pretty cool because it's stylized
01:53:33Simply drag this into the world, and boom, we have this over here
01:53:39Let's make sure that this shines
01:53:43To do this, we can double click on the material instance, and if we expand Emissive, we can add an emissive color
01:53:53If we set this to something like yellow and save, as you can see, now it glows
01:53:58Now, it doesn't glow too much; we want it to glow even more
01:54:05So, to do this, let's double click on the parent, and we have this
01:54:12Double click on this again, and we have—now, where is this crazy material coming from? Oh my God
01:54:16Well, if we go..
01:54:21To search, as you can see, it's an engine plugin, so that means that we don't really want to modify this over here
01:54:26So, the best option is to create our own material to make sure everything is just easy
01:54:33Right-click, select New Material, name it M_Core_Coin, open this up, and on the Base Color, simply put in a gold color like this
01:54:39Then, hold the three key on your keyboard and press the left mouse button, and do the same over here
01:54:48Simply multiply this pin with a number, and this will be the light intensity
01:54:51Let's set it to five, then plug this into Emissive Color, and also connect it to the Base Color
01:55:02As you can see, this shines quite a lot
01:55:04So, if I go to the coin and swap the coin material to the M_Coin that I just created, as you can see, it's more shiny
01:55:13which looks pretty cool, and we can even put the roughness to be like 0.2, so it will even shine just a bit
01:55:22All right, so with that said, let's delete this coin from the level and open up the coin blueprint
01:55:26So, select this controller viewport, select the mesh, and here let's search for coin and select the coin
01:55:34Then, make sure this is a bit bigger, so 1.5 perhaps, with a lock on, and there we go
01:55:39As you can see, it spins and everything like that, which is really cool
01:55:47Wow, amazing! Right now, we can pick up coins, but of course, we can't go ahead and see how many coins we have collected
01:55:53So, it is time to go ahead and create a UI
01:55:59In the Content Browser, let's right-click and create a new folder called UI, then open this up
01:56:05In this new folder, let's right-click
01:56:07Click, scroll down until we see the User Interface section and create a Widget Blueprint
01:56:12Select User Widget, which is the simpler class, and then call this WB for Widget Blueprint
01:56:17Open this up, so in this widget, we can add images, text, icons, UI elements, and whatever you want
01:56:25The first thing that we need to add to the blueprint is the Canvas Panel, so search for Canvas, drag this into the hierarchy over here
01:56:39As you might remember, the hierarchy is a list of all the actors in the level and in the widget, it's just kind of components, right? Or whatever icons and images you have, and the widget is simply like a huge library of things that you can drag into
01:56:56For example, I could drag a progress bar or..
01:56:59Things like that, right? So, once we have our canvas, we can start to place things on our screen, and of course, this canvas represents our screen
01:57:08So, this is going to be super simple
01:57:10We're going to drag in some text onto the screen, for example, top left
01:57:14Or actually, let's do it on the top left
01:57:16Then we can simply resize this a bit
01:57:19So, let's go ahead and put this over here and maybe make this a bit bigger because it's a bit too small
01:57:27Under font, we can set this to be maybe like 25, 28, or even 30
01:57:30Yeah, 30 looks pretty cool
01:57:33Then we can simply change the color and opacity
01:57:35Change the color to be more bluish, and then, pretty much, just add, you know, yeah, this
01:57:43Like this, we can outline things like that, but it looks cool now
01:57:47So, let's make sure that when we press play, we see the UI
01:57:55To add a widget into our player, we need to go into the Third Person Character Blueprint, and we need to do this through code
01:58:07Basically, what we can do is go to Begin Play, which is when the game starts
01:58:08In this case, we don't have a Begin Play, so let's right-click, add a Begin Play node, and there we go
01:58:19So, when the game starts, what we can do is call this node to create a widget, and then we need to choose which widget it is going to be — the Coins widget that we created
01:58:27Now, this widget will be created, but we are not telling it to add it to the screen yet
01:58:35So, we can simply get the return value, which is an output, and essentially this is the widget
01:58:39We can then go ahead and say "Add to Viewport," and this will..
01:58:43Add it to the player screen, so if I press play, boom, you can see that we have the text block over there
01:58:46Now it's blocking; there we go
01:58:49It was blocking this widget, but now it's here
01:58:52Now, make sure that on the widget, the anchors are on this top left part of the screen; otherwise, it would just position it incorrectly
01:58:59 Now, we are actually going to go ahead and change this to be at the top right, so that this icon, when I press play, doesn't appear
01:59:13Okay, this is up to you, but I'm going to simply click on anchors, put this on the top right, set the position Y and X to zero, and then set the position X to one—actually, sorry, to one
01:59:18Sorry, the alignment—sorry, to one
01:59:22There we go
01:59:27 Then, we can also set this to minus one for X, so it's here, but I think minus five
01:59:33It will be pretty cool, and then 1.5, yes, pretty cool
01:59:41Then, we can scroll down and set the justification to "Center." Now, as you can see, it is centered over here
01:59:47Maybe we can adjust the alignment to be more like this, and we can add a text such as "Coins," like "10 coins." There we go, boom! We have 10 coins now
02:00:00That's still a bit small, so in the font settings, we can increase it to 50 and resize the text, and that's a bit better
02:00:06As you can see, we have 10 coins
02:00:17Now, of course, we need to update this text over here
02:00:20So, how can we do this? Well, we can go to the Third Person character blueprint, break the return value with Alt + right-click, promote this to a variable, and this will be the Coins widget
02:00:35So, we are saving the new widget into a variable
02:00:37Make sure to connect this into..
02:00:39Here, so we'll add it to the viewport
02:00:43Okay, so now that we have the new widget in a variable, we can access this widget at any time
02:00:49So, simply, let's right-click over here and create a new custom event and name this "Add Coin." Now, what we can do is get the Coins widget and access its text
02:00:59In order to access our text, we need to go and rename this to something like "Coins Text," and then make sure that it is set as "Is Variable" on the details panel
02:01:16That way, we can see it and access it as a variable from our side
02:01:21 So, now, on the Third Person character, I can drag from here and say "Get Text," and here we are, "Get Coins Text." Then, I can simply say "Set Text" and use this bottom function to apply whatever text I want
02:01:33So, what I can do is have a coins counter, so I..
02:01:37You can simply add a new variable named Coins
02:01:41This will be an integer, essentially just a regular number
02:01:44Then, I can get Coins and call this function, which is Add or Increment
02:01:51This will simply add one every time we collect a coin
02:01:54The text can then display the amount of coins I have
02:01:58Now, this works if I press Play
02:02:03Of course, by default, we have 10 because of the text, but if I pick this up, nothing happens
02:02:11Why? Well, this is because we need to make sure that we call this event, because right now, nothing is calling this event
02:02:19So, let's go ahead and open up our Coin with Ctrl+E
02:02:21Over here, what we can do is simply access the actor and do something with it
02:02:28Now, usually, you could go ahead
02:02:31And you say cast to Third Person Character, as we did with the Animation Blueprint, because, as you might remember, we don't know what this actor is like
02:02:39We know it's an actor but not what class it is, so we cannot access its properties
02:02:43I cannot go here and say Get Mesh because, you know, we don't know if this actor has a mesh
02:02:50If we say cast to Third Person Character, we are saying, "Okay, is this character," right? "That is entering the trigger, this class?" If so, we can now access all the things like Get Mesh or get the coins, and do things with them
02:03:00But this takes some memory because, well, we need to go ahead and allocate memory to them
02:03:08An easier way to do this, and well, not easier—actually, the easier way, but a better way to do this—so, memory
02:03:18A more efficient way is creating an interface, so if we go to the Blueprints folder, we can right-click, go to the Blueprint section, and create a Blueprint Interface
02:03:28Right over here, we can name this BP for Blueprint Interface, for example, "Score," and it's something like "Coins." If we open this up, we can go ahead and create a new function, so let's go ahead and rename this to "Add Coin." Now, leave everything as it is; if we compile and save, we don't need to add any code
02:03:39This simply uses added functions
02:03:50We can go to the Third Person Character, go to Class Settings, and in the Implemented Interfaces, we can search for our Coins Interface and add it
02:04:01Okay, so this means that I can delete this custom event and add the Interface event that I created
02:04:03Now, we have this event through this interface, and we didn't really change anything in the code
02:04:11So, this means that now I can go to the Coin blueprint and simply get the actor that entered, and I can say "Add Coin." And you can see, wow, it actually found the function that is in the player, but we are not casting
02:04:28So, how is this possible? Well, the thing is that interfaces do not require casting
02:04:32That's the beauty of them
02:04:37So, we can use this interface with whatever enemy we want, whatever player we want, and it will simply work
02:04:41It's just better for memory and more efficient
02:04:44So, this means that now, when I collect the coin, it turns into one because I have one coin
02:04:52So, we need to make sure to do two things: first of all, we need to go to the third..
02:04:59In the person C Blueprint, make sure that in the text it says "coins" at the end so we can use this by saying "Format Text" and then here typing "SCly" bracket, "Amount," and then closing bracket, space, and then "coins." That way, we are creating an input for the amount
02:05:14This will be this, and then we also need to go to the widget and set this to be zero by default
02:05:25Now, when I press play, we have zero coins
02:05:32When I go here, we have one coin, and the number also has the text "coins," and it looks really, really cool
02:05:41 So, one thing that we can do, of course, is spice things up with a linear slider, actually
02:05:46So, let's go ahead and put this to "Line 3" and set the color to be kind of like this
02:05:55Maybe even make the size a bit bigger, say, 180
02:05:57Yes, this looks pretty cool
02:05:59Well, maybe a bit too big, not going to lie
02:06:02Let's put in, yeah, and 50 was good
02:06:03You can play around with the—I have a 4K monitor, that's why—but you can play around with the size, you know
02:06:12But there we go
02:06:20We can go ahead and collect coins and everything like that
02:06:29Just before we jump into our map, let's go ahead and add a cool, you know, kind of hat to our character
02:06:34So, let's go up into the Window tab, and simply, let's search for "hat." Okay, let's set the price to free, and boom, we have this hat, which is really cool
02:06:43So, just drag this into the world, and we have a cool hat over here
02:06:45Right, so let's go ahead and create our material because it's kind of bugged in terms of transparency
02:06:58So, let's press Ctrl + Shift + S to save everything, right-click, and select "New Material." M core hat
02:07:04Open this up and simply drag this texture into here, and now we can simply drag this into the Base Color
02:07:10Then click on the graph and set the blend mode to be Masked, and the Alpha will be set to Opacity Mask
02:07:18That way, we have the alpha channels, and the hat will have the little holes, you know
02:07:27Then open up the mesh and change this to the new hat material, which is M_Hat, located under Fabric Hat Cavell
02:07:33There we go, now it looks insane
02:07:35Right there
02:07:38Now, let's also open up the texture and make it a bit more vibrant
02:07:41Scroll down, set the Brightness to 2 and Saturation to 1.5
02:07:46That makes it more like a cartoon style
02:07:49As you can see, this is really cool
02:07:52So, with that said, let's go ahead and add it into the..
02:07:56As you might remember, we do this with sockets
02:07:59So, for characters and villagers, open up the skeleton and let's find the head socket, as we want to attach the hat to the head
02:08:09Right-click on this, then add a new socket and rename this new socket to "hat." Now, to make it easier to move this socket around, right-click on this new "hat" socket and add a preview asset, then search for "hat." Boom, move this up, and I'll start to go ahead and move it around
02:08:23 Let's go ahead and rotate this around 90°, then 180°, and then simply start to play with the scale
02:08:31Maybe 2 could work; okay, that's a bit too big
02:08:34Maybe 1.5, 1.5, 1.5
02:08:38You might also start to rotate this a bit, like this
02:08:40Yeah, I kind of like this
02:08:43Okay, I think this looks pretty cool
02:08:46I can copy my positions, uh, maybe it's a bit more, yes
02:08:52All right, so you save, close, and when we press play, we don't have the hat, yes, because we still need to add the mesh
02:09:02Right now, this is a Saga, which has a previous setup, so it's easier to place
02:09:10Right, so we go to the third person character blueprint, go to viewport, we can select the mesh and add a new static mesh as a child
02:09:15Okay, this will be the hat
02:09:19And now we can simply find the hat over here
02:09:21Now, because this hat is a child of this mesh, which is our character, we can attach it to one of the parent sockets, which is the hat socket
02:09:27And that's it
02:09:34Make sure that the collision is set to no collision, and when we press play, boom, we have a really cool little hat over here
02:09:40And of course, our enemy AI doesn't have the hat, so it looks..
02:09:43Perfectly fine
02:09:46And now, yes, it is finally time to create our map and environment
02:09:49For this, we need to import some cool, you know, environment assets that we will use to build our own custom map
02:09:55So, let's go up into Window and open it up once again, and over here, let's search for "Stylized Flying City." Then, simply go ahead and filter the price to free, and we find this one over here, which includes some really cool assets, as you can see
02:10:11So, let's click on Add to Project, and then choose the compatible Unreal Engine version, which in this case is 4.27
02:10:22Don't worry, this will work just fine
02:10:25Okay, so he's click on Add to Project, and Unreal Engine will make sure that it's compatible with our version, which is 5.5
02:10:30Okay, and it's nearly there
02:10:35And boom, there we go
02:10:39We close this
02:10:43Now I have a new folder called Stylized Flying City with a lot of meshes and a map
02:10:48Now I'm going to quickly open the map so you can see how it looks, but of course we are not going to be using this map
02:10:59Okay, we are going to create our own, but just as you can see, it looks really, really cool
02:11:06I mean, this is even built in Unreal Engine 4, right, and an all version—not even Engine 5—so imagine how this will look with Lumen
02:11:13So, that said, it's time to go ahead and create a new level
02:11:15All right, to create a new map in Unreal Engine, we need to go up to File, then select New Level
02:11:21We have a couple of presets to choose from; in this case, let's select Empty Level
02:11:27Hit Create, and there we go, we have an empty level
02:11:32So, first of all, let's make sure that we have some Sky, a Directional Light, and some clouds
02:11:33We can do this easily by going up into Window and clicking on Environment Light Mixer, and now we can start to click all these buttons in this order, and boom, we have a beautiful Skylight
02:11:46There we go, in two seconds
02:11:49So let's go ahead and press Control + Shift + S to save everything, including the level
02:11:54Let's go to Content, scroll down until we see Third Person Maps, and then let's go ahead and just rename this to whatever map you want
02:12:04In this case, let me just call it Map
02:12:07There we go, so the level is now saved
02:12:12Now it is time to create a landscape
02:12:15So how do we create a landscape? Well, we go up into the Select mode and change this to Landscape mode, and now, as you can see, we have a preview of how this landscape would look in this
02:12:27Usually everything by default will work just fine, so let's go ahead and make sure that we have Enable Edit Layers enabled, the materials used are empty4 (which we will change a bit later), and then all this by default
02:12:39Now, hit Create and boom, we have a beautiful landscape to work with, which is really, really cool
02:12:45So, we go back to the selection mode and press Play
02:12:46We spawn with our player and can walk around, but let's make sure that we add a Player Start so our player begins in the correct place
02:12:56 To do this, we quickly add to the Player section, go into All, and if we hover over this list, we can search for Player Start by just typing, then drag this into the world
02:13:09After that, we can click on this icon to center it, rotate it 180°, move it up, and press End
02:13:13On your keyboard, snap the character to the ground, then move it a bit backwards, and that's it
02:13:19Now, make sure that the game mode is applied, because maybe for some of you, when you press Play, you don't have this character
02:13:26In the world settings of this level, simply go to Game Mode Override and select the Third Person Game Mode
02:13:33Save, then press Play, and boom, we're good to go
02:13:39 Now it's time to bring this world to life, because right now it's a bit empty
02:13:43So, it's finally time to start using some of the materials and meshes that come with a stylized pack
02:13:50For this world, we're going to keep it pretty simple, with a path and street, lots of houses, and some enemies over there guarding coins
02:13:57Create a path; there are many ways in Unreal Engine
02:14:01The first way is, so we just go ahead and find, for example, this ground mesh or this one, which is a bit longer, and then place this over here and start to duplicate it and slowly build a path
02:14:14Right, I mean, this will work; we have built a path in 2 seconds, but of course, it will take a bit, a bit of time
02:14:22So, there is an easier way to do this with splines, and it's built in with Unreal Engine's Land Tools
02:14:31So, we go up into section mode; we can change this to landscape mode, and then what we can do is go to Manage and create a new layer
02:14:38Our landscapes will be always organized in different layers, but if we go ahead and add a new layer, we can specify what type of layer
02:14:47In this case, we want a layer of splines
02:14:51Select splines, select
02:14:54And boom, we have created a new layer, as you can see, and the spline tool is automatically selected
02:14:58So now, if we go into our world, hover over our world, hold left control, and left click—boom, we have the first point
02:15:05I can go to the next point, hold left control, and click—boom, I start creating my world
02:15:10As you can see, now it's basically just a matter of clicking more with left control and simply creating a cool world
02:15:22If I move this up, as you can see, the environment will add into it, which is quite cool
02:15:27As you can see, this is quite amazing, and there we go
02:15:33So, slowly, we go ahead and build our world
02:15:36Of course, right now, this path is invisible when I press play because we don't have any meshes attached; this is only a preview
02:15:54So, click on segments on this
02:15:56Button, and this will automatically detect and select all of the paths
02:16:01What we can do is, in the Details panel, scroll down until we see Spline Meshes
02:16:06We can then add a new mesh to spawn along this spline
02:16:10So, if we go to our Stylized Fly CD Meshes and scroll down until we see this Ground 01, if we drag it in, boom, as you can see, the pad starts to build
02:16:15But there's a problem
02:16:20Okay, we're having this kind of interconnection issue every so often
02:16:26Why is that? Well, this is simply because our mesh has borders
02:16:30So, what we need to do is make sure to remove this border so it will merge perfectly
02:16:38So, how do we do this? Let's go back to the selection mode, save everything, and drag this Ground 01 into the world
02:16:47And now, what we..
02:16:50What I can do is go up into the selection mode and select the modeling mode
02:16:56Yes, in Unreal, we can also have a mini Blender where we can essentially edit models, which is really cool
02:17:03As you can see, we have multiple tools here, but the one that we are looking for is the plain cut tool
02:17:08Select this, and everything disappears
02:17:10So, let's go ahead and hover over the green kind of circle and rotate this 90°
02:17:15Okay, you can see it there
02:17:17Simply move this to one of the edges, just over here, and make sure to cut right on the corner where the edge starts to appear
02:17:27We just finish it by clicking accept, and that's it
02:17:30Let's do it one more time for this part: click on the plain cut tool, then rotate it
02:17:37Through the other way, so this time it will be minus 90°, then move it
02:17:49Oh, sorry, we need to do it again like this
02:17:56There we go
02:17:59So, actually, now it will be +90°
02:18:01There we go, instead of -90°
02:18:03So, it's the other side, right? And we go ahead, make sure to start right here
02:18:05Okay, so we click on accept, and then we go
02:18:10We have a path, which is essentially all together, and boom
02:18:16As you can see, this fixed the road; it's essentially merging perfectly
02:18:18So, we can go ahead and delete this
02:18:20Ctrl + Shift + S, go back to our landscape mode, and click on segments because we need to do a little change, which is on the spline meshes, to disable "scale with width." That way, the path will be more narrow, and when we press play, it will fit better with the character's scale and look better
02:18:38In a stylized way, so with that done, it is time to go ahead and, you know, spice things up, for example, with a little landscape material
02:18:49So, let's go ahead and select the landscape, then scroll down, and on the material, let's search for Generic4 and select this
02:18:55Now, as you can see, the material is very small and is repeating the texture all over again, so the tiling is very bad
02:19:03It looks like a grid
02:19:06So, double-click to open this up, and let's right-click and add a Texture Coordinate, okay? Then, simply plug this to all the UVs
02:19:16With this now selected, set the tiling value to 3 on both parameters
02:19:21Now, as you can see, it's way bigger and looks nicer
02:19:25So, with that done, it is time to go ahead and make sure that we… Starting to add some of the houses, so there are a few ways that we can do this, but the best way is to manually place them for this little path
02:19:49So, let's go and open up this Styx Flying City, open up meshes, and now we have a whole bunch of assets that we can choose from
02:19:55In this case, we have houses, which are going to be perfect
02:19:57So, what we can do is start around—I'm going to start actually here
02:20:01So, I'm going to move there, and I'm going to simply start dragging some houses
02:20:05For example, let's put in this house with this separation
02:20:08Let's go ahead and drag, for example, I don't know, this one
02:20:12You have A and B, which are kind of different, with a balcony, but I like this one
02:20:22Then, I’ll rotate this to orient it properly with the path
02:20:26Okay, we can maybe put this to five, a bit more
02:20:30There we go, better
02:20:32Uh, kind of this is good, I think
02:20:36Then we can drag, for example, this one and kind of place it over here with a bit of tilt so it looks more stylized, more kind of out of place
02:20:45Uh, we could drag, for example, this one and rotate it like this
02:20:48You know, we could get this huge thing and kind of put it over here
02:20:55There we go, and kind of build, you know, the road and the street
02:20:59Maybe we can join it a bit more, you know, because it will kind of fill more of the edges
02:21:08But as we start to build our path, which is pretty, pretty cool
02:21:14We can do the same with the other side of the road, so I can get this house, rotate it, put this around here, and then simply get this house, for example, or even..
02:21:30This one, but put it like this, and then get this one, and then this one, kind of the same process, you know, but with a bit of separation, you know
02:21:40So maybe, yeah, that's good
02:21:43Yeah, like it, like this
02:21:45And then we can put this one—oh, actually, these should be rotated, right? So yeah, so the door is here
02:22:02There we go
02:22:04Yeah, it's basically just repetition at this point, really
02:22:08For example, this one, and we start to have a cool camera as we can see
02:22:14Let's go ahead and also change up the first player start, move it up
02:22:25As you can see, it says bad size; it was colliding with the ground
02:22:33And then, if we press Ctrl+L, we can go ahead and move the object right
02:22:38So, in this case, we can bring it down or up
02:22:44I mean, it depends on what you're looking for
02:22:46Mouse, but I like how this looks right now, okay? And yeah, I mean, this is simply just continuing, pretty much just creating more of the path
02:22:53So, you know, for example, I can put this more here and start to duplicate all this, right? So I can simply start to, I don't know, get this one so that all of this can be selected with Shift held down, duplicated, and moved to here, then simply realigned with the road, and that's it
02:23:13You can spend as much time as you want on this level, just making something quick
02:23:19We can do the same on this side: select everything, hold down Shift, and move this around, then simply realign these houses
02:23:30We can also change this to the local world, right, so it's easier to move around
02:23:41But yeah, this process is pretty much just..
02:23:47Spending some time moving things around, and that's it
02:23:57You know, and then on here, we need to move them up because, of course, we have the hill
02:24:10Can we do like this? All right
02:24:14As you can see, we have a cool little city that we can walk around, and I mean, it's looking pretty, pretty cool
02:24:31We can maybe make this bit more like this
02:24:33Yeah, looks pretty cool, right? So, really, it's now also about going ahead and making sure that the lighting is correct and all this stuff, but there's one thing that I want to add, which is some grass over here to spice things up, right? So, on the window, click on Fab, and now we can go up into the search and search for Ribbon with two B's, and simply go ahead and click on Add to PR with a medium quote
02:24:59Boom, we have it in our PR
02:25:02There we go, so we can click on fish types, and these are the ones that we can paint
02:25:11So, if we go ahead and enter the foliar mode, we can select all of this and drag them to the ones that we want to paint
02:25:23We select all of these that are added into the collection, we can tick them, and then simply start to paint
02:25:30I'm going to go ahead and make sure to select the static meshes so I don't paint on top of the houses, and then I'm going to change the density to 200
02:25:39I'll also change the scaling to uniform, between 2 and 2.5
02:25:41Now, when I paint, we have this really cool grass, as you can see
02:25:45So, this is really painting on some of the edges
02:25:47It needs to be on all of them, but just in the places where there's more of a gap, you know
02:25:53So, kind of here, kind of here, really in between houses is what I would suggest
02:26:01The same with the other part over here
02:26:04Make sure that there's not inside of the houses
02:26:08Come here, come here, and then with Shift, you go ahead and remove the grass
02:26:14Okay, with left Shift
02:26:18So, it's kind of just playing around and adding and removing, adding and removing, you know
02:26:24Um, okay, I like this
02:26:28We go there
02:26:31We go
02:26:34Yeah, we're having a pretty cool world, as you can see, with grass
02:26:40This one is hopping in, so we can decrease this, and boom, Shift
02:26:44There we go
02:26:47Yeah, I mean, we could also paint some of them over here
02:26:51It looks pretty cool, but I prefer to keep it more clean and more like a desert with sand
02:27:04Um, so maybe we can add just a bit, you know, in some cases like this here, just a bit
02:27:12I don't know, just, uh, here, just a bit, you know, here, just a bit, and just, uh, go ahead and balance out the grass
02:27:19Now, let's go ahead and make sure that the grass is a bit more, you know, stylized
02:27:26So, what we can do is open up the texture
02:27:29Now, there are two textures; let's open up both of them, input this to be like two of brightness, and then set the saturation to 1.5
02:27:34Save and close
02:27:39And for the billboards, let's also do this, and that's it
02:27:42So, you can see they're more stylized
02:27:44It looks pretty cool
02:27:47Last but not least, let's go ahead and add in the visual effects, a post-processing volume
02:27:54As you can see, this is a box, so the post-processing will allow us to change some things such as color grading, exposure, and some cool lighting settings, but of course, it's a bit, um, hard
02:28:10To go ahead and expand this box to fill the whole level, so this is a cool thing to do, which is to search "Infinite" under the Data Table panel
02:28:19And it's, uh, enable Infinite
02:28:21Now, this will go ahead and expand and affect the whole world
02:28:26Um, and it doesn't need to be, you know, filled in with this box
02:28:29So, for exposure, we can go ahead and put in, like, minus 5 and 5
02:28:33Then, on color grading, in global, I can enable saturation, set this to 0.05, and then contrast to 1.05
02:28:41And now, we have some really cool, vibrant colors, as you can see, which is really, really great
02:28:47Now, maybe the character is too plasticky, as you can see, so this is a quick change that we can do
02:28:58So, we're going to go to the Character Villager Body, and in the roughness, we can multiply this by something as simple as 0.5
02:29:12That way, it will have half of the strength
02:29:14Actually, sorry, so roughness is the opposite; the more you have, the less rough it is, so it's less shiny
02:29:18Let's put in like, uh, times 1.5; that way, it’s the other effect, and it will make it less shiny
02:29:29There we go, it looks quite cool
02:29:32So, yeah, we have a really cool character over here, going on, and we can walk around in our beautiful world and just, uh, play our game
02:29:43Now, let's add one important thing to our level to spice things up, which is Horizon Fusion
02:29:46So, we select Horizon Fusion, go ahead and scroll down and enable Volumetric Horizon Fusion
02:29:50This is going to make things look ten times better
02:29:57Then I can set the Horizon Fusion density to one—that's too much, maybe a bit more
02:30:01And now, as you can see, this looks way nicer
02:30:06And it's pretty cool because we feel that the game is filled in now
02:30:10You can also play around with the lighting in the game by pressing F8, Ctrl + L, and then maybe changing the angle, and then go back to play mode to see if it's better
02:30:22You know, it's really up to you, but once you exit play mode, it goes back to normal
02:30:27Now it's time to go ahead and add our enemies in certain corners
02:30:28So, open up the Blueprint folder and find some good spots
02:30:34In this case, our character spawns over here, so maybe we want to have an enemy under this area, and we can place an enemy here with a coin just beside it
02:30:45There we go
02:30:48Of course, the enemy right now will not move because it doesn't have enough AI
02:30:53Remember, so we just need to go to the Volumes and..
02:30:57Add a name bounce volume, and this one doesn't have an infinite option like the post-processing, so we need to make sure that this is filled in and set this to be large
02:31:12Then press B, and we can see all the possible paths, which is actually perfect
02:31:15Now, when I press play and approach my enemy, he will see me and come toward me
02:31:21I can pick up the coin, and there we go, I have the coin
02:31:27This is so cool, and then we can continue on our journey
02:31:31You know, so let's add a bit more over here
02:31:34I'm going to select both, hold Alt to move them, and put in another one, like here
02:31:41Press Enter on my keyboard so they snap
02:31:47Then, I’ll put the coin a bit higher because I don't want the coin to be on the ground
02:31:51What I can do on top of this is get, for example, Um, this building and make sure that the city and the street kind of ends over here, you know, and then I can have like, uh, this yellow one here
02:32:07There we go
02:32:08It looks quite nice
02:32:10So, we have a cool game, guys
02:32:11I mean, we can go here, can dash, and that's it
02:32:17Guys, now you have completed your first game in Unreal Engine 5
02:32:24From here, you can go ahead and expand your game by adding new enemies, new weapons, expanding the map, and so on
02:32:42If you found this tutorial helpful, I would really appreciate it
02:32:52You can like the video and subscribe to my channel
02:32:53Join my huge Discord server with over 10,000 game developers to be involved in the best conversations
02:32:58And remember that you can download the complete project through Patreon or YouTube members
02:33:03The link is in the description
02:33:05Guys, and now yes, with all that said, bye-bye
02:33:06[Music]