Unreal Engine Beginner C++ Tutorial: Building Your First Game

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

How is this video? Is it good enough for someone that only knows standard c++?

👍︎︎ 2 👤︎︎ u/mlalssid 📅︎︎ Nov 19 2019 🗫︎ replies

Cool

👍︎︎ 1 👤︎︎ u/Rokken_Roll 📅︎︎ Nov 19 2019 🗫︎ replies

Good tutorial, very nice pacing, watched the whole thing

👍︎︎ 1 👤︎︎ u/KingOfTheEnd374 📅︎︎ Nov 20 2019 🗫︎ replies
Captions
hey what's up everyone mark here and I'm really excited about this video you're gonna build your very first Unreal Engine C++ game all from scratch so what we're gonna do is click this new project and Unreal Engine launcher C++ and then basic code literally from scratch and I'm going to change it to have starter content just in case we decide to use any of it and save this wherever you like and we'll call this first c plus plus game game lesson there we go I already have a file called this great project most exciting name ever I know okay here we are an unreal engine and if you had any errors or problems it might be because you have not installed Visual Studio yet that is a requirement for building C++ games and you need it for Unreal Engine anyway but make sure that you've got Visual Studio installed I'm using Visual Studio 2019 and I think it's better than 2017 it has some more efficient autocomplete features and things like that so I've opened up the Visual Studio you can see it right here your should have opened up automatically and again if it's not it's because you might not have it installed so this is not an installation video we're gonna move fast here so first cpp game lesson the name of our exciting game here and you'll notice that we've got an H file here and we've got a CPP file here these are our entry files same name of the game we also have a lesson dot build CS or FPS cpp game lesson build SCS and this is where you actually can specify some of the frameworks you're going to be using for instance if you want to access um G for user interface in C++ you would need to add it here inside of the range for modulus here and you can add other features here this dot CSV file is actually a c-sharp file which runs before things compile and launch and then you'll notice it came with the game mode base automatically for us and we'll use this later on as well but every game has a game mode or shouldn't have a game mode where you can specify rules and things like that our game will not be using that but here's what we get so far in our proc so I'm gonna go ahead and close all documents here and let's look at our project here and you're gonna notice that all we have is the starter content you know the chairs and things like that here so I'm going to right click not right click I'm going to go to file new level and we'll create a default level here like so command or ctrl s to save and we'll call this I'll call this main for main level we're literally doing this all from scratch here so what we want to do is create a simple first-person shooter type game so you can learn a little bit about the code meaningful code how to shoot rate casts in C++ and then how to tap into some of those things in blueprint this is not a C++ versus blueprint thing where we just only do C++ code because that's the really nerd hackery thing to do no we're gonna do it the way it should be done which is a symbiotic relationship between blueprints and C++ to make our lives much easier so what we're gonna do is go into our a project here excuse me our Unreal Engine I'm going to go to file and new C++ class you always want to create your C++ classes from Unreal Engine you can do it directly in Visual Studio but sometimes they're sinking issues and you may have to reload the project and what we're gonna do is create a class based off of the character class this is a pre-built class by Unreal Engine 4 the parent class of course this is object-oriented programming so when we talk about parents and children we're referring to concepts in object-oriented programming and we're gonna call this FPS character and create class ok it's done compiling and if we come into the visual studio you'll notice that it's opened up these files automatically in the header file it has the inheritance public a character that's unreal class and you'll notice a lot of unreal classes including your own if they're actors we'll start with the a because that's what the a represents it represents actor and we've got some other functions here that are available and if you're familiar with blueprint you would have seen things like begin play and tick now what we want to do is we want to build out a ray cast an invisible raid that emulates a bullet being shot and then we want to shoot a box or something like that okay we'll keep it really simple and so if you're new to C++ just know that the dot H file is the header file okay which makes the functions and properties public or available elsewhere in your application and you've got the CPP file which stands for C++ which represents your implementation of file where you actually write the code okay so we want to create a function here in our header class and we're gonna call this take instant shot look at like a bullet shot okay and so I'm gonna do this here in the protected area protected means that any subclasses are children I make off of this we'll be able to access this function so we're going to type in F hit result and we're gonna call this instant I'm gonna use a lower case actually instant shot like so just one thing to point out is you'll see me using camel casing for all my functions and properties whereas unreal uses uppercase letters for each of the words in here and C++ a lot of developers use this paradigm as well I do not because I spend a lot of time in many languages and every language pretty much does this for the most part except C++ so it keeps in my life much simpler by using camel casing here but you are welcome to use the uppercase letters if you like and so I'm gonna save this file here and what we're saying is we're creating a function here called instant shot and if I hover I'm gonna see this little drop down here with a fix and it says I can create a definition of instant shot in my implementation file so I'm gonna click that and then I'm going to command s to save and close out of this little drop down here it just created the implementation of that function for us over here in our implementation file as you can see right here I'm gonna command X to move this further down the file and paste it here command V the control V okay so this is our function it's returning a hit result which is the result of actually hitting something with array cast which will right here in a minute and right now we're just returning and under neither an empty hit result so let's go ahead and write up the function for this and we're gonna move along and I'm not expecting you to master all these things especially if you're new to programming but this is a good warm-up for you so I'm gonna create an F vector called camera location what we're gonna do is grab the location of the camera and it's rotation the main camera get its for direction and that's where we're gonna shoot the ray from just like a first-person shooter if I was shooting from the tip of a gun per se and not from the middle of the screen I would have to choose a different location like the tip of the gun and its rotation but in our case we want to shoot from the front of the camera so we're gonna say F rotator camera rotation so we're going to get its location and then we're going to use the rotation to figure out which way is forward and then what we want to do is basically grab the forward direction of the player and assigned some data into these variables so we can use them in just a minute you'll see what I mean here so we're gonna say a player controller okay we can grab the default player controller from anywhere in C++ here in Unreal Engine if we use actors and such this is gonna be a pointer and a constant we don't want it to be modified we're gonna call this player controller we're gonna say get world and then we'll say get first player controller like so now this is gonna grab the world class which is a global function it is actually available and you'll see an error here but it doesn't matter it's still gonna work now if you did want to get rid of that error okay you can come up over here again it's optional you don't have to it's just kind of annoying to look at and we can include engine slash world H and that will get rid of our little red squiggly there so similar to in blueprint where you say get player controller we're doing the exact same thing here okay we're grabbing that player controller so we can do something with it so let's do something with it let me create another variable actually we'll put it up here called F a vector and trace and the N trace is where we want the line trace to end this would be like your weapon range you know if I have a shotgun I wanted to go you know 500 you know feet or 50 feet and then stop or if it was a sniper rifle the bullet would go longer so I'll end a trace equals F vector and we're gonna say zero vector we'll initialize it to zero zero zero and if you're new to programming or game programming a vector in this case here is going to have an x and y in the z coordinate in 3d space okay cool let's just keep moving along and I'll explain as I go so we're gonna say if player controller so if this failed if it couldn't get the player controller this would be a null pointer and so this would fail and we would we don't want to actually do anything if it fails but if it succeeds now we can use the data from it so if it's valid if it's an actual player controller what do we want to do well we'll say player controller get player view point we're gonna pass in the camera location and the camera rotation so we're gonna get the viewpoint of the player okay the player controller and we're gonna pass in the location in the rotation over here into these variables okay and I say camera on here I guess I could have called these something different I could have just called this you know ray cast location and rotation rotation or start location start rotation that probably makes a little bit more sense in fact you know I could just do that right now we'll say we'll say Ray location and we'll say Ray rotate oh okay rotation like so and we're getting some weird unneeded help but whatever okay so ray location and ray rotation then we'll say ray location I think I have insert on here and Ray rotation like so cool and what's gonna happen is it's gonna update these variables here with the player viewpoint which is exactly what we need let's go ahead and sour and trace how far we want it to go I want you to think about this here how how do I create the end of my shot well if I'm a human being let's say holding a gun or even just looking I need to know which direction I'm facing and I need to know where I'm standing and then I need to add a distance to where I'm standing in the direction that I'm going so if I'm holding a gun forward and I want to go a thousand meters forward I need to add that thousand meters to the direction I'm facing and that's all we're doing here really simple actually so we're gonna say end trace equals Ray location plus we're gonna say ray rotation dot vector oops and then we want to multiply this by a weapon range which right now we'll say one thousand we're gonna turn this into a variable in just a second here so ray got ray rotation dot vector x weapon range that looks good to me there okay so what are we doing here the current location of where the player standing so that location starting location and then we're gonna take the starting rotation dot vector what we're saying here is the forward direction when we call dot vector on this rotation we're getting the forward direction of the rotation so if it's your body and you're looking forward that's the direction we're getting and then we simply multiply it by the weapon range of course we're good programmers and we don't want magic numbers so let's actually create a new variable and this variable we need it to be public and we want it to be editable in blueprints because if we're a game designer you know we want to test and quickly change the value of this variable so we can make sure our game is fun so what we're gonna do is we're gonna use a unreal property modifier here so we're gonna call this new property and we're gonna say edit anywhere which means it can be edited in the blueprints or in the world outline are actually an object in your game in your level and we can give it a category so when you're in your blueprint it shows up under a certain category and we're gonna call this we ran a character so let's call this weapon anything related to a weapon will call weapon and we'll say float weapon range and we'll give it a default value of about a thousand just for fun okay and the curly braces in C++ is one way to initialize a variable so we're initializing it with a thousand all right so now I can change this to weapon arrange like so and you're gonna see it squiggly on here that doesn't mean that we're broken it just means that we have a false error that happens a lot with visual studio and unreal II get false errors so we're grabbing the end trice now and now what we want to do is actually make the actual ray cast which we haven't done yet so in order to do that we've got to first create some parameters for it so we're gonna say f collision query params now this is something you don't really have to do this particular variable if you do it straight in blueprint but we have to do it here trace params and we're gonna say scene query stat like so and I'm gonna put in the name of our function here which is going to be instant shot and that looks good there and then the next variable is the be in trace complex we want that to be true actually it's default it's default value is false what this means is if you leave it as a simple trace it'll hit like your colliders your trigger colliders things like that but complex is actually going to touch the mesh itself which is really important especially if we want to like shoot off let's say someone's limb or we want an impact to have effect a geometry that's complex a tree branch whatever we want it to be true and actually use the the collisions on the meshes as well too so really that is true and then the instigator is what we're gonna put in this last parameter here instigator okay and so ignore actor what we don't want to have happen is we don't want our irate cast to accidentally shoot our actor let's say we have hand a mesh of hand and a gun we wouldn't want that rake has to accidentally hit our own character so which one do we want to ignore we want to ignore the instigator and we're grabbing that from the pawn class which is part of the character class which we've inherited over here a character so we're just saying hey we want to ignore ourselves don't accidentally shoot ourselves with the raycast that wouldn't be good so there's our params and then we need a new variable called F hit result we'll call it hit and then we're gonna say force in it that's a default value it's just going to if you hover over this it'll set a default value of zero basically we're gonna set a hit result that's zero it's nothing unless something actually hits okay and then what we'll do is we'll say get world do our little arrow here if you do the dot it'll actually switch it to the arrow for you automatically but we'll say line trace single by Channel and I'll explain this in just a moment here we'll say hit and then we'll say the array location so where's the starting location where is the end location that would be our end trace and what channel do we want to hit on in our case we're you know you can create your own custom channels but in our case we want to hit the everything channel we're not gonna block anything let's just keep it really open so ECC underscore visibility channel basically anything that's visible we want the chance to hit that's all we're saying here and then lastly let's pass in those params again you don't have to pass the params in a blueprint but we do here in C++ and so we're passing in these values here which we're not really doing anything too much with the most important thing here is we want to ignore ourselves and we want it to be complex you know in case we were shooting like a mess with arms or things like that cool and what's gonna happen is when we do that line trace it's actually gonna store the result in our variable here okay and then down here instead of returning an empty hit result we just returned the hit variable that we created here so I know I've explained a lot but let's recap again we'll take an instant shot we get its location rotation for direction of where we want to shoot it from the player controller and then we pass that data back into these location rotation and we get an end trace using the weapon range the forward Direction is this vector here on the rotation and then we create a variable to store the result in and then we actually do the shot with line trace so this is how one way of doing a raycast line trace by single channel to everything channel if there's something in front of us let's try and shoot it and instant shot instant shot okay there's our function this is looking good okay so this is just a utility function which is why I didn't want to make it available to blueprints because blueprint really doesn't need to do this what blueprint needs is let's say the player actually clicks the mouse and fires we want to do something with that so what I want to do now is create a function called fire so here in the public section of the header of FPS character let's do another property modifier here called u function and in this one we want it to be called blueprint callable we want this function to be called in blueprint in the category we're gonna call weapon I think in these categories have to do with what label they show up under in blueprint and so this particular function is going to be called fire weapon so void fire weapon and void means we're not returning anything okay it just means it's gonna do something and not return anything so void fire weapon and just for fun we'll go ahead and implement this manually I will do it above the instant shot function here so we'll say void a FPS character you always have to prefix your functions with the name of your class it's kind of a pain with so the way it is and we're to say fire weapon now I press tab you may not have that available I am using a paid plugin called resharper which makes Unreal Engine C++ development amazing I if you're serious about it you should use resharper it's better than visual assist and any other tool that's out there it's really fantastic and it makes Unreal Engine C++ development very very fast it actually speeds up Visual Studio which is cool it does cost though so fire weapon and what do we want to have happen here well what I want to have happen is when we hit the other object let's call some functions on it so it can be destroyed but we don't have another object yet so let's create our own class something destructible or damageable I'm gonna go back to Unreal Engine and actually let's first before we click create a class let's click compile make sure we don't have any problems or errors compile complete if you did get errors there just go back and change your code to match it what we've written exactly now file new C++ class and in our case here I want to do an actor this is gonna be the object that we shoot okay so I'm gonna click Next on actor I'm gonna call this damage a bull actor damageable actor create class alright and it's on a hot reload for us and here's our damageable actor so an actor this actor needs to be able to be attacked and I don't have code for that yet so here's our FPS character eagerly waiting to shoot something and here's our actor that wants to be shot so desperately so let's go ahead and implement that now so what I want to do is create a function on here called take attack now what I like to do this is my preference but I feel like it's good design is I like to create the functions that perform core logic in C++ and I don't like to make them expose to blueprint what I do like to expose the blueprint is events because the designers need to go in and they need to put you know sound effects explosions all kinds of things let's do the core logic here but then let's actually open up some events so the first thing I want to do is the core logic for being attacked and what I want to do is put that over here in public but we're not going to make it available to blueprint so what I want to do is create a function here void and we're gonna say take attack ok take attack like I'm being attacked alright like so and if I hover over this I should get my little I don't know what that is a paintbrush a chain I don't know create a definition for it command save and then close out of that and you'll see that over here now at the bottom I I don't know I sometimes it puts it at the top sometimes it puts it at the bottom I really don't know why take attack now in our case here our game is really simple what do we want to have happen well if I had health and hit points I might take some damage off in our case here I just want to forward an event to blueprint so this is where I would perform you know perform health reduction logic you know ie current health or excuse me a safe total health minus equals current or excuse me uh no not total health the current health minus equals and I might say incoming damage and then I might actually put a parameter on here called incoming damage but we really don't have time for this and this is a simple operation to perform baby steps here so what we want to do is just destroy the object but we're not going to do it in here I want this to be available to blue group because sometimes you don't want to destroy an object right away in fact in one of the games I'm building if I was to destroy it right away it goes too fast and I need like a three millisecond delay so it coincides with a nice explosion and such and so it doesn't make sense to do that here in our case so let's create an event that can actually have be handled in blueprint so back here and damageable actor dot h what I want to do is here in the public section we're gonna create a u function it's different this time we're gonna call this blue print implementable event alright once a category is gonna equal damage you give this in the damage category or attack actually a better attack okay and we'll call this void on take attack so we're not going to actually create an implementation of this function this is truly just an event that we can call alright so back in the CPP file instead of destroying the actor here all I'm going to do is say on take attack and any blueprints that are listening for this will be called automatically which will make our life really easy here so back in our FPS character okay now we can go ahead and implement this fire weapon function we can write some logic here so what do we want to do we want to grab the object that's being hit okay and then we want to see if it's a damageable actor and if it is let's just call the take damage function on it or take attack okay so let's do that now we're going to say F hit results will call this hit equals instant shot we're gonna call our instant shot function and it's going to give us a hit result now let's go ahead and grab our damageable actor class so I'm going to say a damageable damage a bull actor and I'm gonna press tab the reason why I press tab is because auto imported this for me now you probably don't have that available to you if you're not using a special assist but I'm paying for some extra features here so in any case you need to include your damageable actor dot h one of the biggest hardships I found with developing for Unreal Engine is finding which files to import and so having the feature where I can just press tab and imports it has been like a lifesaver seriously increase my development time so here's a a damageable actor and this is going to be a pointer and if you're not familiar with c++ a pointer is pointing to a memory address ok a memory address of the particular object and in our case here we're going to call this hit actor or rather the actor that was hit equals cast and I'll explain this in a moment a damageable actor and we're gonna say hit dot actor so what we're doing is this hit if our object if our raycast actually hit something it's gonna have an actor inside of it hit dot actor this is provided as part of the hip result if it's part if that actor actually is a damageable actor our particular actor we're gonna cast it this is one of the beauties of object-oriented programming this particular thing that's happening right here is called polymorphism because our damageable actor inherits from actor we can try and cast it and see if it is of the type that it's supposed to be if it was a different type of back if it was a different type of object not an actor we could not do this so was it our particular actor or not how do we check that well we can just say if hit actor okay so if this actor was a valid cast it means our rake has actually hit one of our damageable objects and then at which point we can go ahead and on that actor we can say what was it hit actor dot take attack like so and again it changed my period into the arrow here use the arrow when you're working with pointers and use the period or the dot when you have a when you've dereferenced your pointer so take attack and then that's going to call the take attack function on our damageable and if you're wondering why I haven't been going back and forth and testing it well this is C++ development for you with C++ because it's a compiled language and you have to really write a lot of code you tend to write a lot of code then compile it and then test it out because it can take 30 seconds or a minute or longer to compile all of your code or even longer depending on your project so you tend to want to write a lot of code up front so that's pretty cool but one problem I have is I don't want all of the boxes that we're gonna destroy all the objects I don't want all of them to be damageable so what I want to do is here in the damageable actor I want to create a you property view property we're gonna call this edit anywhere we want this to be editable in blueprint as well as in the world outliner actually in your level and we'll say category equals attack and we're gonna say bool is attackable and by default set it to true alright he is attackable cool now what I can do is back over here in our FPS character I can say if hit actor and if hit actor dot is attackable let's go ahead and take attack so let's not even attack it at all unless it's attackable now we could do this logic here or we could have done this logic inside of the actor here it's really your preference I might have done it in this class over here in a real game because this is the class that probably should handle that but whatever this is fine for now and it's cool to see how you can implement these things so if it's attackable let's go ahead and call the take attack function on it at which point and take attack function where are you a little guy take attack we're calling the on take attack event emitter so I'm gonna go back to unreal now and compile there we go now I know we're moving fast here but we still have more to do to finish this up and before we can actually test it so here on our content folder what I would like to do is go find let's find a prop okay so we've got this chair and this is just a static mesh so this is gonna work out really nice for us here oh there's a rock - how pretty so let's go ahead and use the things that we've created I'm gonna go to my content here and I'm gonna create a new folder we're just call this blueprints like so blueprints and let's go into it right click and I'm gonna say new blueprint class and here is where things start to get exciting instead of using these boring parent classes we can go to all classes now and we can select our damageable actor the C++ classes are available to us and this is a true Unreal Engine game development workflow creating code in C++ and then creating blueprints from them and using its properties and functions and such and let's call this we're gonna call this a base damageable I for lack of a better okay I'm gonna go into this here and I'm gonna click add component and we're gonna add a static mesh component and let's just call this the item and for the static mesh let's pick a mesh I wanna make these view options a little bit larger so we can make a better decision here look at all these beautiful donuts and circles and triangles what I'm looking for though is how about we will do the chair let's start with the chair so there's our nice chair okay beautiful cool compile and save and by the way you can always click class settings and you can see the parent class which is damageable actor which is really cool and if we go over here to this eyeball and click show inherited variables this is where you can see in very variables for your particular actor or object that you've created which is also really cool what I'd like to do is go here into the event graph and this is our base damageable so I can right click and I can say on take attack and that's the event that we actually created back over here in the damageable actor on take attack so when we're attacked this will actually be called okay which is I think is really cool and then what we can do is we can right click and say destroy we'll just destroy the actor here and in the middle here is where you'd create like any effects or explosions and we may do that in a minute if we have time compile and save so there's a event on take attack destroy actor awesome so now what I want to do is right click this and create a child blueprint class I don't just want to duplicate it I want to create a child of it this is kind of like inheritance in C++ so then I can do all my special logic here in the base and it automatically gets applied to the children and so in this case let's just call this you know next item these are really bad names I know I'm gonna open up the next item and then what I want to do is click the static chair and just pick a different static mesh object I think I saw a boulder in here so we're something a rock there we go a big giant rock compile and save so there's a rock and we're automatically gonna get all these other functionality out of the box which is really cool all right we're getting closer ladies and gentlemen I know this is a longer video but you're learning a lot of things here and so the last thing we need to do is actually tie up our firstpersoncharacter actually create one so what I'm gonna do is in the blueprints folder right click and do a new blueprint class and down here we're gonna type an FPS character this is the character that we created in C++ I'll just call this my character right now so you can know that it's distinct and different from the FPS character in there and what I want to do is one more thing is right click go to blueprint class and we're gonna pick our game mode down here so remember how we created a game mode for us automatically first cpp game lesson game mode base yes I know that's a long word let's just call this in my game mode and then what I need to do is go to the edit and then project settings go to maps and modes and we need to tell it which game mode to use so we're gonna say choose the my game mode and the default pawn is gonna be that my character that we just created in the blueprint and if we go into the my character drag this up here class settings here's our FPS character so we're inheriting directly from the C++ class that we created which is awesome so let's get this character moving around we'll just do left and right for right now so back in the project settings go to input we're gonna go to axis mappings like so I'm going to say move left and what key do we want that to that'll be the a key so I'll type an A and then go to the keyboard a and for the scale we'll say negative 1 and then we'll add a new mapping I guess let's not do this new access mapping we'll keep it really simple we'll say move right like so and this would be the deaky so type in d keyboard I'm just going real fast on these here it's just so we can get into the I type in s didn't I just we can get into the thick of things here so D and D and we'll leave that at one so it goes to the right and that's fine for now let's go back to my character here and let's add our logic here so we're going to say move right input access move right and input access move left we just want to tap into these these things here so when those keys are pressed automatically moves or gives us those axis values let's add some input add movement input I'm gonna copy this and paste it here we want it for both of these so basically every time you press the key we just want to move the character to the left or to the right so I'm plugging the access into the scale you'll see this and the other first person project or most projects over and over again I'm simplifying it here and the last thing we need to do here is give it a direction so we'll say get player how much we can just get the camera get player camera manager there we go and then let's go ahead and say get forward get actor forward vector and we're gonna plug this in to the for direction we just want to get the for Direction not the for direction the right direction that could have been bad get right vector and we're going to plug that into here we want to see it we want to know which direction is right and left on the on the camera or the actor so we can move in that direction so this is just some simple movement here when we move left move right the player moves around that's all that's happening here lastly let's right click and say mouse and if we scroll up we should see the Mouse events Mouse left button I could have added inputs for that over here but it's just really easy here and we'll do it on release when we lift up the mouse and we'll call this what was a fire weapon there's our fire weapon function that we created purely in C++ how cool that fire weapon compiled save we're looking good here and we make this floor bigger e to scale it out nice and large and I want to play just make sure my character is moving left to right which he is or she is it's actually an invisible character cool so let's go ahead and add in our props here so let's add in our chair which is really kind of small let's make it big so we can actually shoot it this is a giant chair like so and then let's add in our rock the next item make that nice and large like so and here's where things get really fun so if I click this chair and then we look over here on the right hand side here's our attack property is attackable is true let's actually leave that on but on the rock let's turn it off we made this available over here inside of our code remember damageable actor and anywhere is attackable we can change us here in the world and that's the beauty of that edit anywhere property modifier there and let's click play so if I click it should be shooting and I hit the chair and it died now notice how we didn't hit it at first that's because I can't see my ray cast I don't have a laser I don't even have a crosshair on the screen I could add a rect achill to the screen in UMG in the center and that would help us out but notice how our rock is not disappearing when I'm clicking that's because there's no ray cast on it that's pretty cool and just to send this point home let's alt drag over here and make this one attackable and play the chair can be deleted or destroyed once we hit it and that one can't but that one can i'm clicking like crazy over here so really really cool stuff that's it we just we just did the whole thing and I know this was a long video but let's quickly recap what you did because it was a lot ok make sure of course that you have Visual Studio installed or you can't do this tutorial and basically we created a first person character all from scratch ok we did some ray cast where you could shoot out an invisible ray and see what's on the other end and right now we're only attacking damageable actors which we created okay which is cool and on the damageable actor we can actually turn off turn it on or off and then you also learned about how to do blueprint into mental implementable events like on take attack which is pretty cool where the blueprint can actually listen to it and if you want to see that in action so we've got this chair here based damageable what-if on this take attack what if we put like spawn emitter here I'm gonna alt click to destroy that let's say spawn and emitter at location let's see if the base content comes with any emitters it does it has an explosion how cool is that so there's an explosion what location do we want to do it at well we'll just do the location of the actual objects will say get location like so I'm here in the remember I'm here in the base damageable object now we could of course done this from C++ but I personally don't like to anything with emitters and like even projectiles and things like that I do not like to on those from code because what if I need to change it what if I need to look a certain way anything that is visual at all I personally always do in blueprint and I just do the core logic and C++ or when I need inheritance or properties so when we say on take attack what I'd like to do is spawn this emitter I don't care about the rotation right now I want to spawn the emitter and then we'll destroy the actor okay let's give that a shot and because I did this in base damageable it should also work on the rock the next item that's why I didn't just copy it I did create child blueprint class so let's click Play there's our explosion how cool is that boom pretty cool and of course it's really small you know you could have fun with this here and you know you can make it you can make it a lot bigger let me say you know three three and three Auto destroy leave that on and play boom okay pretty cool stuff here so you just created your very own Plus came from scratch we did it all from scratch a blank project and we tied in blueprints we did things that I think are good professional ways of doing things working with blueprint and C++ working together and that's it this is really cool stuff you're on your foundation to moving forward and move forward build some games
Info
Channel: Devslopes
Views: 231,715
Rating: undefined out of 5
Keywords: unreal engine 4, unreal engine, ue4, blueprint, c++, unreal engine tutorial, unreal beginner tutorial, unreal c++ tutorial, learn c++ unreal, game development tutorial, first unreal game
Id: 1dl91ORwmy8
Channel Id: undefined
Length: 42min 21sec (2541 seconds)
Published: Mon Jul 01 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.