How to Create a Car Racing Game in Unreal Engine 5 - UE5 Beginner Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
is your dream creating a game but you haven't done it yet in this course you will learn the fundamentals of game development enroll now in early access to get a huge discount and all future updates for free did you ever wanted to create your own racing game but didn't know how to start in this tutorial you'll learn how to develop a time trial racing game from the ground up only using unreal engine 5. you will develop the base mechanics of the game using blueprints create the environment of our level using materials and mega scan assets show relevant game information in the hud with widget blueprints create your own sound effects inside the unreal engine editor using metasounds and learn how to polish the game with sequencer and package it so you can share it with everyone the goal of this tutorial is to create the complete flow of a game this means that you will be able to start the game play win or lose and restart or quit the game there are no requirements needed for this tutorial and as always knowing your way around the editor is recommended but not mandatory i hope this tutorial is a great learning experience for you and if you have any feedback while learning with this video please leave it in the comments below also make sure to subscribe and click the bell if you don't want to miss our next tutorials with that said let's begin let's start by opening the epic games launcher and launching unreal engine 5. if you don't have it yet go to library you can choose here the plus button here choose the version that you need in our case unreal engine 5 and install it then we can launch it we can go to games choose the vehicle template and give it a name after this we will click create here in the editor we can click here this miss and if we press play immediately we already have a card that with the keys you can accelerate break and turn so we're done thanks for watching and see you next time wait a minute that's not a game right what is a game a definition could be where you're in control of something you need to achieve a goal and something is preventing you from reaching that goal otherwise it would be pretty linear right and linear is boring now the way that you will be able to overcome those obstacles would be the mechanics for example here we could add a jump mechanic with this little example we have created a game flow there is a start and there is a finish we can create more levels add more obstacles add more mechanics but the flow of the game will be the same we need to reach the goal at the finish point so in order for our template to be a game we need to add a way to finish the game in our case it will be the finish line when our car crosses the finish line then we can tell the game that it's finally over we will make this game a time trial game you will need to cross some checkpoints in order to stay in the race and that will be the obstacle of our game the mechanics beside driving will be that every time you pass a checkpoint you will get more time so you can finish the race and that will be how our game will work let's start by creating the game mode which will hold all the rules of our game let's create a folder called racing game inside it a new one called framework and inside it let's create the game mode here we have it click let's call it gm racing game inside it we will define the states of the game we will have the start of the game and the end this is done by going to the event graph right clicking and typing custom event i'll rename the custom event pressing f2 and call it game finish i'll also add a new input to know if the player won or if the player lost here in the game mode i want to add the rules that will decide when the game ends for example whenever you run out of time also i want to control the different states that my game can have one of them would be the countdown before the game starts so i'm going to add another custom event called start countdown the countdown should wait 5 seconds and then the game should start so i'm going to drag from the execution pin a delay node this delay node will be 5 seconds in duration after that i will call the game start right now nothing is calling this countdown so in order to use it i need to call the start countdown when the game begins so i will look for the event begin play if you don't have it you can search it by right clicking and typing beginplay and here it is for me i'll just drag and drop from here and call this start condom i want to test if my game states are working so i'll add some print notes so i can know that these events are being triggered now i want to test them so i'll press play no message is shown so i know that my game mode is not being used i'll go back to the map and here in the map i can check which game mode is being used i can go here to blueprints here project settings it's showing me that the gamemode that we're using is the vehicle advanced gamemode right now this world is not overriding the gamemode but we could here select the game mode that we just created and that would overwrite my vehicle advanced mode and that was created in a new game mode excuse me here like this and if i press play now it says start countdown but we are not seeing the vehicle let's remove the override now let's open the project settings through here and select the game mode that we will use by default we can do it through here very simple or we can also go to edit project settings go to maps and modes and here in the default game mode we have the racing game when we press play our logic is working but we are not seeing anything here it's because the game mode also defines the default classes that were we are going to use in our game so let's go back to our game mode let's go to class defaults here in default pawn class i'm going to select the sports car and in the player controller i'm going to select the vehicle player controller with these two classes selected i'm going to press play and see what happens now we have the car and the hat that we previously were seeing this happens because the pawn class is the representation of the player inside our game and the controllers is the brain in this case the inputs of our player let me fix this to just say countdown so now we have an estate kind of an estate machine where it begins with a start countdown five second passes should be three and then the game starts here we will have logic like for example setting up the timer and when this timer ends the game should finish and we should really do that now like i said before the game mode is being used to set up the rules of the game rules that affect the state of the game so here i will create the timer game start i'm going to set the timer and here i will set timer by event this timer does not need to loop so this will be false how much time it will be at the start for now i'll just set it up as 10. now something that i would like to mention is that it's not a good idea to have floating numbers this in programming is called magic numbers that are just numbers that are explicitly set if you come back to a project after maybe two months you will be wondering why this is three and this is ten so it would be a good idea to use variables to store this information to create a variable i'll just drag and drop from here and promote it to a variable a variable is just a small box that's holding information this information can be of different types and here in variable type in the details panel we can change the value of the type booleans store true or false floats numbers with decimals integers numbers without decimals and we have many more that we will talk later here this variable is not very useful this name so let's change it to countdown duration and it is even better if the name is more explicit for example start countdown duration again i will create a variable for the timer and call it start timer duration after creating these variables i want to set the default value that is already set but let me check let's press compile and now here in the variables i can see the actual value of them in order for me to test this i'll change the start countdown duration to 1 and i'll change the start time timer duration to also 1. here we have a little compilation error because there is no value in the pin call event so we need to connect an event to this timer so when it finishes then the event connected will trigger whenever this timer finishes we should lose so i will create an event that i can connect to this i call it loose out of time just in case we have more ways of losing now to connect it we can just plug it in like this and whenever i lose and it's because we are out of time i'll just call the game finish and tell it that win is false if we would have won then this should be true and here i'll just put another text and in order to say that we will in or that we lost we're going to do something called a select i'll drag from here type select and when it's a this is win if it is a it means it is true so if it's true then you win if it is false you lost or well you lose perfect now let's try it let's compile save and play after one seconds the game has started and after one second i lost so it seems that this is working if for whatever reason we win before we lose we need to stop this timer we need to have access to this timer in order for us to stop it so we need to promote it to a variable these are different events if i try to access this timer i'm not actually getting the same timer i'm creating a new one and it's connected to the same event so i'm overriding the timer so this will not work we need to promote it to a variable and let's call it time remaining time then if we need to stop it we can get a reference from this variable and just clear and invalidate the timer so i'll create a new custom event called win and i've also given the reason why we won i'll connect this and i need to call the game finish we'll set up the win as true and now we can call this custom event somewhere and we can tell the game to stop the timer and then call the game finish so we can print in our screen that we want or that we lost we already tested that this worked so let's change the values of the countdown back to 3 the start timer duration maybe to 10 we can later change it and with this the rules of the game has been set we have some states of the game and how we can finish it we need to call this win event otherwise we cannot win so let's create a blueprint called checkpoint and that blueprint will let us send a message to the game mode let's open the content drawer here in racing game this blueprint is not part of the framework so i'll just create another folder called checkpoints inside it i'll create the blueprint i'll select an actor and just as a refresher an actor is whatever object that i can put inside the map let's call this bp checkpoint open it and here is the blueprint editor interface we skip it over in the game mode but it's because in the viewport we won't be able to see anything here we have a viewport in the viewport we will see all the components that this blueprint is holding we can add components for example let's add a cube and by selecting a component we can modify its properties here in the details panel we can change the location either by these properties or by using the gizmo here excuse me this one we can reset the property by using this nifty arrow and well we can access the viewport the same way that we can use it inside the map which is with the click holding left we'll move it like this holding the right click will move the camera around and you can get like a fps control of the viewport if you hold the right click and then move the wasd keys also using q and e to go down and go up i need a checkpoint so i want to make this cube into something that can look like a checkpoint for that i need two cubes and here because my cube was selected the other cube was added on top what you need to take in consideration whenever you're working inside of blueprints is that the child component will follow the parents movement for example if i select the child and i move it around nothing happens but if i move the parent component then the child follows it the same is with the scale if i scale one then i scale both of them i'm going to use that property and and parent them i am parenting them by holding my mouse and dragging them on top here you will see drop here to the touch queue from q1 and now they are detached but take in consideration that my cube still maintains the properties change but now in a world scale so for example if i again parent the cubes i scale this cube like this and then and parent the tubes then the scales are also safe so i'll just reset the scales on both of them and what i'm going to do is click on the default scene root add a scene component here sync component this sync component will be the parent of both of these cubes why because i want to use the sync component to scale them but only upwards so i just need to move the cube 50 units up in both cases and move them around a little bit to the side something like this and the same for the other cube yeah minus 250 and 50 in c now this scene component i will be using it as a parent just so i can scale in c and it will go upwards 4 is fine and now this is my checkpoint compile and save we have now know how to use the components add more components move it move them around modify them here in the details and every component will have their own properties that we can modify for example here in this static mesh we have static mesh and we can change it around but let's not do it then the blueprint beside the viewport has a construction script that we will be using it later on this code runs before the gameplay is executed and then we have the event graph that we already know how to use it in the event graph will be most of the code and most of the features that we will be implementing in any type of game so let's continue here in the viewport i know what my cubes are looking how they are the vive that they are giving but oops it would be a better idea to know how they are looking in the map and see the relation in the size with the car let's go back to the vehicle example map and put the checkpoint here i'll just rotate them and press play now it's a little bit small so i will increase the distance and also i'll change a little bit of the rotation why because usually when we are talking about the forward of any type of actor by default unreal takes it as x positive here it is x positive but in my case my cubes are not like facing forward we can rotate this scene or we can move the cubes around in my case i'll just rotate the scene and here in the cubes i'll move them a little bit further apart minus 500 and 500 let's compile save and well whatever i modify here will be updated in my map so i need to rotate this again or i can just reset the rotation here now that looks more like a checkpoint that we can pass through perfect now i want to do something when my car passes through this checkpoint so i need a way of knowing when did it pass through here in the blueprint checkpoint in the viewport in the default scene root i will add a box collision this is another component very common one that will help me know when something collided with it here i can change in the details panel the box stand of this component and well let's just type here in x 30 in c we will use 200 in y 500 and 30 in x should be fine and let's position this at 200 units in the c axis now that we have placed this box collision we want to get an overlap event we should really check the conditions of this box by going here in the details panel searching the collision category and making sure that it's overlapping all dynamic with this we are bound to get the actual event when something dynamic overlapped this and we can later on determine if that's a car or whatever else it could be so this box will be used as a trigger to get the overlap event we can right click add event and begin overlap it's also here in the details panel here in events begin overlap if we click plus it would be the same thing that we are doing right now this event will trigger every time we overlap this checkpoint so we can create a little print string press play and see if something happens and it says hello perfect so this is working now we want to tell our game mode here that we are winning the game so we need to communicate between these two blueprints for blueprint communication to happen one blueprint needs to know the other either the sender knows the receiver or the receiver knows the sender in our case the checkpoint will know the gamemode through a reference and a reference is the way that most communication between blueprints happen so to get a reference to the gamemode we can just right click type game mode and here you will get game mode with this reference we should call the function or well the event that we created called wind cross the finish line but if we try to do that we won't find it because this reference is just a game mode base reference is not a racing game reference so we need to translate it and this translation is what it's called a cast and we need to cast it to our class now we know that this game mode reference which is a generic game mode that already came with the engine we want the specific class called gm racing game and from here we can get the win cross the finish line now we compile save and play the content starts the game starts and if we cross the finish line it says you win and hello and after the 10 second passes we shouldn't get any type of message because we have already stopped the timer so this is working the only thing about this and i'll get rid of the hello print string is that if we had more than one checkpoint it's still triggering the winning winning and it's because every time one of these checkpoints are overlapped we are telling it hey you need to run the win cross the finish line event this type of communication right now is a direct communication because we are casting the game mode and we know exactly how the function is called here is the most basic type of blueprint communication but in this case it is not the most appropriate one we want to have many checkpoints and every checkpoint can get crossed so we want to change the approach that we are using here we are going to do something very similar like the begin overlap event inside the trigger box because every time the checkpoint is crossed i want to trigger some event the way that we can do this is through another type of blueprint communication called event dispatchers we can find our list of event dispatchers here and right now this blueprint does not have any so let's create one and i will call this uncheckpoint crossed let's compile and with this existing event dispatcher we need to call it somewhere in our case i want to call it here and i want to call it only if the racing car crosses the trigger box so here i will delete this drag and drop here on checkpoint cross and in this case i want to call it because i want to trigger this we can connect it like this but if we wanted to check that we are overlapping a car we can get here the other actor in this case this pin overlap component will be the trigger box the other actor is the other actor that overlapped that trigger box and the other component is the excuse me the component inside the actor that caused the collision so here in order to make sure that it's our car we can cast it but we need to know the class of the actor so i'm going to open the car the car should be in the vehicle vehicle template excuse me blueprints and sportscar i'm going to open this and here i see the parent class wield b called pawn so this is the class that i will use so here in the checkpoint other actor cast to wield vehicle pawn which is the same one now is this is if this is true then we can call on checkpoint cross this is a simple validation for now but it will work for us if we compile and try the game nothing will happen why because this event dispatcher is being triggered but nothing is hearing that trigger nothing is registering the trigger the way that event dispatchers work is very similar to a youtube channel here you have the creator this creator will upload videos here's a video and whenever this creator uploads the video notification will go out to only the subscribe users if no one is subscribed no one hears about it the same way if nowhere registers our event then nothing happens in this example the event that will be dispatched is the upload of a new video let's say that someone else subscribes to the to the channel and let's give it a cool hat now this person whenever the creator uploads a new video will receive a notification the fact that this person received a notification doesn't mean that something will happen because they can decide to ignore it or to watch the video but the event was dispatched and notified to the person that was watching or that registered to be subscribed to the creator there could be more than one subscriber and let's give it cool hair here and this will mean that this creator is effectively communicating from one to many and it means that the sender of the message does not know the receivers of the message only the ones that are receiving the message know who the sender is and it's exactly the same in blueprints so let's go back and here this blueprint is the one that is sending the message so the job here is done the one who is receiving the message will be the game mode because i want to trigger this event whenever the line is crossed so what i need to do here because this is the class that is receiving the message is getting the references of the checkpoints the way that we are going to do this here is before the condom is started we are going to have to set up a little bit of stuff so i want to start the content after all the setup is done so let's create a sequence node and these sequence nodes will be very helpful for organizing our nodes first i want to get all the checkpoints that are in my map so get all actors of class the class will be blueprint checkpoint and for each checkpoint i want to do something now each checkpoint should give me time but right now i'm not creating that mechanic so i'm going to leave it by now i just want to have one of those checkpoints be the finish line so i need to know that information and for that i need to store it somewhere so here in the checkpoint i will create a variable called is finish line compile save and by default it will be false now i don't know which checkpoint will be the finish line so in order for me to change it inside the map i need to make this variable instance editable what is an instance well first let's compile and save and if we go to the map we will see that we have the same type of blueprint here but this doesn't mean that they are separate entities i mean they are but they have a common ground which is the blueprint checkpoint whenever i where's my checkpoint let's right click browse asset here it is whenever i drag and drop my checkpoint i'm creating another instance of that blueprint and because my variable is instance editable i can modify it by instance so this could be the finish line and it won't mean that this one is also the finish line if i change this value in the blueprint then it will affect every instance that it's out there in the map so in my case and i don't need this sport card in the game mode racing game i want to check each checkpoint and when i find one that is the finish line so here i'll get the element that is being look at i'll get the finish line and if this is true we can use if or it's also called branch we can divide the execution flow and now we can go through if this is well true and false if this is false if this is true i want to listen to that event dispatcher so what i'm going to do here is array element and i'm going to type the name of the event dispatcher and here i'm going to bind it bind event to on checkpoint cross now i can connect this to an event and whenever this is triggered the event will be executed the event that i want to use is this one the win across the finish line but it makes a mess right so i'll disconnect this by holding alt and click and here i'll just type create event here i'll select win where is it wind cross the finish line and now it's connected now every time this checkpoint that is the finish line is crossed then i will execute the win cross the finish line event because this bind node is making our class listen to this event and trigger in this wing cross the finish line event whenever it gets called which is here that's why we are calling it so let's try it let's press play i crossed the first checkpoint nothing happened the second nothing happened and the third you win now this implementation is assuming that there will only be one finished line but if you manage to check this one then both of them will get registered and now i see to win messages it's just something to take into account now our game has a start and a finish we only need to worry about the obstacles that will be stuff that we'll be adding to the map later on and the mechanics of the game in this case the mechanics the most basic one is driving the second mechanic will be to get extra time from these checkpoints in order to not run out of time and lose the game we will be focusing now on that driving mechanics to tweak the driving mechanics we need to learn a little bit more about the vehicle that we can find here in vehicle template sports card and these are the vehicle assets that the class will use like the torque curve and the wheels assets if you want to do a deep dive on how to customize your vehicles i recommend checking out this video by the good people at unreal engine this video has a lot of chapters and explains a lot of the functionality that you can get out of this plugin because vehicles come with a lot of setup if you want to import your own vehicles and also a lot of setups to get them feeling like you want here at the engine i'll show you the modifications that i did the first one is in the wheels i'll open the front wheel and here i will change the friction force multiplier to 4 and the max tier angle to fit i'm doing this because i'm not liking the way that the car is steering right now so i'm giving it more friction and more angle also in the rear i'm changing the friction force multiplier to 4.5 those are the setups of my wheels so i will close them i will open the car and inside the car i will make some tweaks i want my car to feel fast and there are a lot of things that i can do in order for a car or something to feel like it's moving faster one good trick to make the movement feel fast is in the level design for example if i press play and start going in this direction i'm going at 100 something but i'm not feeling that fast but if i have more of these columns here and i'll duplicate more of them i'll select the four and then i'll drag to duplicate more of them then by the only fact that we have something in our peripheral view it will start feeling like i'm going extremely fast so even though we didn't make any change to the car the level design does help a lot when trying to convey the feeling of going fast let's go back to the car and now let's change stuff that will help me a lot in making this car feel fast the first one is the camera lock we will go here to the spring arm and in the viewport we can see what's happening we have two cameras mesh and i will be working only with the back camera here in the spring arm if i select it i will have something called camera lag and this camera lock if we enable it by default we have a camera speed of 10 and a lag max distance of 50. if i press play i will see how the camera starts losing the car and i if i increase this distance to maybe to 200 i can also feel that it gets more lost the settings that i'm going to use for the camera lag speed is 20. the rotation lag speed 2 and the camera lag max distance will be 1 and we will see why am i setting up this value as 1 in a minute let's go to the event graph and in the event graph i want to modify the camera lag whenever my speed increases so here i will search for the tick event and if you can't find that event you can search it here in graph event graph and event tick right now this template already comes with this car and some things are being done here if this changes in the future then i'm sorry that i can't update the tutorial dynamically but in the comments below probably i'll put an author's note saying what the changes were in the tick here what i want to do is check the speed of my of my car here i know the speed because it is it is being showed in this hat and the way they are calculating that speed if i try to search for it here in blueprints we have a vehicle ui which is a widget blueprint this is umg the unreal motion graphics editor and this let us create hats and interfaces inside unreal so this has two parts the designer which is the actual interface and the graph which can drive code on it so here i want to know how the velocity is being set up so update speed and here i know that well it's checking if it is miles per hour or kilometers is doing some something with these magic numbers that i don't make many sense to me but the way that this is being used is we get the speed it's multiplied and this multiplication is given the actual value so i'll just copy and paste this to my sports car here i'll also create this variable by default it will be false because right now i'm seeing it well let's compile to be able to see the default value right now i'm seeing it as a as kilometers per hour so this being false would be override by me i need to get the velocity and to do that here in the vehicle class it will come with a vehicle movement component i'll drag and drop it and get the forward speed we can get the speed in kilometers or in miles per hour so i'll get the speed in kilometers and multiply it by the numbers that well epic gave us and this will be the actual speed let's print it because i'm in uh in the tick if i just print it like this every text has a duration of two so it will fill up my screen with the speed if i want to avoid that i can set up the duration to zero and now i have one clean value and yes it is reflecting the actual speed that my hat is showing so i think it's okay i'll delete this and with this value what i want to do is check if this value is greater than maybe 80 kilometers per hour then i want to set in this spring arm the value called where is it camera lag max distance so set camera lag max distance and i'll be using again the select node because if this is true let's use a select node for a float select select float pick a if this is true then i want the camera luck to be 10 10 distance and if it isn't i'll just set it up as one if i connect it like this then whenever i cross the 80 value well the 80 kilometers per hour value then our camel our camera lux is making a bit of a jump to avoid that kind of jump what i'm going to do is interpolate to this new value so in the camera lag max distance i'll type interp and here we have a float interrupt 2. so i'm going to choose this one the current value is well i need to get it from the spring arms or get camera black max distance the target one it's the new value that i want to use the delta time i can get it from the tick and the interpolation speed i want it to be very smooth so i'll just put 0.5 and well i'm going to organize this let's press play and see that it it is truly working now when i hit 80 the smoothness is very strong if you want to see a noticeable change right now i can put it to maybe 400 and it should be able to be picked up like this but trust me i just try with 10 because i we will still be adding some stuff now i'm going to arrange these and we will continue them and that's it something that i sped up here is this reroute node it's very useful for organization of the wires you can create one by by double clicking a wire and moving it around or you can right click and search for reroute and it still it should still work now we have this camara lag set up what i also want to setup is the fob if we go to the back camera we will find a field of view property if we change it around for example 140 then we can see how it's affecting our camera and this type of camera makes stuff look very fast so we are going to change this field of view and let me return it to 90. depending on the velocity that we are reaching again i'll use the same boolean if our kilometer per hour reaches more than 880 then we will increase the fob so i'll get the back camera set field of view and here i will connect it and again i will need to interpolate the values the current value i need to get it from the camera so let's get it from the camera and this field of view the target value again i will use a select float connected exactly the same and here the a value will be the 115 this is the value that will be changed when we are going very fast and the normal value should be 90. delta speed should be the same one again we route node by double clicking and the interpolation speed should be again 0.5 so these two matches now with this set field of view note there when i reach 80 i should be able to get a nice deformation in my camera and it should start making it feel a little bit more faster even if we don't have those meshes at the sides so even by driving around here we can see that the camera starts sleeping out of the normal distance great the last touch here in the driving mechanics would be to add a little bit of camera shake to add camera shake whenever we are going fast we need to create here a component and let's call it camera well it's called camera shake source this camera shake source will receive a camera shake asset and we can create one here if we don't want to use these ones that are by default so let's click on plus let's go to my racing game here i'll create a new folder called camera shakes and inside it i'll call this camera shake vehicle well maybe past pico save it and now a new asset has been opened let's compile it safe here again we have the camera shake source in the sports cars pawn and it has been set up the way that we are going to set it up and you can play around a lot with these type of patterns i'm going to choose the purlin noise and we need to define a little bit of these properties the ones that i'm going to touch is the location open the x y on set and here in x would be zero because i don't want the camera going forward and backwards i only want for the camera to go side to side so in y the amplitude will be 70 in frequency will be 3 and in z the amplitude will be 50 and the frequency will be 5. this means the amplitude is just the amount that the camera will be moving side to side or up and down and the frequency is how fast the more value the frequency has the faster it goes rotation i'm not going to use fob i'm not going to use but timing i will if you put zero here it will be an infinite amount if you put one it will be one second now if you put zero for some reason the blending time and the blend of time don't work so what i'm going to do is just put maybe three 3000 seconds just so i can get a good blending time of 8 seconds and a blend of time of 3. otherwise this blend in and blend down time of the effect won't work let's compile and save and we need to activate the camera shake here in the sports car to do that i will use the same comparison here with a reroute node and i will be doing a branch with this branch that i need to connect here something like this and if you want this to be straightened we can select both of them and press the q key or right click and straighten connection so when our things are triggering here we want to start the camera shake source and when this is not being triggered we shouldn't play the camera shake source so here i need to stop all camera shakes i don't want them to stop immediately so they blend out time will work so let's remove this and we can put it like this if we test it maybe things will get a little bit out of control and it's not subtle enough it's very noticeable why because we are telling you to start multiple times we only need to do this once so let's use the node call do once we want to start open and when this is completed it will get closed so we we need to reset it whenever we stop the camera shakes so here before stopping the camera shakes what i'm going to do is add another sequence node and first we will reset it and then we will stop the camera shakes with this let's test our car and whenever we hit 80 the camera shake should start going in hard and it is certainly now like making it that way it's more believable than just shaking the camera by only up and down that if you want to do that you are welcome to you just need to go here in the camera shake remove the blend time and well increase the amplitude here and just press play and try to see what happens now let's just control c everything yeah that's how how it was compile save and now our driving feels a lot better now that we've finished the driving mechanics it would be a good idea to check out the checkpoint and add the extra time that we can gain when we cross the checkpoint i'm gonna close this camera shake the ui for now i will left it leave it there let's go back to the game mode here in the game mode we already have a way of knowing when we are crossing the checkpoint but we are only binding this event whenever the checkpoint has been marked as the finish line that in our case if i remember correctly there are a lot of checkpoints here that have been marked with the finish line here true and because i duplicated it then all of them are marked so so yeah i believe we can select everything and remove the finish line um for now let's just put it at the end for sure i will change this later but i just want to have only one finish line okay now let's go back to the game mode and whenever it is not the finish line we should add some time here start timer duration we know that we start with 10 seconds right yes and this is the countdown perfect so what we can do is create another one of these events bind it and instead of being win cross the finish line could be just add more time and it will be the same thing that we already done here and in our custom event we could add more time now this would mean that the time that i'm going to add here will be the same always and that's not exactly what i want i want to know how much time do i have inside the checkpoint or well if i explain it better i would want to know how much time that checkpoint will give me and i want that time to be able to change per instance so the first thing we need to add here in the blueprint checkpoint is add a variable for the time this checkpoint can give me and for now let's call it time to be we will make this a yeah an integer and by default every checkpoint will give you maybe seven seconds now the same way we have an event dispatcher to know that the checkpoint has been has been crossed we need to create another one that it's going to be pretty similar but not exactly the same so this one will be called on checkpoint crossed and we're going to add at the end with time [Music] and i didn't oh here it is okay perfect but this event dispatcher i need to know this time to give so i'm going to first compile and then i will add an input here in this in the details panel at my right side and that's the integer called well time to give or time to add that probably is a better name and it doesn't matter if this name is the same as this one but i'm just changing it so it's just more understandable and now not only am i going to call the column checkpoint crossed but also the call on checkpoint crossed with time and here the time to add will be time to give and in order for this variable to be editable per instance in the map i'm going to make it also instance editable compile and save so here in the map if i click i can make it a finish line and i can change the time to give now what we just added means that if any other class binds to both of these events then it will get a duplicate dispatcher of the event so we just need to take that in consideration whenever we are using this in our case here in the game mode we are already checking that if is the finish line then we only need to get the event dispatcher that doesn't have the time because we really don't need the time if it's false i will do the same thing bind event on checkpoint crossed with time that it's just up top here oh oops and here i'm in defaults pin connected to here and we also need to create an event and connect it like this now you could have only one event dispatcher one called oh checkpoint cross with time and it doesn't matter we can't have it also here and we will get the time and if this function doesn't use the time well nothing would happen but i like to have a clear distinction of the different functionality that i could have okay so here i'm going to create a matching event and this matching event will come with the same signature and by signature i mean the same inputs so here it will be crossed because for the game well it's just that we are crossing a checkpoint and we will add some time and we can leave it here for now now when i cross the checkpoint i want to add to this timer so what i'm going to do is create a function there will be many cases where you can use events and you can use functions just so we are very clear on which are the main difference of these two types of of ways of adding functionalities the events are not guaranteed to end at the same frame that it is called for example i could add a delay node here and this will mean that whatever code i put here it will be executed after this duration so if i cross a checkpoint this doesn't mean that i will get the all the code that i put here run or executed at the same frame which is why i cannot get a return value from the checkpoint from well excuse me from the events but i can get a return value from the functions here if i select my new function i will have inputs and i will have also outputs because whenever i run a function i'm i have the certainty that whatever code i put here will be executed in the same frame and here if i try to put a delay node i won't be able to do it these are audio effects delayed it's not a delay node so apart from that and a little other small differences sometimes you can use functions or events interchangeable and it's just a matter of design how do you choose to use a function or how do you choose to use an event in my case when i'm manipulating data for example this start timer duration i want to add something i'm manipulating the data i'm reading data writing data i prefer to use functions because i know that whenever i call that function it will be done in the same frame okay so here this function i'm going to get the start timer duration this function will be called add time to could be to timer maybe at time to time as an input i already put one here and i'm going to make it an integer time to add and here i'm just going to add the start timer duration with time to add oh another given um extra functionality of the function is that whenever you have an input here and i'm going to compile just in case is that sometimes it would be very messy to use these nodes this input node because the code could get a lot um a lot bigger right so you can call these inputs like they they were local variables what do you mean by this is that you can type time to add and you can get a node like this even though you have not created this variable because this note is exactly this input so that's a way that you can keep your code cleaner okay so i need to save this value and let's save it here you can hold alt and you drop the set i not sure if i mentioned that already but just in case and this is how i'm adding time to my time timer if i go back to the event graph this cross checkpoint should call my add time to timer and just like that we have added more time to our timer now i want to know the value of the timer and for that it would be a good idea to have a little ui on top of it so we know exactly how much time we have left right it's a good good idea to have one so that's what we are going to add now so let's go back to the hat here it is vehicle ui if you lost it you can search it in the content drawer you can click on content and type vehicle ui here it is and we already have some components well in this case they are not called components they are called widgets so i'm going to create a new widget well i will use the widgets that are already here so we can have our time here also so first you can just drag the text and move it around now i just saw this that this is an overlay so i will need to put my text here and yeah that's pretty much it for now i will later add some padding that yeah that it would be a good thing to to have just like this horizontal box has so 32 let's just keep using 30. now i want to have my text be like oh time remaining here and the numbers here right so i need to organize it vertically so a way to do that is by adding a vertical box this text blocks needs to be inside the text vertical box and we can see the use case of a vertical box here gear and the label and you can see how we can arrange and let me zoom in we can arrange the elements using this and the same with here and this is inside a horizontal box because it is being arranged horizontally so thanks to these panels then we can find them here we can organize our ui very cleanly and i'm going to do just that i'm gonna here in my hierarchy panel and just to break down very simply or very very quickly this is the umg editor the unreal motion graphic editor we have this designer part of the editor here we have the palette of all the the widgets that we can drag and drop images progress bar etc and we also have the hierarchy of the overall design the details panel works exactly the same as in blueprints where we can click on any of these widgets and change their properties and also we have this graph part where we can add some code to change the values right so for now text block right click it wrap with and i'm going to choose a vertical box so now this vertical box is holding my textbook i want to have another text block just like this so i'm going to drag and drop another text on top of the vertical box here so so now i have the text block and the other text block like this i could copy the design of how they are doing this it seems there is some kind of padding here and the gear is different and the font is also different so here i'm going to change the type face to light i believe it was yeah hit slide and i will change the text to time remaining just like that this text block should be in the middle so i'll put it in the middle the same with this one i mean if you put middle or peel horizontally it will be almost the same only if your text is long enough otherwise we cannot stretch text with this feel horizontal so for now i'll just put it like this and in here i will put it on top you won't see that much of a difference now this text block i want to increase it a little bit not that much let's just put zero zero and now we can play around with that with the size and i'm going to choose 40. gonna compile and press play just to see our new new our new widget and now i need to update this this value and there are a lot of ways of connecting the umg and maybe this should be a little bit bigger there are a lot of ways of connecting widgets to data one of them is just by going here bind create the binding and now i need to choose where to get this valley i know that my time is inside my game mode and it's called start timing the start timer duration so in this case i could get game mode cast it and my game mode is called game mode racing game just connect it like this and let's get the timer duration now this is going to be converted to text and here we can set up the number of integral digits maximum interval digis fractional maximum fractionality here i will put zero i don't want any fractions or we could have let's just leave it at three for now let's see how it looks and the game has started this number is not changing and nothing is happening right we can lose because the way we are losing if we remember correctly is just a start timer iteration and we have a timer and because of the way that we are doing things i made a little mistake we are not using this value as the variable that is holding information we are actually using the timer so let's use the timer also in the bake in the vehicle hut so instead of getting this i'm going to get the timer value and here i will get the time well remaining time and connect this route time timer remaining time by height by handle to this value now let's see what happens the timer starts and we can see the values right so let's just put here zero so we get normal numbers and now we can see our time change now it is working right and if i put two maybe it won't minimum fractional also output two just so i'm always getting this information and it is giving me the exact seconds that the timer has and well you if it's minus one it means that the timer is not working so that may be an issue later now what is the issue with this type of implementation as you can see it was very easy to implement but i need to warn you because whenever we are binding this means that every frame this functionality will get evaluated and executed so if we had the time like updating every one second and not with a timer then we will be wasting like if the game is running at 60 frames we will be wasting 59 frames okay so every tick this well yeah this code that is binded is being executed in our case it's fine because it is giving me that exact time that i have and it's a really neat type of animation that gives me without me doing anything makes it like i'm really running out of time and making the the game feel a lot more more dramatic with the time passing but in this case is working very well but again if we didn't have the fractional time we really wouldn't need to update every tick this number because it is showing me the same number right so it wouldn't be wise to you up to use a bind for everything in this case it works but i just wanted to make it clear that not every case will be like that when you're working with ui this is not a ui tutorial this is just a racing game and in our case this work okay so that's pretty much it for the vehicle ui but the thing is that our checkpoints are not working correctly because i messed up with the implementation i mean it gave me more time at first but it was because the timer was not ready yet so what i need to do is reset the timer i need to fix that here in the game mode and specifically where is my cross a checkpoint at time to timer and this is just a setup value and i forgot completely that this is just a set of body so i'm going to get the timer again i'm going to get the time remaining get timer remaining time this and i'm going to add this value to the time to add now we have no way of adding timer to our currently running timer what we just need to do is reset it so that's what we're going to do now we're not setting this we are setting a new timer set timer by event and is design the same exact code that our where is our timer here game start set timer this is time remaining timer it's the same code but we need to connect it again to the loose out of time so we need to give this timer the same time it has now plus the time that we are adding we need to connect it to the event and we can do that by using the create event and now we select the function loss lose hour yeah lose out of time right lose out of time perfect and we do need to set up the variable holding the timer because it is being reseted and put another value so this one will need to be something like this now this is the way that we are adding time now we're adding time to the timer by setting it up again and setting up this valley so now if we compile and save let's press play let's start for the timer to start we cross one checkpoint and it adds seven seconds to our time remaining and as we cross more checkpoints we can see how it adds yeah how it adds more times and we cross the last one we reset the time and there it is now i want to tackle uh something before we pass to the next thing and that would be whenever we run out of time i don't want it to show -1 i would much rather it be zero so let's go back to a vehicle ui and whenever this value is zero well minus one i'll just do something like this if this is less than zero i'm going to select a value so if it's minus zero i will let it be a zero if it isn't then it will pick the b value and it will be the normal value something like this just to just so i don't have to see that minus one value now we can press play and we can wait a little bit so the timer goes down and reaches the the value that i'm trying to avoid which is -1 so it should stay a zero now the only thing that i don't like about this implementation is that right now what i did just now with i'm sorry i need to explain it i'm playing the game right i'm pressing shift f1 to let go of the mouse then i'm clicking here and i'm selecting the object that is currently created in the game otherwise i won't see the notes running so this is my problem with this implementation is that this is being executed even though it will it is always giving me zero so i would i well if i was making this game and well it really depends okay it really depends if i'm making this game and this interface is being used everywhere for sure i wouldn't want this to happen because i'm updating zero for nothing but if immediately after we lose we destroy this interface then i wouldn't worry too much about it because i'm no longer executing this okay so if you wanted to change this type of approach is through events an event based system it is a much robust system because you are in charge of when this is being updated when should we do the updating of the ui but there are a lot of compromises that i don't want to make the video longer just for that and if you want you can come to our discord channel and we could chat about it okay so now this is working let's let me save compile save but the fact that this is working doesn't mean that it is a good experience because whenever i pass a checkpoint i don't have any any indication that the time was added other than the number changing it should maybe flash maybe change color maybe get a little bit bigger or something like that so that's what we are going to do now a little bit of polish to the mechanic that we just added we'll first add the animation and then we will trigger it when the time is added to add an animation in the ui we need to go to the designer and we need to create an animation here animations add an animation and i will call it um time alert this animation whenever i click it will enable my timeline and my timeline i only need to add i only wanted to go from zero to to one but we will see how we do that we first need to select a track well create a track and in the track we will determine what is the widget that we will be affecting so i do need to select the widget that i want to affect in this case the number going to go to animations and with this number which is a text block selected i want to track and select this one text vertical box slot right let's just select text and it's the same name so yeah now with this we are adding this track to our animation and let's click on track what we want to change is the scale and the scale is inside the transform so click on transform and here you will find the scale let's click on the plus sign so we can enter a keyframe and let's enter a new one in this zero value excuse me the one second value if i can click on it okay whoop there it is now with that i'm not thinking i'm not seeing anything but we can first make it grow here at 0.5 and i will make it grow maybe by two and two and you see that it is getting pixelated and that's really not a good look so in order to avoid this what we can do is make it bigger for example this is twice the size right so something like this i'm going to return to my to my designer just by clicking here so we are not longer in the animation or well if we don't no longer want to be in the animation here i need to click outside of the animation and now we are not in the animation and i'm going to increase the font maybe to 100 which is twice the size right and with this now i'm going to first align it to the top and let's go to animations select on time added and here i'm going to change the scale and instead of starting at 1 it will start at 0.5 and here 0.5 now it can increase well i i no longer want this at 2 value i want this at 1. and we won't see the pixelation and this should be at 0.5 also the only trouble that i have now is that it's a little bit um a little bit too far away from our time remaining here so it's not exactly that the look that i i want this to get to have and it doesn't matter what i choose here because right now we are scaling down what we do need to do is put it a little bit higher this is a a way of avoiding the text pixelation but it leaves a little bit to to be desired on the design part so i'll go here to the transform uh where is it transform render transform and i'm going to move it a little bit yeah minus 32 or minus 30 just to be safe here in the animation i'm going to delete this translation keys just select it and delete them and they should be able and also the share that should be able to give me the normal there it is the normal value that i wanted so that's how we are avoiding the text pixelation in a quick manner right so we have this animation if we press play should pop out but also i want to change the color so here in the text block there should be something called color and opacity and inside this well we i want a key at the start and i want the key here that's it and a key at the end the key at the end should be white the key here should be green maybe and the color of green should be red zero green one and blue zero oh and i didn't i didn't put the correct timeline so let me well the correct time frame and again zero zero red zero blue zero there there i have it so now we should have something like this this is the animation part of our of our oh for time remaining let's just click outside of this animation and well the values should be the same as we left them just keep in mind whenever you're changing stuff inside an animation here that it does matter if you have this animation clicked and the values may be changed or you have it outside of the animation and you will see these buttons here to add more tracks for example i could add a shadow offset and that that will make it appear here somewhere if this is selected and i add something and for that it's better if you just dock it in the layout time added show offset and now you should be able to see it appear but i much prefer just changing the values here once i know which the values are now let's trigger this animation whenever the time is added right so i'm going to deselect this animation and for now i'm going to close this tab and i'm going to go back to the graph right now i'm inside this get text function that is being binded to my text i'm going to close it for now and i'm going to add another event at the bottom this event is a custom event will be added time anim and for this we will get the animation that we just created here in variables animations time added get time added and play the animation the target itself the animation is the time added start time zero is fine number of loops one zero loops over and over again forward this is very useful if you need the same animation but backwards we can put it in reverse and playback playback speed is a very important one because this will let us choose how fast or how slow we want this animation that we created that's why i created this animation where is it here from 0 to 1 so whenever i put 2 i know is twice the speed so it will be 0.5 and if i put 0.5 i know it's twice slower so it will be two seconds at the end okay with this we just need to call the play added time animation so let's compile and save to call display at the time and in i need to find out where this vehicle ui has been created and i remember that it's called it is inside the vehicle controller controller here it is vehicle player controller and i'm going to put it here this vehicle player controller inside the event being in play oh and by the way i use ctrl p to open that little window okay so in the even begin play this creates the widget this says that it's well this saves this we widget this hat into this variable and then it is added now we just need to call this whenever we we need it so i'm going to go to the game mode which is the one who knows when to add the time and i'm going to create a sequence note or no it's too much hassle for just one thing here after setting the new timer i want to get this vehicle player controller so let's just get it get player controller the player index will always be zero except whenever you are working in split screen games then you could have the different viewports and this is just the index of the viewport so it will be zero one two three etc for the other type of game single players and online multiplayers zero is okay let's cast this to the vehicle player controller here we're going to get that hat reference get big hat and here we will call the add excuse me play where is it play added time animation and that's how we are going to call that animation now we will press play and let's see what happens when we get more time we cross the first checkpoint there it is and again and again and again again and again and again and again now we know how is our well not how when is our time getting better right it is very very hard to miss actually so we just polished a mechanic that we already had working but this increases the [Music] the enjoyment and the experience well more than enjoyment increases the ease of use of the experience for any type of gamer so let's just save everything and for now let me close all the classes just so we are in the same track we have used the vehicle template which comes with its own game mode and we created one and i'm clicking here in the blueprint button and we can check the game the current game mode which is our racing game and we do not have any overrides here otherwise we would need to choose here select gamemode class and press none and here in the where it says project settings again select gamemode class and select the one that we created which is gaming racing game so with that clear we can proceed with the last part the last part of this tutorial is creating a level and polishing the game i don't want to invest too much time in creating a level because this is not exactly a [Music] game design tutorial excuse me level design tutorial so what i'm going to do is with my programmer powers try to make it a little bit more nice we will use this same track and if you wish to modify the curves you will see that this track is a spline and this spline we can modify it if we go to landscape and here we can select our splines so you could modify it if you would like but in my case i'll just make it look a little bit prettier for now i will get rid of most of these checkpoints let me return to my select mode and now i should be able to select the checkpoints and here they are i'll select all the checkpoints and delete them for now just for now now i want this straight part of the track to be the last part of the track so the end is like a high speed straight something like this so i will put a checkpoint here and i'm using ctrl p and searching for the checkpoint and i'm going to drag and drop it to the map and what happened let me do it again there it is and it should be here yeah perfect now i want to replace these material because i want it to be a little bit more realistic given that our car is a little bit more realistic right so as i said before this will be the last part of the track so i'm going to move this player's start to the new beginning the player start is how the game mode will decide where to spawn our default pawn which in our case is the car so this player start wherever it's pointing to my car will also be looking there and i know that this player start has some scale change to it but you could delete it and add another player start it's in basic player start and right now it says bad size because because it's colliding with the floor but once we do that and i'm pressing the end key here to snap it to the track now it's it's the same but i'm gonna stay with the one that was already in the map if you have more than one player start then it will be randomly placed that the gamemode will choose so with that let's change this material and for that i'm going to add from the quixote content here in the bridge i have already saved here i have should have local or [Music] let me filter it by the hearts that i put in some of these assets oh and i'm not seeing the hearted assets my favorite assets because i have not signed in let me sign in i'll pass the video and we should be back here now i can see the assets that i already favorite now remember that when you add well when you log in with your unreal account or your epic games account you are able to use any of these assets here for free in any of your unreal engine projects so i'll go to favorites and i already have some first surfaces i have this asphalt road and this damaged concrete that i already downloaded i'm using the medium quality i didn't really feel feel the difference with the high quality or highest quality medium qualities fine by me so i'll just select this asset let me go back to favorites it's the alpha asphalt road and the damage concrete let's import it and again and now we have these two folders now for the asphalt well let's use the asphalt road here we already have a material so let's just drag and drop it there we have it and for the sides we will use the other material the damaged concrete and there it is we have now the the new track with the new materials right i also wanted to change this floor i'm going to use a little bit of vegetation so maybe some dirt or [Music] something like that that i can add to this floor for that floor i'm going to go back to bridge surfaces and i added this one called forest floor and well i'll download it again medium quality i don't really need more than that and export it now we have it here and i'll just drag and drop it on the floor now if i'm not seeing it it's because this floor it's a landscape streaming proxy so i need to select the landscape and change the landscape material and i can open this material and we can here change the surface floor grid color etc so this will make us um create a new material well yeah a new material for the for this specific landscape so let's do that let's go to our racing game here we can add the new folder environment inside it let's create a material let's call it racing landscape there we are double click it and now this will be fully rough because i don't want to have to deal with the roughness i'm not going to create a complex landscape material and now i'm going to drag and drop the textures that i will be using for this in my case where is my mega scan surfaces forest floor and here we have i'll probably just use the normal not so much of this other material yeah let's keep it really simple let's start by adding the layer blend and this is not the one that i was looking for this one is called landscape layer blend this is the one for now i will only have one layer which is the dirt let's call it dirt connect this to the base color and connect this one to the normal let's just put it like this save it and now let's apply it to my landscape select the landscape oh and i'm going to here go back to the material browse to it and create a material instance this will be mi racing landscape just so if we manage to add some more properties here it's easier and faster to change them and now here in the landscape let's add the material which is the mi racing landscape now i'm not seeing anything because i need to go to the landscape and here in paint i do need to create this layer information so let's create the layer info and i would need to create this one wait blended layer just select the default folder under the layer info and now we should be able to see it oh and it's entirely my bad because here in these landscape pieces we have not set up the correct material so that's the issue right now let's select the correct material now we should be getting the information that i was looking for which is this material that it's looking very nasty right now so i need to here in the material mess around a little bit with the coordinates and that's what i'm gonna do for that i'm going to get the absolute no it was the word position this is the one i remember it was absolute something with this word position i only need the x and y value so let's add a mask here and i just want the component mask this one so i'm getting the x value r and the y value g that's the only thing i need for these coordinates now we're going to do a little division and the value here will be one constant or just a constant constant one vector you can also press one and click and it's the same and i'm going to convert this into a parameter convert to parameter this will be the dirt tiling value and by default i want it to be 5 1 2 and i will divide this position by this number and i'm going to connect this to the uvs so now you can see the result of what we just done and i need to do the same for the normal so they match now they should be matching now let's save let's go back to the map let's get out of this landscape mode and we can see that it's no longer tiling so badly but we do need to up that number so here in the racing landscape let's browse it browse to it and now open this mi racing landscape i'm going to have it as a floating window just so we can click here on the dirt tiling value and change it to whatever we would like it to be now it won't matter if we can see it from this eagle's eye point of view but if we press play and we are playing then we shouldn't be able to see it that easily maybe it was five one two multiplied by two and that's more than enough i'm using values that are the power of two just to keep the textures consistent and again doesn't matter that it i'm seeing the way it tiles because we won't be able to see it while we are in the car it will be very hard to do that especially when we add more stuff to the track perfect now let's continue with the level decoration for the level decoration i will need more of this bridge well quicksilver assets so let's just close the material for now i don't really need it and i will be using these concrete barriers maybe even these ones yeah i'll add both yeah both yeah both so let's add there's one and again add and there's two i already downloaded downloaded them so it is easier for me to just add them you don't need to see me download them so now we have this concrete barrier that first i want to add some collision to them right now if i see the collision i just double click this is the static mesh editor we can click here show simple collision and there is none so i want to add a box simplified collision yeah that's all i need and here at the right side let's see the collision setup and right now it's blocking everything and the project's default which is fine i'm going to save it and also going to open the other concrete barrier and do the same thing here i know it doesn't have a collision because this remove condition is grayed out so i'll just box simplify collision should be fine if you needed more [Music] something that fits your shape well you can delete the collision here remove collision and play around with these other settings yeah that's a way that you can make it fit a lot more but if you have more tangents more faces then the computer needs to process more stuff so i only need a box collision and in order to peel like i'm colliding with this it's more than enough let's save and what i want to do is with this one that has a arrow i want to oops put them in the in the corners that way when i press play i have something to collide with yeah and if i add some trees later on then i'm not i don't need to worry too much about the collision with the trees and all that stuff i only need to worry about the collision of these concretes concrete barriers so a way that we can do this is well we can manually add the concrete barriers and where's the other one oh and for sure they are too small let's play and check out the oh where did i add them oh there okay i can right click play from here and there they are yeah they are definitely too small this one maybe twice the size would be nice scale i'll put the lock on it so when i press 2 here then it scale uniformly and here 2 also yeah twice the size is fine maybe here 2.5 3 3 times yeah that's a lot better and we could start doing something like this in order for our our level to be created right if i do that eventually i'll would have covered all the the things in my map all the corners all the tracks right but yeah it could be very time consuming so we're gonna create a little tool that will help us decorate this level with this type of barriers let's go to my racing game environment let's create a folder called um barrier um two inside it i will create a blueprint class it's going to be an actor because these barriers are actors this will be a blueprint barrier 2 and inside it i'm going to create a blueprint that will help me just create straight lines this is going to be like a first example of what you can do with blueprints to help you create a level faster so i want to create a mesh here i want to be as optimized as i can at the start because optimizing afterwards gets really troublesome sometimes so if i duplicate a lot of these components having a blueprint that holds maybe 50 hundreds or thousands of components will be very heavy for any type of machine so instead of doing that we have another component called called instance static mesh and this component i'm going to delete the other one this is static mesh this is the static mesh you can select any static mesh for example our concrete barrier and you see that we are not seeing anything but it's because we can add instances of this barrier now i don't remember if i can add manually here rendering instances here it is and it is an instance of this static mesh and whenever we create another one and we move it around a little bit let's just put 100 or something like that then as you see we are not creating another component this component is in charge of dealing with the creation of another mesh and we can drag and drop it to our to our map right now if i remember correctly this should have collisions and we can test it if we play from here and just try to collide with it and they do have collisions so now we only need a way of adding more and adding them in the correct scale so let's fix the scale first let's go back to the carrier tool and we can close this static mesh editor in this barrier tool in the instance static mesh i'm going to change the scale here remember this one was true but keep in mind that if we change this static mesh for our other concrete barrier then it won't match so for now let me just revert this and we are going to create a variable called scale and this will be a vector because you can scale it in x y and z now we will go to the construction script and we are going to drag and drop this instead the static mesh we first want to define which static mesh we want to create here is defined like this but we should be able to change it so let's set static mesh and i'm going to make this new mesh a variable and let's call it mesh to pump i'm going to make it instance editable these eyes are the same as clicking here instance editable and this will let me let's compile save that here in the barrier tool right now that instance where is my blueprint right now this mesh to spawn is none so i'll just put the barrier there compile save it and now we can see it if we select our our blueprint if i can manage to select it here i can search blueprint barrier tool is the yeah it's this one we can change it here also and we want to do the same thing with the scale so let's go back to the barrier tool i'll copy and paste this set scale set scale and we can use this set relative scale it's the same as clicking here and changing the scale here so let me just new scale will be the scale by default it will be two right now is zero let me put two two two compile save and now we have to scale here and i did not want to click here let me click on the rear tool again right here we are in the rear tool we can change the scale independently and it should work right so now i don't want to add manually these barriers right i will go to the barrier tool and here in the instance static mesh i'm going to remove the current instances maybe i'll leave one maybe just to see where it's being created and let me replace this mesh to spawn with the other barrier so two yeah this is the one that i wanted so here i'll just go back to the construction script and the construction script i just realized i didn't explain it is part of the script that will run before the game runs before anything here in the event graph is executed this construction script will run not only that it will run every time any property in my game well excuse me in my blueprint in this blueprint changes so i'll just put here a print this says hello right i'll compile and if i just hop back quickly it will print hello if i move the location it should print hello and we can see the log here hello i'm not seeing it in the screen because well our game is not running right but i'll just clear this log i'll move this around and we should have a lot of hellos i'll create clear it again i'll select again my barrier tool i change this scale maybe by 3 and this construction script is running because a property changed output two again and with that said it's time to create the number of of barriers that i will need first i need the distance that i want to use to create these well these barriers so i need an end point and a finish point the start i said an end and a finish i need a start point and an end point or finish point the start point is well this one it's just fine as it is so i'll just create another vector called and point this vector will also be instance editable and i will put here show 3d widget in the details panel compile and save this will let us see that there's here an endpoint and if we click on it we can move it around so we can define our endpoint now with this we can create the logic that can help us spawn the needed barriers let's go back to the blueprint let's go back to the construction script and this is where the magic will happen so let's do some magic we first need to create the instance mesh just like we did before here instances add one and we will be able to see more instances so we do need to grab again our instance static mesh add instance and you also have add instances but for our case will be just add instance and we'll just put it here this asks us for a transform and it could be in world space but our endpoint is in relative space so if this is maybe i don't know 300 it means that our initial point here is well this part and 300 in x would be where's x here's x something around here so we are not going to use word space coordinates now we need a transform and for that we do need to make one make transform and a transform is a location a rotation and a scale scale will be fine because we are already changing the scale here in the instance static mesh so let's not worry about that but we do need the location and rotation and just by doing this part of the code we can compile and we will see that we have an instance here now let me just remove the instance where is it that i added first and right now we have two instances one that is being added by the construction script and one that we added manually here here the way that i'm going to show this is just by rotating the instance that we're adding towards the location of my endpoint right and to do that i first need to use a node to get this rotation and this node will be defined look at rotation now let's remember that we are in relative space so the start will be the zero zero i can make this a literal or is it literal vector no don't want to or i can just right click and split and we will get the vector 0 0 0. the target is the end point so let's just connect it like this come on there it is endpoint connected like that by doing this if we compile and save wherever we move our end point our mesh will rotate with it so now we can see that we have an extra instance that well it's the instance that we were adding manually here this one so let's just remove it compile save and there it is now every time i move around well i move my endpoint around and we have the space needed to create another one well i want to create another one to do that we need to execute this code as many times as we need so how will we know how many times do we need to execute this code well we first need to know our mesh it's not distance or mesh length so for example if i go to the mesh i selected which is this one we can see the approximate size here and it says three zero four three hundred and four so we're going to use that and i know is that because it's the larger number and it's very easy to recognize which one is the largest number which is x so i need to save that somewhere i'll just create a variable because remember the mesh can change in distance when length or in width so i'll just put with and this is not a vector this will be a float let's compile and save here in the width we can type the same value which is three zero four here it is and be done with it now we are assuming that we are using the x value if you would want to make this a little bit more automatic we can get this mesh to spawn we can get the bounds and inside the bounds we can split this we can get the box extend and the box extent in this case will be half the value of whatever you're seeing here so you would only need to multiply by 2 and you will get the approximate size why am i not doing it like this because maybe our mesh instead of being oh well instead of using the x value maybe i want to use another one so that's why i'm not using this type of implementation that would require for me to content curate the meshes that i'm going to use but in my case i'll just set it up manually it's on i only need to check a number and i only have two meshes that will use this but i'm telling you you can do it automatically also okay so with this width sorted out we can now check right and first we need to know the distance between the starting point which is 0 0 and the end point so we can check how many instances do we need so for that what i would need to do is the end point minus the start point and then i would get the length that way if our point is here and our end point is here let's say that this is the zero zero then by subtracting the start point to the end point i'm not getting all the distance i'm only getting what i need which is this in my case the 0 0 is the start point so i don't need to subtract anything i only need to get the length so i know the value of this distance and i should probably use an another letter for example d the distance so i need to i'll just copy and paste this endpoint get vector length and with this i need to divide it by the width of my mesh why because well i already know this is my start point let me just call it a endpoint b i know the distance between this i just want to know how many meshes can i fit and if my mesh is like i don't know half d then i could fit two so by dividing my total distance by the width then i should be able to get the number of meshes that i could spawn now this is giving me a decimal value which means that if i have a space for two and a half it will return two and a half but i only need integer numbers so i'll just do a floor operation the floor means that it will round down the number if this was two and a half it would run down to just two so now i know how many times do i want to run this add instance okay so let me just move it to the side and whenever you want to repeat some code you will be using any type of loop or while operation in my case a for loop is more than enough and here it is for loop and now if i connect it like this it will run the number of times that i says now right now this is two if i put the first index at zero and last index at as two we are not running this two times because the zero is the first element we are running it three times so we will see what happens we will i will later on change this to one but first let's see what happens compile and right now seems like it's the same but it isn't there are three instances here now i need to change the location per instance so the first time it runs i want for the location to be well at the start so siri is fine but the second time it runs then i don't want the same location so i need to make some adjustments the first issue that i need to address is the rotation because just by adding the width of this mesh to one value maybe x or maybe y won't solve it once off that i want this location it will probably give me this one or this one and i want the one in the middle so to do that we already know the rotation that we are using for our meshes so i'll just find the forward vector of this rotation how will will i find it well just get world war bet with this now i can multiply the distance and it will give a that distance in the correct direction so to just do it and we will later on fix it a little bit we will just get the width multiply it by the times that we have here and this is interchangeable i can just connect it like this and it will still work so for example the first iteration is zero width so it's still in the in the normal place in starting point then iteration number one will be width times one so it will move the width of our mesh and so on and so forth this will be multiplied and i need even more space here by the direction and this direction is the forward vector and now we can connect this to a location because we have multiply a scalar value a number by a direction which is a vector and that gives us a vector with the magnitude that we wanted the magnitude is how big the vector is okay so let's compile and see what happens now and this is what is happening we are getting our [Music] endpoint and when we move it around the values change now why is it not uh exact fit well because our scale has changed let me put the scale back to one and now every time it has space it's created and we have another issue right because i'm creating one at half the point i have the value there shouldn't be any space here and if this doesn't kill you you can leave it there to me it's like oh it's not exact i can't forget about it but right now i would really like to fix it but it would get a little bit more confusing but still i'm going to do it just to give the complete knowledge okay so first thing first let's address the scale because i want to use to scale everywhere so i need to take that in consideration here when we are determining how many instances we want to to create how many loops should this have i need to take in account the scale so before i get the length of this endpoint i need to scale it up to the proper valley so let me move this here so to do that i'll just put endpoint and divide it by the scale and here we have the scale so if it's twice the the size then i'm just dividing it by two something like this now with that let's compile save the scale should be working the same way doesn't matter if it's one of or if it's two right now it doesn't look weird at all now to address the other issue where here is at half value and it's still like creating one like bothers me a little bit so it's a quick fix let's go back to the barrier tool you already fixed the scale we just need to fix our distance problem to do that here before we multi multiply this with to our forward vector that i'm going to put like this and move it to the side what i want to do is subtract some value like this and this issue is happening because the pivot point of my mesh is at the center so i need to take that into account here i will get the width and i will divide it by two and i'm going to subtract like that and let me put this here just so it's a little bit more compact and that's how we fix the width now when we have the space for it it will be created now again we have a little issue because when we do not have space for it one is being created at the zero point so again we have an extra iteration and that's one of the quickest fixes we just need to put the first index one and that's it compile save it and now we can select our endpoint and it will work regardless of of the changes that we did and now it's a little bit more intuitive now i do not like this gap and that's why i didn't want to change the width i mean i didn't want to use the width that i got from the bound box or the bounding box because now i can tweak this like i want so 209 is a fine number so let's use it and now what i need to do is well look around where we have these straight lines and just move it around now we will do something for the or the other for the curves don't worry but for now this has let us create more easily the the barriers or straight lines and we can tweak around the value scale three and three and we don't need to move around staff again our z oh here's three maybe this looks better i don't know i believe i decided three where this was two yeah two and three this one was three so yeah now if i click on the meshes i'm clicking on the instances i can click here on this little icon or just click it in the outliner and then i can modify the overall blueprint and two was fine i believe yeah so what i will do now is add these these barriers to all the straights in my map and continue with the next thing so i have used the tool that we made to create these traits of all those parts of the track and it's very simple you just need to for example get this actor and let's say that this part is a straight bar then you can just move it here change the end point and you're done so i have done that or well all the parts that my track has that are straight in this part because it's a time trial this is the end so you need to check it out as a is the finish line put it at true and because we are starting here when we press play we have this barrier that doesn't allow us to skip stuff so that way when we just go around the circuit and let me just cheat a little bit then we will be here at the last straight full gas and then i win so pretty cool pretty cool we will disguise this some way or the other and also we will hide this but right now we have a good start of our um of our map now we need a tool for the curves and for that we're going to use splines we are also going to use the construction script for that and we're going to use this mesh in specific so let's do it and again if you wanted to change the mesh of this blueprint you can click here change the mesh to the other one and there you have it then you would need to adjust the width to the value that you would like and also the scale so for now let's just not mess around too much with that and let's continue so i need some curves here let's create a blueprint that will allow me that blueprint class actor blueprint curves barrier let's open it and whenever we need curves we will add a component called spline here it is spline and a spline is just a curve you can define the values of the points and the values of the tangents so we will make our our mesh follow this spline so again we do need an instance static mesh because we will add static meshes as many times as the points that we have in the spline so for that here instance a static mesh i will put my other barrier which should be this one no let me close the rear tool the other barrier tool it's the other the concrete barrier is the the lod3 well so create this identifiers okay so we have the correct one we want to add one of these instance for each point that our spline has right now our spline has two points so let's go to the construction script let's why did i close the other barrier because we will copy that that code like this first part of the code let's just copy and paste it here because if i wanted to change the mesh to spawn i should be able to do that oh and i do need the scale right click create variable scale the scale this time will be three because that's it's kind of being tailor made for this concrete barrier but should be able to change if if we if we want now from the spline we want to know how many points does this spline have so i'll just put points and we can add points clear the points get points and there should be a number of points so points get number of spline points this is the number of times that i want my for loop to be executed and this is a for each we don't need that we need a simple for loop now in the case of the spline the points the way they are numbered is something like this let's say we have three points our and our spline is like this this is the point zero the point one the point two so that's why this if we have three points it will give us three but the index the last index should be two so i'm just going to subtract one there we go now in the first iteration i want the first point and i want to get that location and we can get location and yeah the tangent also should be should be good so get location and tangent at spline point now point index is this one coordinate space local is fine and we will add the instance with the instances static mesh component so let's add instance again we do need the instance transform let's just make one make transform and here the location we already have it got it so let's use it compile save and let's drag and drop our curse barrier now i'm not seeing my spline but it is here if you just look around it if we click on the blueprint or any of the instances we are clicking on the overall blueprint here but the spline starts there and well ends here so whenever i move this we can get the location so what i'm going to do is put the start in my case i want this to look inward so i'm going to put the start over here yes here oops and i want to change this spline maybe do the other way here something like that there should be something like that now we can add another spline point by holding alt and dragging the point and as you saw we have the movement and right now i made a little mistake because right now we don't want to scale the overall instance component we only want to scale our mesh so it just matches here so let's go back to the curves barrier and here in the scale i will put the scale and i will delete this part so we have something like this let's compile save and now that our location shouldn't be modified and i'm going to press f to focus the the point we can do something like this and move our splines around now what i want to do with this spline and it seems that i got the direction wrong again so i'll just create it again let's just of course barrier delete it i'll just drag drag it here we have a spline point where is our spline point here so we can create more of this let's just let me select it again and move it like this let me just put a little curve so we can continue with the implementation spline point here i'll press alt and drag it spline point there again span point here and explain point here for now it should be fine what i want to do is rotate it towards the tangent of the spline so we can have a smoother rotation so here in the blueprint curves barrier we need to use this information and to use that information we just need to plug it into a rotation we will get the rotation from the x vector which is fine because that's the one that we are using so it will be something like this and let's see how it looks now now if i modify one of these spline points our barriers will try to accommodate themselves so with that said let's just delete it again put one here there it is that's a lot better where is the spline going towards oh it's that way right where's this plane going that way okay so wherever we move move it i'll select it again and go back here and i'm holding the shift key and moving it around so my camera follows whatever i'm dragging a little nift trick to to navigate the editor better so now we can do this and again deselecting selecting it again so i'm moving the overall blueprint and now it's just a matter of following along holding alt create a new spline point and you follow along the track now remember you have access to the tangents so you can't well you can mess around the individual rotation of any one of these meshes especially the one that will be at the end because there won't be another point you won't be able to touch well to tweak too much of it yeah so probably i'll just speed up this or i'll just pause the video and and do this part of the record because as you see it's time-consuming but it's not as time-consuming as if i was just dragging them dropping them rotating them and using them also this is more memory efficient because we are creating instances of static meshes we are not creating multiple mesh components so it's really a win-win situation for everyone here programmers will be happy artis will be most definitely happy and here for example i will mess around with the tangent the last one just so it's it fits better better and tweak around a little bit of the distances here just so the gap is not that noticeable yeah now if i press play and of course i didn't do the the first corner of course but here's the second one it's working correctly and yeah we do not have that much variance but don't worry we will add some later on we will disguise our our tools but what i wanted to achieve with this is the collisions of my track just so i don't get out of the expected sound of the play of the game excuse me excellent so now i will add the barriers for all the corners now i finished with the positioning of the splines now i won't say it was pretty fast but it again it was a lot faster than just putting them one by one and if later's modification needs to be added then for example here i can put this here hold alt and i can add more points between points so yeah it's it's very useful too perfect so now with that said i already test the collisions and how it's looking and yeah it's working fine actually i was very surprised what i do need to add some it's the the checkpoints right for example i want the timing and let's start for let's wait for the start countdown yeah like oops again i need to see where to add the checkpoints right maybe here would be a good place to add a checkpoint in this curve here and where's my checkpoint actually here it is it's a little small i do need to change that so i'll just ctrl e and make it a little bit bigger and instead of 50 maybe this will be 60 minus 600 would that be good no that's still too small i can check it out here cube move it around here it's like a thousand something or something like this would be nice yeah okay so thousand here thousand and here minus thousands i need to change the box extent of this one to reflect the change should be around here and that's pretty much it yeah that's fine yeah something like that and here was my end one yep should be you can select with this one there yeah great it would be a good idea to change the the checkpoints but i'm going to add them as i see fit so let's play again and i will test it pause test again try it again the game again just so i know that it is doable maybe here i could put another checkpoint and here yeah this straight seems like a good place for a checkpoint here rotate it and a last one here i just have a hunch that those places are good enough for me and now it's just a matter of play testing there it goes i need to disable also the inputs before the countdown starts or well when the countdown ends then we should re-enable the inputs that's a bad bounce that's a bad collision okay it shouldn't be too worrisome hopefully yeah and it's pretty challenging if you're a bad driver like me yeah that's actually pretty cool now it feels like a game now let's decorate those checkpoints what i'm going to do with those is go here the bridge and i'm going to use this japanese wooden well roof yeah let's make it a little bit japanese and maybe something like this this wooden lamp wouldn't bridge let's just use the that one for now i'll open the checkpoint and start replacing these cubes the wooden something should be in 3d assets megascan 3d assets japanese wooden something and here it is now we need we do need to reset the scale well the material and also the scale is being modified here so i'll just reset this to one and the way i'm going to use this is well first put them in the ground zero rotate it a little bit scale it a little bit also and just like that for now yes and let's search it again so i got put it here reset the material scale it 1.75 and also rotate it and the location should be fine this should be zero now if i look at my checkpoints they will look something like that we can make something more complex if you want to call it that by using more assets especially more of these type of assets asian assets could make good mean and let's just use this one upload it we can add more complexity and make it a little a little bit more interesting let's go to the checkpoint again let's add my scene maybe to this cube and i'm going to detach it attach it only to the scene and for example do something like this now let's scale it up and we just need to fake that it's not um floating around and i'll just duplicate this ctrl d and move it to the other side something like this to to give the impression that this is not something oh that one is floating this one is floating like it's not something normal right and this i'll duplicate it ctrl d again move it to the side ctrl d again move it to the side we could probably have done this in only one mesh with the mesh editor but i mean i'm not using that much of these components yeah something like that if i press play should be looking a lot more interesting and now our checkpoints are a little bit more noticeable right so that's another plus for our map now we will add some foliage to our surroundings to do that i need first these trees maybe these ones maybe these other ones i will i will use both his here's the name hornbeam treetrunk let's add it and this one is just called that tree and again add it so here is one the three and this is this one added there it goes perfect so we have those two maybe we can use also these three stamps pine tree and this one no this one don't like that one okay so now that we have these meshes uh let me close everything that i don't need right now ctrl s and save all just in case i'm going to go to the foliage mode and i'm not doing too fancy stuff here in the landscape because as you see i won't be able to see much of the landscape now i'll go to the foliage mode this is my starting zone perfect i need i need to drop some foliage here so i'm going to drop the pine something because this is a static mesh it needs to create a foliage type of asset so just click ok and it will be created also this horn bin tree and the dead tree hopefully they don't clash too much so now that we have our foliage if we paint around we can see that it has been created and the pine tree i do believe i'm not looking how i'm not liking how it's looking now the density is too much so let me reduce it to 0.1 and yeah i don't think i don't know if i don't like the that's tree or if i don't like the pine the pine match with the ground yeah that tree is not not doing it for me okay so i'll just remove the tree by clicking the check we can add them like that again that's two pens for me let's just half it well it's not half is just divided by four yeah that's better and now let's select both of these and play around with the scale here minimum will be maybe 2 and maximum will be 5. now when we paint we have something like that which we should be able to see yeah something like that and it's not too dense what it's a little bit dense yeah it may be too dense so again let's have this that's a lot better actually and i'll just paint nope still too dense i got half it again and well if you're reaching lower values here in the paint density you can also go here in painting and you can select by each one the density that you want or just select both of them and here i'll just put y yeah that's better actually because i'm going to fill let me just undo this let me put 10 or 30. excuse me because i want to actually use some trees but i don't want too much trees because that could affect a lot of the performance because of the materials that they have but these are three stems they are a lot simpler and easier to render so i can populate more of them and the player won't know this too much now this these meshes were added by the default map so maybe i can remove them let's go to the selection select these cylinders and just remove it we have some ramps here again you can select the folder and remove it and i should not have done that let's select everything and just remove it road bumps we don't need them and let's go back to the foliage mode and keep painting also you can increase the brush size so you don't need to paint too much around the same place and for these parts would be a better idea to have a smaller brush and i'm not too upset about this maybe this one's too much but this this one actually blends very good very well with the with the map yep yep now i just need to see in which parts the trees are well the stumps or three trunks are i believe it's it's just this part and this one it's really not believable what you can do here in the foliage is select and modify one by one this one i really like the the fact that it's like this maybe i could move around this let me go back to the select mode move around this area a little bit like oh there was a tree here the tree is also working to block our car and now we have a truck with a lot more trees and here i didn't have that many so let's paint some let's go back to paint there it is and having trees very near to our car should give a very cool effect on the fact that we are going faster because we have stuff going around in our peripheral peripheral site so it can make us believe that we are actually going faster and here this turn should have more trees ah we can leave it like that because we need to add actual trees right so let's do that now to add the trees well we can go to the launcher go to to the marketplace and get some trees quick sell also give us some trees so that's what i'm going to get here in the marketplace i'll search for tree and let's search in the free content i'll just type three and here in price range there should be a free one free i'm so blind here we have maya's country european something this can also work i'll just use the mega scans because i i have my i already have this downloaded so add to project project with the 5.01 show so show all the projects and my project is called my first racing game i believe yeah here it is select the 4.26 and add to the project let's just wait for the trees to be added they are a little bit heavy just in case i i do need to mention that and just in case you were wondering so now it has been added let's go back to the project and in the project there should be is this this one geometry let me search for it it is this one black older geometry and here we have the trees and tree swiss with simple wind we could add the ones with simple wind as a special material that will make the branches move around if your machine can run it without problems by all means add them but in a racing game it's very it's not usual that people will notice this type of detail because no one will stay in place watching the trees because that will mean that you are losing the game see this one has these this nice movement now take in account the triangles taking account the shape the number of materials the number of shaders that are being compiled here if i open one of these ones it should be a little bit lighter but i will use the ones with the wind because we either way we're going to up them optimize them a little bit oh and both of them are the same the thing that changes is the way that the leaves moves one is through a through a pivot painter and the other is just simple wind it was my mistake so okay i'll just use the ones the with simple one let's just close it let's open the foliage again and we need to deactivate everything here and i'm going to drag and drop not these ones not the saplings i want the this first two one it needs to wait for the material to load or well to the mesh to load when the mesh loads the material then i'll save this now i have it here and this one also i could add another one actually maybe this one the zero four and that should be enough okay nice i'll drag and drop it again save it and we have three of them i'll paint the paint density should be fine if i press click there should be only one of them and it's a little bit small so i'll just select them and i'll do the same transformation for them and which is was two and four i believe for five yeah maybe that's too much two and three that's better yeah that's a lot better and i'll just click one click is more than enough if i just move it around too much then you will get a lot of trees very near each other so just to be sure let's density let's change the density to one and i'll just put them here and it's better to just point and click i believe you don't need to fill the inside part of of these parts because well there are already stuff there there are three or three trunks now you will see my fps slowly dropping or maybe vastly dropping and that's because i'm loading a lot of stuff right and most of this stuff i'm not even going to see the detail of it especially because i'm moving fast and also i'm not staying there to search the detail so i will remove some of that details here there should be a whoop and also here yeah that's fine actually now let's go to select you can see that my frames have dropped to 30 if i press play i'm losing a lot of frames hopefully i'm still recording but i have a very nice scene now i do not need this amount of quality i'll go to the trees that i selected which are this d4 d2 and the one and as i told you i don't need that much details unreal already gives us a lot of lods and well this package had also more lods but this can be reconstructed right so lod0 i don't see the difference so the one well i'm i was already in a low d zero hello d1 don't see the difference but the triangles are less low d2 triangles are less no difference l d3 a little bit of difference but a lot less triangles lud4 lod 5 and lod 6 that it's just a blob so i'll just use lod 4 to force that here in lod i could disable it by using custom and just disable it and here in lod picker i can choose also the which one do i want to see which was the the thing that i was doing here but to make the change happen also in the map here in lod settings i can change the lod group maybe to foliage but instead of doing that i'll just put minimum lod instead of 1 this will be 4. so it will always be using led4 and if i go go even further then it will use the lod5 but if i go closer it's still using lod4 you can try with low d4 ld5 maybe and yeah let's try with all of d5 in everything where is it minimum five this can also be negative values if you want to force your mesh to have super quality even if you are out of the lod range so let's just put five in everything and you need to save it let's not forget to save it with that instead of being a 30 fps when i press play we should be regaining some of those fps now we are in 60. and it's running actually kind of fine now you can also test which zones are making your fps drops happen it can affect like oh this curve has a lot of trees maybe i could reduce the number of trees that we are using so our game can run better oh and i already lost i should lose input of that and here i wanted to add something very cool at the end but now we have trees they're looking fine and again with the foliage too you can remove stuff that won't make a difference for example here select this one doesn't really affect the overall look so i could delete it and just like that maybe this one looks a little bit weird just delete it again and just like that we can tweak the overall look and feel and well performance of our game so with trees our track looks a lot better actually but we do need to do something about the the track itself it's too clean for this type of environment in order to have some variations in the asphalt what we are going to do is go into bridge and search for decals here in collections you can find all types decals and you can find a lot of them i favorite some ones well some some of them here is a painted walkplane i'll add that one here it is align an arrow again also i'm adding it asphalt pothole road dust road damage yeah this can also help asphalt patch large as asphalt patch and asphalt patch again but another type of asphalt patch so now we have stuff that we can add to our road in the form of decals this is a starting point so i'm going to add a line here i'll go to the decal folder i'll search for the line this is the arrow this is the work sign i didn't add the line white white road and yeah it seems i like i didn't add it okay so content drawer line now this is our line road here it is you just need to drag and drop it in your level now you do need to scale it so it matches something like that be careful how you scale it otherwise it won't be believable sometimes if you have something like this it's better to just duplicate it and we need the arrow painted arrow i'll just put it oh no that's the texture yeah ctrl c i wanted the material and that arrow is too wide there it goes rotate it and now we can have multiple arrows just like this and we can test now the things with with vehicles is that it affects everything right now you can see the decal affecting my car to avoid that we need to go to the meshes that we do not we do not want to affect like the car our car was like sports car well let's sport car and there should be a blueprint here sports car pawn this this is the one again this is open with control p and let's go to the viewport let's go to the mesh and in the mesh there should be a decal settings to stop it from being affected by decals so here search decal add rendering advanced receive decals let's put it to false compile save it we can close it now play it and now we should not be affected by our decals oh and it it actually could be a better idea instead of having a countdown whenever you cross this line the timer starts actually yeah that actually sounds pretty pretty cool yeah so now let's create some lines but we already have this white line that we can use just to have something in the in the in the road that will be flying through whenever we are working whenever we are going fast oh and we do need to do the same thing here we can just have some where's the this one something like this and i'll just duplicate it something like that so you know that this it's the end or something like that yeah let's add the line here also white road lined just like that rotate it and put our line like this yeah and be careful with this yeah like that is fine these lines can also work as this other kind of lines that are usually go in a parallel manner on this type of roads if i press play from here and i search them oh they are too too big i believe yeah but it gives a knife a nice feeling yeah and they're too too wide actually i'll select with shift come on and i have selected the the track i'm going to deselect it by holding ctrl and click and with this let me just scale it this way now there should that should be a little better now i'm not going to do that for all of the track i believe i have to spend a lot of time in in that what i'm going to do here in this part of the as fault is add some patches like this one i'll just scale it just so i get a little bit more of variations we can avoid this again we need to enter our oh where's our barrier tool instance static mesh decal receives decal complete safe now it it's good and we can add some variations with these types of decal patches like oh that's the texture like this other one you just need to scale it enough so you just don't even realize that something like this is happening and again the player won't even see this so you don't need to waste too much time by by feeling sorry about it or oh it looks wrong or something like that don't worry just kill stuff oh and i do need to open this tool again instance static mesh and i'm open it with ctrl e pretty nifty shortcut again search decal compile save and now it does not affect us another part of the road where that specific decal could work could be here and you can rotate rotate stuff around i'm using the same one in different oops in different parts of the track that are not that very near each other so you don't realize that it's the same one but i do need to play around with the ones that i that i added here i thought i has i had less so that's why i was reusing them a lot something like this here in this part i want to use a the lighter one i believe it's it was this one nope that's not this one where was it road damage maybe yeah not exactly the one that i i wanted to use but let's just use it either way we can use this root damage like this like something happened there i don't know someone crashed something like that who knows who knows but raw dust now that this one is it's pretty good it's pretty good because i can just put it around move it rotate it and it's like another one like this part is very very dirty as long as the pattern doesn't repeat then people won't notice especially if you're going fast you can go the extra mile and get some little rubble meshes to go there but you don't really need to not really necessary here is to clean let's add some more decals and you can you see the point right by adding decals whenever you are going through the through the asphalt is it gives you the impression that it's not that flat so yeah it's another type of experience uh there i for sure there should be a vehicle maybe the the last one the road dust was actually pretty pretty cool something like this and let me hide this part so you don't know that the pattern is repeating perfect okay we have the map decorated with something that i do do want to add yeah something that that i did want to add is some objects to be collided with especially here at the end so we have a way of of not showing that the this should be curved so first i'm going to go back to my favorites i'm going to add some of these assets here and these interactable objects will be these trashcans these cones traffic cone perfect and i had some trash bags but yeah once i do it once yeah i'll do it once and then you for sure you will get how you can add more of these objects so yeah you can also add more things like this trash bags dirty styrofoam etc so let me remove this and the type of objects that i want to add are just so the game is a little bit more harder and a little bit more fun for example we can add these traffic cones traffic cone just drag and drop it to the map i'll press f so i see that dimension and it's really small if i press play i can almost not see it so i'll just scale it up to maybe three i'll move it around and press end so it snaps yeah three is a good size the other thing was this trash can and i'll try scale three and yeah it seems like a good size is it believable that a trashcan will be that size and a cone will be almost the size of my will i believe the cone is alright that brush can maybe a little bit too much so let's reduce it to two a little bit more believable perfect so i need to add some collision to these assets so let's just select them ctrl e collision and this one box collision may be not the best thing to do i'll put yeah this one would be better it's the 18 dop simplified collision save it select the cone and i'll do the same one 18 dop or maybe not 26 that's a lot better but i don't think it's giving me that much of a convert nope nope nope that's yeah 26 stillp could be nice if you want something more custom we can remove the collision go to auto convex collision and here we can decide the number of calls that this collision will have if we apply it for now you will see that the collection is a lot more exact and sometimes this is needed in my case it's not 18dop or nah 26dop should be fine save it perfect now that these objects have have some collision what we can do is select them we will go here to collisions oh excuse me physics and here simulate physics and the same one to the cone now if we press play and we try to collide with them then that happens and it's actually a very fun mechanic so for example if at first i have a lot of these trash cans with these cones here like oh you better avoid this then by going there i'm losing time so it's actually pretty good so i'll just put more of them here like oh you better watch out for this part of the road man there it is and also i want to add this type of collision here at the end so whenever you you finish then you will for sure have to collide with this so i'll just put it manually oops that's not the axis that i wanted now i could also have created a tool for this but i'm only going to do it once and that's it and i should have some cones here well one cone here and i'll just duplicate it like this like oh it's the end of the line down come here and we can select let's just select through the out outliner here just like this and we can duplicate everything and again [Music] and again and again and again with the bridge also we can search something for example given that we were in the japanese mood let's go to the collections let's go to environment where was it tutorial i believe fantasy community let me sir uh japanese shrine here it is we're gonna add something maybe this temple stones actually stones will be very nice for this part like this mossy rock let's just download it and okay these ones i'll add the mossy rock and i'll also add these japanese temple ones so the mossy rock could go here and the temple here it is one the scale is super small mostly rock let's just bump the scale maybe to five or more 10 20. there you go and the temp temple 40. something like that 40 maybe too much third something like this just so the end is not looking that that how to say it that empty yeah and do not create a collision there we can just go here shapes no excuse me volume collision blocking volume this is a volume that blocks our car so at the end of the game we will be here play from here whoops we will be going super sunny speed ahead we'll see the line the finish line and the blocking volume will stop us from going through the rocks nice yeah and that's as much as i'm going to decorate i mean you can you can just copy this oh and they should not be affected by oops ctrl shift shift shift they should not be affected by decals so search here decal receive decals and now we can duplicate this and move it around someplace else like i don't know here rotate them just to make the game a little bit more difficult just don't put them too near each other otherwise it will be very easily noticeable that it's the same pattern hopefully no one realizes that in our game and sometimes people just want to crash so maybe they they just do it for francis okay so that's pretty much it for the decoration part we just need to um start the countdown well i'll get rid of the countdown whenever you cross that line you the countdown the time remaining will start the checkpoints are working well maybe we can add some sounds which should enhance the the experience i should really fix that collision but i won't and i do want to have a end screen whenever you cross the finish line and if i can add a cool sequencer then for sure i will want to do that but at least our map is decorated and here it should really have a line i believe i move it for some reason better save everything don't forget that and let's continue now that we are polishing the game something that we need to address is the sounds right now the game is too quiet and i believe sounds can really make a lot of difference so let's add some let's start with the engine and we're going to use medicines which we do need to activate here in plugins search for medicines and press yes and restart now here my engine has been restarted so if i search for medicines again we should have it activated this will let us create a special type of asset and let's go to my racing game and i'm going to change the color of this so i can find it very quickly and inside it i'm going to create a new folder called audio inside inside audio there will be sound effects and here i will create hearing sounds meta sound source this will be called sound effects engine or well car engine and we are going to open it we will be presented with the metasounds interface which has this on play note on finish and the out audio that will be that we will be able to hear whenever we play this sound also we have some inputs here outputs this is the same thing here we can change the sound volume and pitch which is something that i'm going to do but before i change anything here we need to output a sound in our case we will generate this sound inside this metasound source i'm going to right click here you will find some generators and we will do the saw one okay let's use this one and connect it to the out mono now we want this to keep looping so i'm not going to use the unfinished input or well output or the on play input right now if i press play the volume will be too much so here in the source i'm going to change the value of my volume to 0.3 now if i press play or press spacebar i will see the sound that is being generated by this i'm going to change this frequency and i'm going to here drag and drop and promote it to a graph input what this allows us is that whenever we play spray play here we can change the value of the of this specific input and i'm going to just lower a little bit the sound of on my recording perfect so with this we can play around on how do we want the engine to sound i already know which values i'm going to use and by default this one will be 70. now [Music] it's sounding like that but also i'm going to change the pitch of this medicine so i'm clicking here in source and in pitch i'm going to change it to 0.5 right so now it should be sounding something like this okay and that's it for for this meta sounds card car engine let's use it i'm going to open with ctrl p blueprint well it's called sport car pawn here it is and i'm going to add a new component here for the audio because right now i have my metasome asset selected here it auto completes audio and immediately puts the sound effects i'm going to make sure that this is being auto activated and i'll compile and save everything if we press play we should be hearing the the sound that we created but we do want to modify that sound whenever we are accelerating right and so this frequency needs to change while i'm using my car and that's the thing that we are going to add now let's first add the code in the car and i'm going to go again here in the tick and because this is gameplay stuff what i'm going to do i'm just going to move it a little bit down and here sequence and now i'm going to here add code for all the things that will be using the sounds so for now i'll get this component and i want to change this input frequency so i'm going to set float parameter and the first one is fine just like that here we can add another float and for example if we put here 400 now the value should change but it didn't change because i didn't input the correct name so frequency and now the value changed now what value do i want to use i'm going to get the same cause wheel vehicle component so i'm going to copy and paste it it's weird because if you just drag and drop this one it's not the same one but you can right click and type chaos vehicle and it should be oh excuse me chaos wheel and here it is you can get it like that and with this component i'm going to get the engine rotation speed which is the rpms of our of our car just so we know which rpms we have i'll just put this one at zero and i'm going to print in our example right now we have 900 as a base value and whenever we are accelerating we are reaching like 500 something so maybe i'll use as a start value 900 and the max can i get the max engine engine max rotation speed yeah we can get it like this why do i need the base value and the max value because this parameter will be these frequencies here like and the the values that worked for me was 700 as a base value and another one as a maximum value [Music] so we won't hear the same sound over and over again and we i'm just putting those values as the ones that i got through testing okay so how do we convert this rotation speed into a frequency that we want to use it's easy we'll use a map range clamp connect the float and we need the in values which if you remember correctly the base value of the rpms was 900 and the maximum value of the rotation speed was well this one and we can just connect it like this so we know which one is the maximum value there it is and now here in the outrange these are the input values the ranges of the input here i want for the base value to be 700 and excuse me seventy and this one hundred and fifty that way whenever we press play if we accelerate the frequency should be able to change and every time the those uh let me connect it again engine rotation speed every time this value changes our frequency will change so it's pretty cool right that's actually very very cool but we do need to do something about the fact that if we go backwards i'm getting like the sound like if i was accelerating forward so we do need to change that so the way we're going to handle that is through looking what value does our break has now we have two types of break where is my inputs here if i move forward but in a negative axis like pressing in my keyboard s this will set the break input and the other one is if i use the handbrake which sets the handrail input i'm going to use this break input so here before we do any of this i'm going to get the break input with this component and it's not break it's this type of break get brake input and i need to connect this here right the brake input by default just give me zero and one and this is happening because i'm not using a joystick or any kind of other input i'm just using keys so i only know if if if it is fully pressed or not right so with this what i want to do is change the pitch multiplier of this engine so i'm going to drag this again set pitch multiplier and let's connect this here the way i want to change this is that when this is zero i want to leave it at one so again i'm going to use a map range and it's clamped because i do not want it to escape from the out range values if it was unclamped if this maybe escapes by two times the the out range then this also would change so here i only have zero and one when it's zero i want it to be one and when it's one when we are breaking i want it to be 0.4 so it gets a little bit a little bit lower and yeah we'll see what's happening now let's press play i go backwards and it gets lower i go forwards it's normal i press s it is changing but it's changing too much for my for my taste so i want this change to be interpolated so it's a lot smoother so let's just float interp2 the current value will be well this sfx component holds the value of the pitch multiplier so get pitch multiplier and this one is the current value nice now the target value is this map range the delta time is well this delta seconds so let's just grab it from here and interpolation speed i will put one so it's a little bit slow now with this let's arrange it like that with that we can press play now work correctly when i go backwards yeah it's a lot smoother the sound is a lot smoother and let me bump it up a little bit so it's easier to be heard perfect now this adds the extra functionality that when i'm breaking [Music] the revs the sound of the engine also changes which is very nice and i'm going to get rid of those values i'm going to put this here and what else do i need to add in terms of sound let me just put this here so it's not looking that badly i'm using reroutes reroute nodes again by double clicking on on top of the wires okay so a sound that also we need to add is the breaking sound when we are using the android because that's not affecting our engine sound and it should be a little bit different so let me save everything and i can close this i'll save it and i'll close that let's add now a sound for when you hand brake and the car skids around for that i try to create one in meta sounds but i end up downloading one from here it's called break resound is a web page resound.org where you can create a free account and start downloading well three sounds you need to take in account licenses but most of the time they are very open so yeah you just download it and you will get this file and i just rename it to break dot wab well the format was already like that and you can play it to see how how it sounds yeah that's pretty much it i need to import it now to my to my game so i can put it right here next to the meta sounds and depending on how much sounds you're going to add it would be wise to create a folder in my case i only have these these two sounds maybe i'll create that or more but now i have it and i'm going to call this because it's a sound wave right if i double click it pink audio as a sound wave i'll just call it sound wave break and i can hear it in in engine but i also want to create another metasound asset medicine source again and i'll call it sfx brake and car break would be better i'll open it and we'll save everything now this medicine asset is different from the other one because we are not generating the sound we are playing one so we need a wave player and here it is we need a wave asset which is the sound wave break and we need to determine the out output the out audio and the output on finish and on play so whenever i press play which should be like this i want to play this wave player and whenever it finishes i want to finish the sound if i press play nothing is happening because i have not connected this audio output now because because this is a wave player we have a left and right out this is a stereotype of output but right now we are outputting mono you can change the way we are outputting things here output format stereo maybe in the future we will get 7.1 but for now we only have this why am i using mono because the audio i really don't need to hear it in the left or the right because the engine will be in charge of specializing that that sound in charge of that specialization of where should the sound play and then i could hear it from my left side or my right side so i'll just merge these two you can just add it like this or if you want to have more control on the volumes you can just mix them on a mixer too and you can change the gain levels here okay so now i if i press play i should be able to hear the wave player now whenever i break this will be playing endlessly so it i would need to loop it and here we have the loop check box and now we have that sound now i don't want to hear the same sound every time i break so we will create little pitch variation and for that well we can change this pitch shift for example minus 14 and whenever you're pitching it down you will see that the audio is a little bit slower and if you pitch it up it will be faster just take that in consideration so what i want to do is generate a num random number here every time we play so here i'll just press random and if you just if you just type random here you will need to choose with which type do you need so it may be better if we just drag from the pitch shift which is a float now and let's just type random now we need to generate this so whenever we press play this will be next and whenever this gets generated we can finally play now the minimum value i already tested some of these values and minus 14 and minus 18. and let's play let's play again and the pitch varies and you can play with the with the numbers with the frequency numbers those i liked these ones and also you can expose them like like we did before here and then we can change it in the blueprint but i'll just leave it like this i'll save this go to my sports car pawn and now i need to know when to play these files now here i'm in the tick and in the same tick after the thing we did here with the frequency of the car engine what i will do is change or well check if our tires can play the sound and i want to play that sound specifically when they are sleeping and by sleeping i don't mean like snoozing let's just do it copy copy this and we can get the state of the tires so get wheel it's paid here we have an index we can use the uh this index to select the the wheel that we want to create the front ones are zero and one and the ones that i want which are the back ones are one and i'll duplicate this and two now i have a lot of information that i can get with these wheels so i'll just oh i'll just break this this structure and i'll do the same here like so and here i know if my wheels are sleeping or are skidding the one that worked very well for me was is sleeping so i'm going to use that and again you can deep dive in what everything here means if you watch the the unreal video that i showcase at the start they talk a lot about the things that you can do and it's a small video so there is also a lot of information that you can use so whenever any one of these wheels is sleeping i'll just use an or boolean so it doesn't matter if this is true or this is false one of them must be true and this will be true so if one of them any of them fulfills the the true value then what i'm going to do is play this sound because this sound will be played also very frequently and i have it selected here i'll select my car break i'm also going to add an audio component so let's select the blueprint itself and add an audio and should be autocompleted because i have the asset selected so now with this i can play the sound right before doing that let's remember that by default this is auto activated here it is auto activate so it means that if i press play i will be hearing the sound every time so let's deactivate that put the auto activating false and now here i'll just play and if i choose this one it's going to create the same variable but it's okay and whenever none of these are sleeping then i'll just here stop it now i don't want to to break your ears or your listening or do some harm to your ears so instead of just testing it i can tell you right now that there is a little bit of a problem here because once the any one of these tires enters this state it will keep trying to play the audio so we only need to do it once because here in the meta sound whenever we play it once we are already looping it so here i'll just add a do once and whenever it's false then i want to reset this so i'll just create a little sequence and i'll reset this here and then i'll stop my logic now whenever our tires start sleeping well we will play the sound and we can see how that sounds [Music] i'll use a handbrake [Music] perfect [Music] should be there it is whenever i go into greater velocities then it's a lot easier for the car to start sleeping also works when you just break [Music] yeah so now we have the the sound of the brake working like that and yeah that's pretty much the implementation that i wanted to do here oh and i made a little mistake here zeron1 like i told you was the the wheels on the front i needed to use two and three so this one should be three and that that could be why it was not playing sometimes when i was praying [Music] yeah now it's working grips ah that was it yeah it was weird because i already tested this and it was working correctly for me excellent given that we are already in the car blueprint it would be a good idea to add some crash sounds i also got this crash sound from free sounds the dork this is the name i can play it and that's the sound that i will be using i already download it and rename it like this so i need to import it again i'll just drag and drop it's asking me if i want to use the sound wave already there as a template for the sounds being imported and i'll just press no now we have the crash this one will be also sw crash i also need to create a meta sounds medicine source and this one will be car crash and we're doing something very similar to the to the last one so again i'll well i can just copy and paste this it's the same thing here play finished like this like this and now we do need to change this wave asset let's use the crash and let's save everything but i do not want this to loop i do want it for the pitch to be random and the values that i'll be using is minus eight and four and not minus four just four now if i press play it will always be a different kind of crash sound and that's all the setup that i need to do here let's save this and let's go back to the sports car palm now here is the tricky part because i'm not going to use the tick for that i don't want to check every tick if my car is colliding with something so here in the viewport i can select the mesh of the car with the mesh of the car i can add an event and we will use the hit event on component hit because a hit is a collision between two blocking actors or meshes or components so whenever you cannot overlap one of the components or actors that are colliding then you will get a hit so here just to test this we can play and no hit why is this happening because we need for the mesh itself and the collision itself to give me those hits so here in the collisions where are those collisions i need to have this checked simulation generates hit events this should work but for us for some reason it doesn't the way i made it work was that i needed to open the skeletal mesh of the car go to the physics asset select this collision which is the actual collision of the car the body and here i'll add the simulation generates hit events with that added and let me save it let's i'll press alt p so i'm playing the game immediately i touch the walls and it prints hello now the thing is is that a heat event is very sensitive if i just touch one of these i'll just touch one of the cones as long as i'm hitting it it's triggering so i need to find a way of of not triggering too many times that hit event and i'm going to close this part also this one why because if i'm triggering this print string [Music] many times it would mean that if i had here a play sound note it will reproduce and it will play hundreds of time so that's not another thing that i would want to do so what we'll do here is just play play a sound at location and select our car crash and the location will be the actor location which is the car location and please do not press play yet otherwise this sound will be play a lot of times like you saw this print string right so now oh and i'll i'll just leave the string what i will do is create a little array hearing variables and i will call it collided actors change it to actor object reference and here in the details panel change it to an array so now we can have a list of the actors that i have already collided so whenever i collide with something i want to add them to my list so let's say we print the string we play the sound and then we add the actor that we collided with let's just add it to my array and it's this other actor that i want to add to this array perfect now before adding something to our to this array i want to know if it's already in the array so what i will do is i'm gonna get the collided actors array again i'm gonna try to find the item like this and if i don't find it like it says here it will return minus one so i just need to validate if this is less than zero it means that it's minus one if it is less than 0 then for sure it's not inside the array so let's just run the code that i have here by doing this if i press play and i touch this one the sound triggers but if i collide it again it doesn't because it's already in the array so i'll just solve this very nicely by just creating a timer and every i don't know one second that we haven't hit anything we will reset this collide adapter so i'll just create here custom event called clear collided actors and the code is very simple just call clear that's it but i do need to call this after one second that this has been triggered so here i'll just at the end i'll create a timer set timer by event this time will be one second it won't loop and the event that i want to connect or that i want to trigger after one second is this one now you can do it like this but if if you don't like that the wire is hanging like that and it gets on your nerves you can also create event and here you can select the event that matches with the with a function that can support a timer which is any type of function or event that doesn't have input inputs parameters so here it is clear collide adapters now the thing is that whenever this gets called again if there was already a timer here then that timer will be reset it because i'm connecting a timer to the same event so i won't worry too much about it i mean we could create a variable here and control it a little bit better but for now this is enough okay so what i will do here is just test it because that's that's pretty much it pressing forward then nothing happens so now we have the crash sounds [Music] and it's a lot better what i want to add here is whenever we crash have some [Music] some camera shake also so let's do that now i have already covered how to add camera shakes so at least that part will be very fast so let's just create the camera shakes here camera shakes i'll just called a new blueprint class all classes camera shake bass not the source actor this one camera shake bass and i will create the camera shake for a hit from the bottom and a hit from the sides so let's create the bottom one first this is camera shake and i'll select everything with with ctrl a again camera shake car or um bottom vehicle bottom crush and i'm calling it like this so it like it makes sense in terms of naming so inside it again i'll just add a fairly noise camera shake pattern and here i'll leave this to one x will be zero y will be zero and c will be five thousand the frequency i can leave it like that that the duration 0.4 and the blend time that in blend time will be zero so it's like very uh not very bad it will be a lot more violent that if i just blend it in okay so this is for the bottom crush vehicle this is the camera shake asset that i will use and i will duplicate it call it camera shake sides or side crush big and maybe it would be better if i just put crash before button crash button and here oops crash why would it be better because i can find the crashes very easily because they are next each other so now let's open the side one and in the case of the side the x should be in zero x is forward and backwards y should be 500 5000 and z will be zero i see could be let's just add a little bit of this yeah something like that and this other value this is fine 0.4 this is fine compile and save we can close it and now let's use it to use it we already have this on component hit mesh and we need to not only play a sound but also play the camera shake and for that i'm going to make my my notes my other notes be a little bit so we already have a camera shake source here so let's use it and this camera shake source will be start and it will not only be start it will be start camera shake that is so we can set up the class and i'm going to press ctrl and drag to reorganize my wires the camera shake class will be cross bottom or crash site now we need to decide which one of these two we want to play the way we're going to do that is with this information that the hit give us which is the normal impulse if we just connect the normal input here to my print string to see what that looks like whenever i'm crashing i will see that we have values in x and values in y and not any value in 0 c i will only get values there if the crash happens like that where my car gets a little bit and then when i collide then that's only the c value had something to say about it right so with that what i'm going to compare by using a dot product is i'm going to compare these normal inputs with the c axis like this this value just to give it a little bit of explanation like it says returns a dot product that that product is the relationship between the direction of the of two vectors so if the vector is i'm comparing this vector and this vector okay well if this is completely perpendicular this will be zero is if both vectors and remember i'm using the c vector and let's say my normal impulse is like this then they are kind of going in the same direction so it will be a value between 1 and zero if this other vector was going downwards but it's exactly parallel it will be -1 exactly if it's completely parallel like this then this will return a one value and well we're going to use that to know if the vector is going upwards or not i'm going to use [Music] 0.5 so i'm going to detect every vector that is going this way something like this this could be the midpoint so i'm going to detect from here from here to here and i will do the same for the other side like this and these values should be between um 0.5 and 1 and the other ones let me just delete that the ones here should be from minus 0.5 and -1 so to get rid of any symbol i'll just create this note which will give me the absolute value so if it is negative it becomes positive and if it is positive it remains the same and now i'm going to ask if it's greater than 0.5 if it is then i want to play and i need to put this near my camera shake okay so if this is true then i want to play the crash from the bottom because it's going in the direction of the c axis so i'm going to here type select and connect this boolean value to the wildcard so if it is true i want to play the bottom vehicle crash and if it is false then the crash site big just like that and i'm going to connect arrange this like this is fine now if we crash from the sides our camera should only move side to side and if we press from the bottom then our camera won't move side to side but i need to pick up a little bit of speed like that one you see that whenever we crash from from the bottom or well near with the actual racetrack then the camera was going upwards and when whenever we're crashing it only goes to the side now it is random so if you want to create like oh i crashed from the left side and the crash from the right side i could do that and you would use a logic very similar to this one and let's just remove this and i'll also remove the print string and i can put the collided actors here you will lose a you will use a logic similar to this one but instead of comparing the c value you could compare the x one if you want front and and back and the y value something like this like oh zero like that if you want left and right there it is so with this we have added the sound and the camera shake when my car crashes the last sound that i want to add is whenever you cross a checkpoint we have already polished our car enough so let's just maybe add some comments crash sfx and camera shakes oh and also i need to fix a little something because right now if i press play this star camera shake is set in the class to either one of these and whenever where is our here is our tick where is our camera shake this one instead of just choosing start here in remember tick and we're changing the field of view and we are adding some camera shake here what i'm going to do here is stop stop excuse me start camera shake i'll delete this and i will assign the correct one here the fast vehicle camera shake otherwise whenever this would be trigger we will be playing the camera shake that should happen only when you crash okay so now that should be out of the way let's save and we can close yeah let's close this sports pawn sports car pawn let's create the sound effects for the checkpoint and for this one we will only be using metasome generators so sound effects checkpoint crossed let's open it and we are going to again generate uh use those generators this one is the triangle generator and let's save everything i'll save all i'll connect the audio to out mono and if i press play it will give me that sound we can change the frequency and that way we can create new sounds now i noticed maybe that my engine was a little bit louder but for now i will leave it like that we can modify the volumes later so here on play i don't want to loop this sound like for example right now our unfinish is on the open so if i just press play the sound will remain playing over and over again for this part we need to create a little bit of a delay trigger delay so if it is one for example and let me put a nicer sound maybe another one so aggressive we just delay this unfinished valley one second one second passes and it ends so what i'm going to do here is create it will be a simple simple sound first this frequency i will turn it into a variable not a graph input a graph variable and that's all i have to do for this part now whenever we have this trigger delay we want to set up a new float value for this frequency so here i'll just set value no value here it is value float the initial value of my frequency i will be using 1800 and the target value will be 1200 the output value will be this frequency so i can drag and drop it and here it says set by shift drop so let's hold shift and there it is output value connect it like this and now the [Music] i want to play a sound again or well now that the frequencies change i want to wait a little bit so a sound can be heard so i'm going to copy and paste this trigger delay and onset in and out here something like this and the timing of the notes i want just i want it to be very fast like 0.1 and 0.1 with this we can press play and that will be my sound whenever i cross a checkpoint you can change these values if you want to change the the notes that you will be using and but for me this is more than enough also you can use the same approach that we we did for the other ones like this one where you have a sound already downloaded that you can plug in and that's it okay so let's use this checkpoint cross sound blueprint checkpoint when it got hanged there i'll just pause and i'll talk to you in a minute okay it didn't crash so we are good here in the blueprint checkpoint what i'm going to add on the on component begin overlap it's just play a sound 2d a two-dimensional sound is a sound that you will always be able to hear and this is the case because i really don't want to hear the sound on the space of the game i always want to hear it i really don't want to hear it louder if i'm closer or quieter if i'm farther so this is very useful for ui sounds and in in in my case sounds that are very important for gameplay so let's use checkpoint cross and now compile and save and every time i'll pass a checkpoint we should be able to hear the sound [Music] first checkpoint there it is so it does work compile and save perfect now another thing that i notice and that we need to also fix or polish is the fact that if i have a checkpoint here and i'll disable the sound of the engine oops i close the the checkpoint let me just disable the sound of the engine so my voice is clearer otherwise i would need to edit a lot of stuff car engine let me put it at volume 0 for now perfect so i'll just drag and drop a checkpoint here one exploit that i found was that if i cross a checkpoint and i cross it again i get the the value so this should be only a one time use and just in case i'll create a variable integer could be a number of uses this will be instance editable maybe if i need it i really don't know if i i do need it and whenever we want to trigger this part i will first ask if my current number of uses which i have not created yet if my i'll just type number if my current number of uses is greater or equal to the number of uses left then i should not be able to use the checkpoint so i will use the current number of uses is less than the number of uses and then this kind of logic should work as soon as this passes i do need to add one to the number of uses and i will use this node called increment int which is plus plus so now if by default the number of uses is one and i do need to put one here and the current number of users starts at zero then whenever i cross a checkpoint and i want to cross it again it won't trigger so that's pretty good and with that we get rid of the problem of overall using our checkpoints perfect now we are in the final stretch we just need to validate whenever the game starts i want to change the way the logic works and let me save everything and close the the classes that i don't need i also do not need the bridge anymore let me save everything and for starters i want this countdown to not happen i want to cross this line and then i want the game to start so for that i'll go to the game mode and how did i call my game mode it was gm something right yes racing game and here let's go to the event graph and start countdown instead of just starting condom i'll just go to an idle state like preparing phase or something like that just so i don't need to delete this because maybe i will use it in the future i really don't know because i'll just create a custom event and call it pre race and i'll just put a print string in pre-race state instead of starting countdown i'll just enter the pre-race state and to start the game there's already a game start so here in the map i'll just create a trigger volume here where are my volumes where is my not blocking volume trigger volume here it is and i i'll just put it in the ground with well let me just scale it first like that press the end key and put it in the ground move it here and scale it to the side so for sure it will be considered great now i will go to the [Music] where is my level blueprint and we haven't talked about the level blueprint by default oh it seems that there was already code in this vehicle example map but a little blueprint is a blueprint exclusively to the level and it doesn't have a viewport or a construction script because we will have access to every actor that exists inside the level for example we just need to select it i'll just select my trigger volume and now in my level blueprint i can right click i can create a reference to the trigger volume or better yet i can add an event for the collision begin overlap and what this will do is get the gamemode i do need to cast it to my gamemode and then just call race start or game start i believe it was yeah game start compile save press play and now we start the game as soon as we cross that line a thing to have in consideration is that if you create another map the maps does not share the level blueprint so this will be completely empty if you're facing this type of issue where you're having to add this code every time you create a map which is the thing that will be able to happen or it's most likely that it's gonna going to happen it would be better to create a blueprint that had this trigger and that blueprint always called the game mode and always starts the race i'm doing it like this because i also wanted to show the level blueprint that you can use inside unreal engine 5 and well 4 for that matter rate we have changed the way that our game starts but now we should change the way that our game finishes first let's close the level blueprint i know this is a little blueprint because it says so here and in the gamemode we have a way to know when the game finishes either by losing or by winning in my case doesn't matter what happens what i want to do is remove the input to do that we can call disable input if i'm not seeing it is because i need something to disable and the game mode is not something that can be disabled because it doesn't receive input so let's get first the pawn and with this pawn disable input it is asking me for a player controller so let's get layer controller let's compile and save and i can right click and play from here and the thing about this is that if whenever i disable the inputs the inputs that are currently in [Music] in use will get stuck there for example if i'm accelerating my input has been disabled and i cannot stop accelerating and also click from here again if i was turning then doesn't matter what i do now it's still running and going forward so the inputs are disabled but not exactly the ones that i needed also if you had more inputs in your player controller that is not our case our case is inside the player pawn you should also do something like this so stuff here inside the player controller are also the same right so let's fix this in this case what i'm going to do is well get um no let's just cast it to my chaos oh let's just cast it to the sports car then yeah otherwise because to vehicle will vehicle pawn what i want to change is the steering value set or well the throttle set throttle input if i can do the same thing with this it would be better that seems like it's okay set throttle input to zero just like that and you will see that in our sports card those are being set up here move forward set throttle input and that so with that i believe that we should stop let's just play from here and i'll keep going forward yeah the throttle input has been changed to zero so everything is good now one thing that i could also change is to start braking which yeah should be a nice addition let's start breaking set breaking input to 1 and also set steering input to 1 also that way look what's going to happen now if i pre play from here and i get some speed as soon as i cross the finish line my car will start steering to one of the sides oh i did not anticipate that the break will go make me go backwards so instead of set break input set hand brake input true maybe this could give us a nice drift and let's say i'm playing from here and i'm going super fast and that's the end ah that looks very cool so nice so so nice okay so we are we have removed the input we have added that cool addition what we could do also is have a new camera that can and maybe even play a little animation in sequencer for that let's create a sequence here in my racing game i'll create a new folder and cinematics inside it new folder let's just call it end sequence and yeah i'll create the sequencer asset and i need to do it here at level sequence select my racing game cinematics and sequence and this will will be called win sequence save and now i need to add a camera here create a new camera and set it as the current camera cut this is not a sequencer tutorial so i'll just show you around how to do some stuff but not necessarily explain everything about sequencer so by doing clicking that now we have a camera that is looking here and a cool shot could be something like this we start here with a transform let's create a new key and let's move it around here and i don't want to collide with that maybe like this and i i messed up because i needed to move this before before moving my camera so what i'm going to do here is this something like that okay so let's create a key new key and you can also press enter and we can see how it's looking if i press play here yeah it may be a little too fast so i'm going to move it at the end of this sequence and it should be a little bit slower now i really don't know how fast or how slow my car will be going but at least i have a sequence that i can use so let's just save it and let's go out of this sequencer we can close it and we are out of it and we have the level sequence here added the win sequence what i want to do here is that whenever we win the game and where is the can finish cross the finish line here in game finish we could create the cinematic for example here this is the all the code that we done for the input we can create a little sequence here and here we will be playing a level level sequence now the way that this works is first it needs to be in the level second just to have a little identifier what i'm going to do here is add a little tag to it and where is my tags autoplay needs to be false so it doesn't autoplay here i'll search tag in tags i'll add the text win and now what i'm going to do here in my racing game because this tutorial has been going long enough i could trigger it in the level blueprint or here in the game mode i can search for the sequence like this search the search find all actors fine actors of class excuse me or actor get all the actors of class excuse me the class is level sequence level sequence actor this is the one now i need to search for every sequence level sequence that is in the level and i need to check like get tagged i want to search if we have the winning tag here now i'll press find item and to know which tag do we want i need to first well [Music] know if we are winning or not so i need to do something like this and i'm just going to select here and connect my winning input just like that if it's true if we want here i'll create a literal text well name and call it win which is the same tag that i assigned to this one so if we find that tag inside my actor then for sure this will be zero or more so if it's greater or equal than zero then we are fine so if we find it i want to play it play just like this i'll do something like this so it doesn't get too confusing there it is okay so now this is searching all the actors of the type of level sequencer this is searching well getting all the actors and individually checking if one of them has this stack and if one of them has it then we play it again we are assuming that only one of these sequences will have a win tag so let's just save everything compile and let's press play from here i'm assuming this is correct if it isn't then we can we can debug it a little bit yeah and it's too slow and i don't know what i was thinking so i'll just click on the sequence and in order to open the sequencer again we can just click here win sequence and we have it now i'll just put this at 100 frames test it again and i can i can close the sequencer again it may be just to slow still but then i will do a little change so it's a little bit faster yeah it's too slow so i can click on my level sequence and here i i'll remove this stack search in the play rate i will put three times the speed and now should be more than fast enough going from here and now oh that's pretty cool that's actually pretty pretty cool now when it finished it gave me back the the control so i'll just put here pulse at the end and now we have a way to end the game in style right so let's let's check it out oh so cool so cool perfect perfect perfect the last thing that i want to do for our game is that whenever we lose or whenever we win i want to stop the engine sound because i just reactivate it here and if i press play and our time ends then our engine will keep keep playing yeah and that's not right so let's just go to the game mode again here we were setting the throttle the handbrake and now i will need to [Music] get again the player bound cast it to my sports car get the audio component which was engine this one and press stop well call stop that way whenever we finish the game and again i lost the finish line where is it here it is from here cross the finish line and the sound stops now we could add a little interface to say oh you won click here restart you you lost click here restart and i mean the tutorial is long enough though how many hours is it oh five hours yeah let's do it let's do it it's it's simple that's it okay so let's create the interface for the lost and the interface for when you win right and let me save everything will be very very fast again like sequencer i'm not going to explain everything that you can do in in umd which is the way that we can create interfaces like this user interface widget let me create our folder called interplay no interface ui this one will be called um user interface widget blueprint user widget let's call it widget blueprint um [Music] windscreen this windscreen we need to position stuff on it so let's use panels panels allow allow us to organize stuff on the screen i'm i'm going to use a canvas panel here in my canvas panel i'll put a text where's my text like this this text will say you win i'm going to center it or i'll just come i can precise to content also it's fine now this this umg editor lets us be able to know what would happen if our screen is resized which can happen and if you are developing something from mobiles it will happen so it's important to anchor it to some place that will make sense for example if this was at this site if we resize it we will lose it but if we anchor it to the right side here then it will adapt because it will try to maintain this distance having said that this one i'll anchor it in the middle position zero zero again the alignment will be 0.5 and i didn't put 0.5 0.5 and let's increase the text size you win i want a button here so i'll just drag and drop a button this button i will anchor it to the lower side of the of this the alignment will be again 0.5 x will be zero and i'm going to put a text inside it then i'll make make the button a lot bigger like this again we set the position text plot will be restart game with this maybe the text should be a little bit bigger maybe 35 there you go you win restart game we want to click this button and do something to do that well let's just click on it and here in the details panel just like in blueprints with when we're working with components these are not components these are widgets that we can put inside inside other widgets but they also have events this one is unclicked is when you click and release and you're inside the button and presses immediately as after you press and release is well when you release so i'll just unclick and what this will do is open this level again so open level if you use by name we need to know the name of the level which is vehicle example map but we can also open level by object reference and select our vehicle example map compile and save it now we need to create it so now here in the game mode racing game and i'm going to do it very fast whenever we win which is here we cross the finish line before the game finishes i'll just add that to my ui so i'll just well to my viewport i'll create the widget if this would be a bigger project i would do everything that i'm doing with widgets in the player excuse me in the hat class but for now i'm going to just create it like this create a widget add it to the viewport and let's be done with it now when we win the game let's go back let's go here play from here play you win now it's missing some of the flare so i'm going to add a little animation i'm going to select the comma spawn gonna go to animations here going to add an animation called fade in i'm going to select the animation this will get activated i can create a track i'm going to select the canvas panel because it's already selected now here create a track render opacity at first it will be zero whenever oops i didn't mean to change the black the green bar and at one this one will be one and if we press play we have the animation and it's working correctly now we need to play it whenever this gets created so here in the graph like we had events we can have more stuff to drive data and well in my case animations so in the event construct which is very similar to the beginplay i'm going to drag and drop this fade in and play the animation play the animation playback speed if we wanted a little bit more fast play mode forward we don't need a fade out if we use the reverse mode but let's just use it like this now let's try it play from here and now we have it like this now i can't click the button unless i press shift f2 f1 and click on restart game which will open the game well the level again which means that our game is restarted right because i'm restarted all the level for my for my mouse to appear again we need to get the player controller and here show mouse set show mouse cursor and put it true and connect it like this before the game finishes now let's press play oh too far play from here and now i have my mouse let's restart the game and i still have my mouse so i need to do something here okay so whenever i finish the game by winning i want this to not only show the mouse cursor but also set the game input mode to game and ui the ui i want to focus is well inside this widget that i just created and it's called the button i want to focus this that way if i press enter i may be able to to use it oh come on right and whenever this game starts again which is here in the pre-race i want to do the opposite like not show the mouse cursor and also don't need the input mode in ui set input mode game and i will put this in my pre-race pace with this compile save it let's press play from here you cross the line you can click the button immediately you don't need to select like give it focus and then start the game you can even press enter and it will work and now my game starts working normal this is all well and good but i have not addressed the fact and let me save everything again save all i have not addressed the fact that there also needs to be a losing screen so let's create a sequence for the loose screen and yeah let's start with that for the loose sequence which i need to create again add level sequence here loose sequence let's just create something very simple i'll just create a camera and i'll just go through the map like through parts of the map like from here i'll start with the transform move it here like 100 and if you want to move your camera freely you can just click here and it will automatically add a key when another key is already added so whenever i move forward a key will be added here now i want to jump to another place of the map right now i have this maybe it's too fast also so i'll just extend my duration here to do that let's just drag and drop this to the side and we can increase this so we can this value so we can go further yeah so here i'll put this key in 150. the next key will be someplace else entirely hopefully it just jumps to the to the other place and then i'll move around to to 200 move around here and at the end 250 i'll just be here just as a proof of concept so now when i press play my camera or the rotation is going to another place entirely okay but not to worry because here in the previous frame which is 50 this is 51 i can go back a frame like this what i will do is rotate the camera to where it should be looking towards and see if there is a rotation there i'll try to zoom in here i'll just add it and now it should be working with control and dragging your mouse will you can get the same results as i did so i have something like this when i lose it's not the best but you get what i'm trying to do or i hope you you get you get it the way you can do jump cuts and we can probably do a more tutorials on it later it's by creating another sequence and putting sequence inside other sequences that way you avoid this issue of just jumping one of those type of transitions yeah so you can avoid that like that with sequences and i do need to increase this camera cut so whenever i press play i'm seeing everything and that would be it for now let's just save it let's just close it and in our racing game here whenever we finish the game we already have a way of checking this so we are going to play if it's win well we'll play the win sequence and when we lose we can put this here and we need to find our actor sequence again where is it level here it is loose sequence tag it loose whoops that's not loose lose and whenever we lose and i'm going to go to the game mode and the start timer duration will be 2 so we lost so we'll lose very easily play it i need to cross this i have two seconds i lose and we're not playing the cinematic x so what is happening this code where is it am i finding it oh i did not connect it okay so now let's see if i'm losing correctly now you lose here we should also have the loosen cinematic well the loosen menu and in the case of the loose sequence and i'm going to delete this tag i want to loop it so loop indefinitely play rate could be a lot slower so i'll just put 0.5 and i also need the ui for that so i'll just duplicate this this will be loose screen and i'm duplicating but i could have used the same one this type of loose i could have used the same windscreen but then i would have needed to change the value of this you win depending on the game mode state but by duplicating i can just change it like this you [Music] lose and that's pretty much it i just need to compile save go to my where is my gamemode and add the same code that i added for the win but also for the loose out of time so it's the same code maybe i could have reused it here but okay i just want to finish this tutorial it has gone too long for my taste but we have covered a lot of topics actually didn't expect to cover that much with this one and do remember to connect this this will change to loose screen which means that this button doesn't exist but i need to create it again get button i mean the reference and just like so when we lose i'll press play i have seconds need to run you lose and yeah that's it we start the game and you can restart our little game the tutorial should be finished by now but seeing that i already created like the full game loop of a racing game why not package it and have a richer tutorial or a footer tutorial so if you go to your racing game right now i have closed unreal you can test how your game would feel in a standalone type of way like right click it and launch it this will start loading your game and you can see the performance and you can see how it's looking so yeah some things need to be rebuilt and there we have it we have our game and it should be working like inside of the engine and i just remember that this is with a value of two right so if we start it then we're fine so i'm well you need to close it with alt f4 because i didn't add the input key escape to close the game so maybe we could add that also so let's package it and yeah i crashed whenever i when i tried to to launch it well while the engine was open okay so first thing first let's open the game mode and let's increase it back to 10 start time iteration 10 perfect let's go to my pawn which is the sport sports car pawn and i'm going to add the key quit break settings here input action mappings add one that says quit and the key will be escape we already know how to do this so we are just applying what we know here i'll just type quit game wasn't the one that i was trying to search but this is my action event quit but this is the node that we are going to use in order to quit the game and quit that's good enough perfect now we know now we have created a way of quitting the game by pressing escape and that should work also whenever we package our game or we run it in standalone mode so let's save everything let's build everything and build everything save everything and then we will package team and i'm building this because we i had a little a little message here telling me that i was something was not building the level so that's why i did it okay so i'm going to close this and to package our project i'm not going to do it this way oh it's no longer here settings and packaging no longer here either okay well it's i don't know even where it is here it may be it it would be here project because i really don't use this way of packaging what i do normally is go to the project launcher and in my project launcher create a custom profile custom profile and here any project is fine build build development is fine it could also be shipping let's just put it in shipping because let's say that this game is finally finished so this is shipping i don't need anything from the from this tool for real cook not on the fly by the book that way whenever we start the game we don't need to see how these shaders of the trees are being compiled platforms i need to choose windows good cultures by default should be english there it is the maps that i'm going to add i only want this vehicle example map dlc is released don't need it advanced settings i do want to compress everything to a single pack so let me search for it storage in a single unreal pack and yeah that's good enough for me quicker build shipping packaging do not package now package and store locally and search for a place where you can put your stuff and be careful if you already have some stuff here with the name windows no editor or with the name windows i'm just deleting everything there because i don't really use it build select folder distribution for public let's just say yes include an installer this is very useful when you're making any type of friend that is not a game developer try your game when you add this your packaging size is greater but it has the added bonus that if some prerequisite is missing it will install it so i'll just put it here maybe you want to share it with your family i don't know anything here ah nothing do you want to archive no copy to device what this will do i don't need to copy to any device so do not deploy if i wanted to copy to a cell phone or another pc i could do it through here and launch well i if you're not deploying then it cannot be launched right so if it was copy to device you can select here how it will be launched after this is packaged but in my case do not deploy let's just save us some trouble the profile name will be shipping profile because everything here is in shipping shipping gets rid of a lot of debugging tools so it increases your performance it it decreases the overhead when you need to load your game so that's why i put everything here in ship so let's go back and now we can start the packaging so launch the the profile and it will go through these steps first you need to build the game building the game means compiling the code if you are not debasing um some blueprints to c plus plus it will do it here and if your game fails in this state in this stage it's because there may be a error in the logic or ah a file may be corrupt or a reference was missing something like that here i'm going to allow the access so it can use the cooker it can generate the lighting if i was using some static lighting just accept everything that that unreal gives you so cooking the content means that we are transforming these new assets because if i just right click here and show in explorer these are you asset a u asset is a binary file that we can use inside the editor right and we can modify stuff there we can add code if it's an static mesh we can create collisions in it but ah dot u asset is not a file that can be recognized but by other software or other hardware right so it doesn't make sense for these files to stay as you asset not only because they will not be able to be read but also because well it's it takes more space the fact that you can edit it and if you can edit then it means that change can happen but we don't want really our customer or our player to change anything in the game right so cooking the content means that we are converting those new assets to files that our hardware can recognize depending on which is the target platform in our case it's windows but it will be different if we were targeting a console or if we were targeting a different operating system so a good example is the audio the sound effects i don't want it to be a dot you asset i want it to be dot web or wave sorry my spanish slips out sometimes so wab wave or maybe an mp3 i don't know it makes the these u assets smaller and readable for the target but that's basically it also it applies some compression so the packaging size is a lot smaller now if your packaging fails during the cook content part of the or the of the packaging then it means that some asset was corrupt or also that a reference was not found it's kind of the same when this an error happened in building but building usually is a reference missing in the code here's a reference just missing entirely so you need to be very careful and we can see what exactly what's happening here on the scoring asset registry and doing some stuff you can see exactly the steps that this launcher is taking and also this good content will get rid of extra content that we are not using for example lods that we are not using it will be removed maps that we are not using that we already selected which ones we are going to to use are also not packaged and any assets that are not referenced by anything will not be loaded and something that i forgot to check here before launching the this project launcher is going here in the project settings maps and modes and making sure that my game default map is the map that i want because whenever i open this game i will use this map just take that in consideration and that's pretty much what i have to say oh also don't forget the game mode also needs to be there yeah and that's all i had to say about packaging i'll just pause the video and when this is done usually cooking the content is the most consuming thing so when this is done i'm still packaging but i forgot also something important maybe if you launch this profile you will fail here at the start build game and it's not only because there could be errors in the code but it's also because you really need a compiler so you would need to install visual studio an easy way to style it if you don't have it yet let's just put file and do it before you you try to launch this input file here or where can i create a c plus plus class here in tools tools new c plus plus class if you don't have visual studio added or any type of c plus plus compiler that unreal can use it will have it will ask you to install it here there will be a little banner that says oh you don't have something that we can use to create cbs plus or to develop in zip plus installed here and there's a button like here just click it and that installer already have the the selected components that you need in order to develop stuff in c plus plus and also to package a project and it seems that it's still packaging so yeah that's the the the thing that i forgot to mention before starting packaging the project and later on also it can show that you're missing some sdks you can search it online you can also let us know in the in our discord server we can provide some support for that and we also have a i believe three videos on packaging that are go more in depth so yeah let's wait for this to finish so we can open it and test it and that would be it again if this type of windows pop-up just although allow access and now we're in packaging content the packaging is finally done this is how long it lasted and for sure it was a little bit more let's open it let's find the the folder and here it is windows and inside it we have the executable these files we really don't need them you can delete them when you are sharing your file your project and this folder can be anything so can be called your the name of your project for example releasing game and i'll close the engine just like that we can save this and let's open that executable and see if it is working correctly there it is there's the engine noise and it's still loading it seems like those materials or maybe didn't load correctly let's see if we can finish the game then to fix the issues here for example is just saving the game again checking that the material has all the needed assets and there it is let's restart the game and now we have our racing game finally finally done and i opened the editor again and this error popped up which is saying something about the surface surface material of this spline was missing so if the material asset is not received it may not render correctly which is what it was happening so let's fix it yeah so so that should pretty much be it i would need to do a another package like again brake launcher we have that shipping profile here and i we just need to launch it like this now the second time you package a project should be a loss a lot faster so it shouldn't take that much that much time but sometimes if you are specifying a full rebuild look there the content was very fast if you're doing a full rebuild then it can take the same amount of time in our case it didn't and yeah this last part packaging part is creating and compressing the assets into our pack file and creating the folder structure that will be used when our game is finished so this time very very quickly it was done i'll close the editor again i'll save this and i'll go to my build to my builds here it is windows let's open it up and the surface still looking not looking right so let me see what's happening there right then i just couldn't live with that error so what i did to fix it is go to the landscape here not new select the splines all the splines and why am i not selecting the splines here is a spline what is the spline hero spline here all those planes now all the splines should be selected we are going to update spline mesh in all levels and now we get this here you will see and this was wasn't here that's what i fixed you will see here that spline meshes that we can use are here mesh and instead of just dragging the materials on top of it i'm just here going to create an override the first one is these lines so these lines were the damaged concrete and drag and drop it now we can see the damage concrete here and a new override which is the actual asphalt this and why can i there it is there it is and now we have it exactly as we have it before we can go back to the select mode save everything and whenever we package it and i already did it so we i don't waste too much time i deleted the previous one remember if you have a windows folder here and you build on top of it there will be some unforeseen errors or maybe just some clear error that it didn't work so now our package project yeah our project now has the materials that should be could happen there on the start and now it is looking pretty cool and with escape we can close the game perfect that will be the end of this tutorial thanks for watching and we have gone through a lot actually from the play creation defining the game using the framework with the game mode and the phone modifying the car oh optimize node well we have been optimizing some things with these two these are instance static meshes and yeah we have polished a lot of the game and it's not just a simple game you can see that there is a little bit of polish that should make the experience a lot better so hopefully you have learned at least something with this tutorial and with that um [Music] yeah see you in the next tutorial
Info
Channel: UNF Games
Views: 145,481
Rating: undefined out of 5
Keywords: unfgames, unreal engine beginner tutorial, unreal engine 5 tutorial
Id: 3P1A73Ghisw
Channel Id: undefined
Length: 358min 51sec (21531 seconds)
Published: Fri Sep 02 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.