#01 - Creating A Project | UE5 C++ Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and welcome to a new video series here on the lyric fossil channel we're gonna continue the unreal engine 5 exploration when i first made the video this like one hour video where i started writing c plus plus for the unreal engine i never intended it to kind of like getting that big but basically now it's the most viewed video on the channel has over 200 likes and um yeah was doing quite well so yeah i have decided to actually continue on the series or not continue but basically start a new series uh we now have the full version of unreal engine so unreal engine 5 is now available as you can see here up it's gonna teaser here uh you can add it to your library here by adding uh click on the plus icon and selecting the uh 5.0 version i already got it because it would take ages to basically uh get this started uh i also did played a few things around and also tried to make another tutorial here but i decided to go on a different approach so here we are gonna go on a new uh c plus plus tutorial for unreal engine five so the first thing that we wanna do is click on launch and basically create a project because this uh tutorial series is gonna be um a very basic tutorial series we're going to start at the beginning it's not going to be long the videos are going to be short i'm going to focus on one feature per video and i'm going to try to explain several stuff first before we get into the real stuff and get started with creating everything and making nice things because like this is going to be planned this video not like the other one all right so here we are this is the unreal engine project browser in this browser we can see all of the games that have been created with the unreal engine on our system like a few things that i tried like this was the video that i planned to continue on for the other series but it was so complicated and too long this was the old tutorial that i did this is like the new demo game which you definitely should check out so if you are new to unreal engine just uh and you want to see full glory of unreal engine 5 and you want to see maybe a default scene just pause it go just pause the video of course go back to the epic launcher which magically disappeared there it is go to samples and click on the lyra starter game and you can basically say create project and it's going to create yourself a new project that you can start and play and test out modify some things see how this project was done and basically see what's going on all right then there are also a few playground projects of myself and this savannah tutorial so what we want to do here to create a new project is click on games because we want to create a game and actually we don't want to get any template we might gonna redo this later on when we know what each thing is if we have a good understanding of each of the base classes or the most common classes in the unreal engine we might then go and create this person or first person or top-down game whatever is going to come into my mind when we are getting to this so we want to start with a blank project we want to select c plus plus because well there's a c plus plus tutorial the target platform of course this desktop but don't want to write something for mobile devices you might want to do but i don't then you have this quality preset i'm going to select this maximum starter contract on ray tracing off you can always change this later on so right so this is going to be the new cpp tutorial and it's going to be stored in k ue5 tutorials it's just a part here where my stuff is going to be stored all right so now the next thing that i want to do is hit create to create a project for ourselves and when the project is being created i want to talk a bit about um how i planned this tutorial series so basically what i've planned is to basically go uh through the basic classes of unreal engine show you how the unreal engine work how we can tinker around and implement our own stuff and how each of these systems come together this is not going to be a scientific tutorial where we're going to explain each possibility this is more hands-on tutorial so we're going to start here explore things go into the depth but not like in a theoretical standpoint i'm not like the guy who has the fancy animations on the screen because i don't have the time to do them so we're just going to go hands-on and do a practical approach on everything and basically what i want to do is i want to explain you several classes we're going to start very simple i'm going to basically try to explain to you the unreal engine class hierarchy as we go and at some point we are like deep down a class hierarchy have explained uh um have explained characters have explained pawns everything network maybe even network stuff and then we are on a point where we can actually build a a level uh our own game and then we're gonna do it in a different project all right so unreal engine has now finally uh showed up um we're just gonna click this miss on this plugin uh pop-up and what i'm also want to do is i want to click update on uh on this box because the project file is out of date i think this is just an issue because like the the the template that was generated by the launcher is not matching the engine version but we should just be able to click update and there we go yeah nothing has changed so this is the full glory of the unreal engine and as you might also have seen and the visual studio instance is also started up i'm going to bring this to you as soon as we are done here in the the engine itself so you can see that the engine is now open and we have this full screen or nearly full screen viewport as well as this details panels and the scene outline so the scene outline basically is a list of all objects that are in the scene but you should definitely notice i'm like explaining too much stuff actually because like if you start with c plus plus you probably know the unreal engine right but if you don't basically this isn't a hierarchy you can group stuff together this is just everything that's in the scene for example if i would take a look at the static meshes i'm going to find the chair and as you can see if i click the chair you can see it's going to be selected here on the viewport as well and we also get this gizmo here that we can use to move the object and basically navigating in this viewport is also very easy uh you can right click here and drag the mouse and you can see that the camera is moving um as soon as i am releasing off right click i have my mouse back and can click the buttons again while i'm holding right click and move around i can also use the wasd keys just like in a first person game or surprise game to basically fly around the scene and see what's going on here and basically what i can also do of course i don't need to select the chair up here in the outliner i can also select the chair by clicking on here so by clicking on the stiffer aperture here you can see now it is selected uh while this chair selected you can see that we have the gizmo again and now we can actually use this one you can see we have these different arrows that point in different directions and if we click one of them we can move the chair in the specified uh direction so you can see now i can move it here front to back take the other one yeah that side or so i can move it up of course common commands like control z always work uh to put it back onto the ground as you can see we can also click in between two of these arrows for example like the green and the red one if i click in between of them you can see that i can move it freely around without changing the height so i'm basically moving it around the scene but i'm not changing its height this is a really uh helpful if you are like that placing the chair in the level you can like move close to the table and then you can like go say okay i want to move it here as you can see the moving is currently a bit chunky you can change this up here you have different modes so for example uh this one here on the right is scaling this one in the center is the rotation and this one on the left is position if i click this uh 10 this number 10 and i'm gonna get a a pop-up with a snap size basically this is the grid we were snapping on i can maybe change this to five and now if i would go in here you can see that the the the position is a bit more precise because we have basically double the resolution from ten to five we could go even lower and select one this is going to give us the the finest result and now you can see i have really really good control and you're probably going to change this depending on what task you are doing if you are mainly polishing up your level and uh we are basically laying out objects in the scene very uh detailed so basically on here then you probably are on this this this fine one so that you can basically move them around very very uh independent and without big distances but if you're doing big level loadout you might be up to to 210 again or 50. and you can do this as well for rotation and scaling speaking of rotation scaling you can easily rotate and scale by pressing the space bar you can see that the gizmo is changing every time i press the spacebar we were previously on that error gizmo if i'm now going to press the spacebar we're going to be at the rotational tools and now i can basically click the axis that i want to rotate and rotate the piece around here um there's nothing like free rotate this is just that direction that direction and that direction can see that i can see the angles that i am rotating so that we can also see what's going on currently we are on this uh this this 10 degree uh uh freedom but it can also go on to different ones here or even divisions of 360 degrees to get uh interesting uh yeah the results uh by the way if you find the camera too fast you can also change the camera speed so if i lower the speed you can see that it takes way longer to zoom out or in this might also be good if you are doing like this detailed loadout you want to have a slow camera that's moving slow so you can basically uh dial it in very precisely where you want to be with the camera to then uh go in here and yeah of course now i have i'm back on the on the heart grid but basically go in here and do very detailed placements but uh what you can also do is also uh change this if you are no longer needing it i personally think three is going to be a good starting point for us today so as you can see i can also move it and rotate it and the next thing this like with the square handles this is actually now scaling i can scale it up stretch it as you can see it's looking a bit ugly but you might want to go for that look no but you might have like a uniform object that you want to have different sizes of so scaling is important sometimes or sometimes you just want to scale an object up uniformly though just click the center white bar and boom you can scale it up uh uniformly or even you can go even negative which is flipping at that in this case so we can go here and make a nice big glass sculpture or you might want to say no guess what i'm not gonna have the the the glass sculpture uh on here and by the way this is a control that i haven't mentioned yet uh if you want to move with your object you can hold the shift button while you are moving these uh the gizmo errors and you can see the camera is fixed and moves with the object which is really helpful at uh certain points when you're doing your your level setup right but in this case i just want to have a a grounded stature so let me scale this up way bigger because this is now um some arch that shall stand on the floor like that maybe move that one around we're gonna tell you what this is in the future we get to it but now i can like see yeah scale this up a bit all right there might be a point where you actually want to play your level and see what's going on and you can do this just by hitting this uh play button up here play an editor and you can see we are in here we get some audio cues we have the big big glass statue we have our table that the chairs and you can see moving is the same now the mouse is locked you can not you don't need to press right click here if you are playing this is just because so the the game is coded and you can see that wac always works and yeah we are not kind of like in a game we can fly around this is something that you're probably going to change if you are doing a a a first person a third person game but that's uh where the templates came uh in where you have like okay like select first person or third person you can always write them yourself of course but templates always help you getting things done easily so yeah now we can play our game now we want to exit it press escape nothing ever works how can i get back well the always is the windows key that can come into rescue but uh then we can get our mouse back again but i'm gonna show you the proper way the proper way to tap out of that there are different reasons why you wanna tap out of that you might wanna go out here to stop uh simulating the game or you might want to actually go out to maybe check your uh your objects like you could check your statue if the statue has like a parameter assigned that we're gonna see in future videos you can check the parameter value actually um to get out of this you're gonna press shift f1 and you get your mouse back but the game is still running now you are free to move around to go into your outline to select the statue view all the properties of the statue here see the material you could even like go in and try to to swap this to some material that's looking quite interesting and as soon as i'm gonna click into the viewport again the mouse is trapped again and we are back into our play mode to get out shift f1 uh and we are back in okay um so yeah i'm out again and i can like go in now and select other things maybe change the chair material to oh my god whatever that is and i can preview any settings but you need to be aware as soon as the game stops the uh game state that is currently running here so all changes you may uh while the game is running i actually discard it so now i'm basically out here and i can stop the game by pressing this uh this is the stop button this uh can you can do this with the mouse and you can actually see that as soon as i do this i'm gonna get some um some some errors here that i changed something material basically can see uh uh that the thematic the the uh study mesh component is not movable so basically it's static it's not meant to be changed and it's going to give us a warning here because we changed it we're doing run time but for four hours after okay this was just a preview it gets discarded anyway so yeah that's the story uh one thing that i also want to show you if you uh play you can also do this by hitting alt p actually if i hit alt p playing again and i want to directly stop i can press shift escape if i'm clicking shift escape i'm always out directly shift f1 give me my mouse back change stuff see stuff modify stuff shift escape go out of it uh these are very important um yeah key commands because you're going to need them always but actually always when you start the game unreal engine is actually uh showing you how to start up a a little hint that shift f1 is going to give you back your mouse and yeah here we are back in the editor so i also mentioned that we are going to use c plus plus well this is a full point of this tutorial series and i mentioned that uh unreal engine has actually created ourselves a visual studio solution and i'm now going to open this up and show this to you so here we are visual studio 2022 because uh yeah it's new unreal engine new visual studio and we have a fresh solution for our uh game and we have several folders in here we have the engine with the project ue5 this is actually containing all the source of the engine so the complete engine source is in here as far as i know you need to be a light able to get the source if you are not delightable for the source you're not going to get it as far as i know but you can always check this at your uh at your unreal engine profile it's just just you just need to accept the oil and then you can get access to the uh to the source code actually it's not not that hard and yeah then you get the access and always if you want to see how oh why is that not working you can actually go down and take a look how the unreal engine features are implemented how your application is called you can debug your application in here and you can basically see oh from where am i called how is this all built up and you can basically debug your application because all the unreal engine source is basically attached now the second folder is the games folder here we have the project with the name of our game the new c plus plus tutorial new cpp tutorial and this is going to contain all the source code of our project so you can see we have several folders in here we have this new project file which is uh basically a a project that that defines how how this module this class code module is loaded from the engine we don't need this yet uh we have this config file a folder which is having some configuration files here that you could now go in and change the default game default engine so basically you can see default graphics r a a r a is directx 12 so we are directx 12 here and you could go in here and change some configuration stuff here if you want uh but in this case we just want to leave them by default for now we might do this in the future as well and now getting to the interesting folder the source folder the source folder is going to contain another folder and some c-sharp script uh the unreal engine is actually using a c-sharp application for its build system so it's not using like the microsoft build tool it's not using like pre-make cmake or something like that it's actually using a very smart own uh build system which i am really surprised nobody has written something similar for general c plus plus projects but yeah maybe someone will do at a time but i don't have the time currently but i might do in the future um yeah but basically it's having a very smart build system where you can basically set up how your module is built we're not gonna go into that now uh in the future if we need to change something here we might wanna do and go in here if we might wanna have some external libraries that get pulled in we need to do this uh eventually here in our module because our module is then going to uh basically uh depend on something differently so basically what you do is you create like a module that implements or it contains the source code for that uh library and then you have like depend uh to the to that model to that module here from your build information so it's a very smart and easy build system and actually we have two different files here the one is for the game when we are building it for the game and the other one is for the editors you can see target type editor and target type game so for the so uh basically we have one five for the editor and one file for the game itself this might be helpful if we have some configuration that depends on like preprocessor content so that we have like have some ex some more exposed editor controls in the editor so maybe a few more parameters some buttons where we can like revive our character and stuff like that so the function revive or a function give me infinite money or something like that that you that you don't want to have in the game because i don't want to get it uh to be exploited by cheats and stuff like that so you might have a constant here for the preprocessor defined in the build system only on the editor uh i mean there is already a thing in unreal engine that is only defined on editor builds but um you can't like get the point you can have different build configurations depending on the uh if you are playing it editor or if it's really a game that you ship all right so uh this id to postscript scripts not really interesting for now and what we also get is this new cpp tutorial folder this new cpp tutorial folder is gonna uh contain a few more things again it's containing a c-sharp build script and this build script is now basically a common build script that uh basically defines uh what's always uh required so basically we are always requiring the core the core u object the engine and the input core for our module so unreal engine core uh u object core is basically for the the holy super class uh u object which is like everything that we're gonna implement or we're gonna basically uh uh extend several classes like components actors and stuff like that and they all like are based on on on on on on the superclass which at some point is going to be end up at the new object then of course we are requiring the unreal engine so all the engine stuff the global engine state that's going on we need this and we also have the input core which is basically user input and if you would uh need something uh more so more dependencies you can always add them here and you can easily then use them here so very straightforward to do actually uh if you know the module name of course now actually uh the unreal engine by default creates two classes uh or basically two c plus plus files and indirectly two classes so the first one is the new cpp tutorial you're not never gonna change something in here uh even through this is kind of like implementing a class it's doing this under the hood so if you would take a look at the implementation you can see that there is this implement primary game module f default game module implementation usbp tutorial and stuff like that uh this is basically just a function that registers our code to the unreal engine so this is kind of like required by the unreal engine though that it knows that we are basically programming an unreal engine game and by the way of course i'm gonna zoom in a bit now uh oh i love that that i need to do so now i have to not do this in in editing later on uh but yeah so basically this is uh some source code that that gets always compiled whatever this does if it's exposing a function if it's uh actually you can see it expands to a struct so it's basically a struct aka class um that's probably uh going to be also instantiated there that is kind of like sitting there aesthetically and it's going to be instantiated and can be found by the engine something like that if you would want to actually take a look at what this is you can always peek the definition here because we have the source attached and here implement target name registration implement game module so we register basically a name here something like that and we register a module uh the game module itself and if it would peak down uh even deeper um i'm actually gonna end up here so actually you can see all right this is a dll export so we're gonna actually export the dll function called initialize module and later on when the engine basically loads our dll so all dll gets compiled and loaded by the engine the engine then looks for this initialized module function and basically uh it we're probably gonna call this and when the engine is calling it it's getting back this imodule interface and with this interface engine knows everything about our code module basically but this is all generated under the hood we don't need to care about this but that's just how it works uh under the hood all right we also gonna get a uh gamer base this is something that gets always created it's a uh a game mode we're gonna not gonna explain too much things about the game mode but basically it is like a high-level class that manages our game something like that it has not uh some implementation attached because it's just not used it just created by default if by default we're just gonna get the game mode all right so um now we have explained everything that's in here one very important thing you're never gonna add some code via visual studio you're gonna always add code through the unreal engine and then visual studio is gonna prompt you that the project has been reloaded or modified or you wanna reload i'm gonna say reload and boom the source code is going to be there so you just use visual studio for pro programming for as an ide and another thing uh i it's it's really not feasible to actually program the unreal engine with intellisense it doesn't work it needs ages as soon as you change something it needs agents again it's not productive i really recommend you to get visual assist visual assist is a an enhancement plugin for visual studio basically it do cost money i don't know if there are probably some some uh free alternatives to that but basically what visual assist does is uh it brings a better version of uh intellisense and actually a version of intellisense or an own implementation of intellisense it's i think it's not called intellisense how is it called uh it's uh just called visual assist uh not default intelligence it's just called visual assist and another thing is that visual assist was actually tuned especially for the unreal engine so it actually knows how the unreal engine works and thus can help you really much when implementing uh unreal engine games so do invest a bit of money into visual assist if you can avoid it because it really gonna help you out not only for uh the unreal engine also on your general c plus projects uh all right so that was everything that concludes uh like the basic uh editor uh controls and uh the c plus source code how it's gonna be get created uh in the next video we're actually gonna take a look on how objects work here and we're going to start by implementing a own part of an object so uh yeah thank you for watching see you in the next video make sure to like and subscribe and also activate the bell so that you get notified when next plus video on unreal engine and gets released so that you are the first one who can actually watch it so yeah thank you for watching have a nice day see you in the next one bye [Music] you
Info
Channel: Lötwig Fusel
Views: 48,860
Rating: undefined out of 5
Keywords: Unreal, Engine, UE5, Unreal 5, Engine 5, Unreal Engine 5, Tutorial, Cpp, C++, Programming, Unreal C++, Unreal Engine 5 Tutorial, UE5 Tutorial, UE5 c++, Unreal Engine 5 C++, Unreal Engine 5 C++ Tutorial, Lötwig, Fusel, Game, Game Engine, Games
Id: g9dU0eCy8RI
Channel Id: undefined
Length: 26min 54sec (1614 seconds)
Published: Thu Apr 14 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.