Blueprint Game Framework Basics | Live Training | Unreal Engine

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everybody I'm Allen hoon devrel Tech artist with Epic Games and today I'm going to teach you about the game framework a little bit of UMG some blueprint so on and so forth so the idea here is that to set the scene we are game jamming away clickety clack we've come up with our little game our prototype is working well and now we actually want to wrap what I'll call the game shell around the proto so we'll put together a menu system and then we'll get into some of the game framework stuff where we're pushing and pulling values from things like a game instance in game mode and yeah well we'll go from there so we'll see where this takes us alright so I guess to begin game framework is a collection of objects that are spawned every time the Unreal project is launched and several different components make up the game framework so we're talking about here if we take a look at world settings we've got our actual game mode itself the pawns HUD player controller game State player state these are things you've probably seen before if you've worked on unreal but also we've got things like save game and particularly game instance that I'm going to get into I'm going to show you how you can store variables in your game instance and then retrieve them and keep them persistently across a number of different levels so let's go ahead and get started I've got the third person template here standard template and let's go ahead and start creating some actors so I'm going to make a new folder here I call this blueprint and we're just going to pick up some coins how about so we're going to make a new blueprint class of actor variety and we'll just call this our VP pickup let's start putting that together alright so we'll want a static mesh in here so we have something to look at and let's go get some static meshes so I'm going to make another new folder static meshes and instead of going ahead and importing I'm going to grab some whoo that's not pleasant all right what I'm clicking there is show engine content now over here on the side I've exposed this here so basic shapes we've got some basic shapes here basic material let's go ahead and grab those and I'm going to drag those in static meshes and I'm going to copy them so you don't want to move them because those are actually the static meshes that the editor is going to refer to when you're doing various operations so I like to make a copy of those and let's go ahead and hide this again all right back to our blueprint okay so now we can pick static mesh and let's step back though let's go to our static mesh let's go ahead and make a new material now try to keep things organized here do a new folder very good and we'll drag a minute there all right let's go ahead make a new material this will be our coin material and we'll take a color somewhere ish in there and we'll hold down 1 and plug that into metallic and I'll do it again for roughness and let's change that to value of 1 and roughness let's take a guess at 0.75 not too much other way 25 okay suitably coiny looking yeah we'll save that go back to our static meshes here and let's go ahead and we'll apply that to our cylinder sorry about the jitter on the UI there all right excellent okay so now we're going to pick that cylinder I think that's my could that be the UI scaling I've got going on there yeah sorry about that folks all right so let's spin this up a little bit here okay that'll be our coin and we need to be able to interact with this thing so let's go with a sphere collision scale that up like so that might be a little bit too big but let's drop that in the world see what that looks like yeah yeah doesn't work I guess it's a little large but that's fine let's go ahead and move this like so and I'm going to throw a rotator component on here rotating movement all right awesome so we have our coin I'm going to line this up with our character here so that we don't have to run around the world too much try to find it when we start playing and let's jump back in there real quick I'm going to go ahead and turn off collision no collision okay great perfect all right so what do we want to do we want to pick this up and we are going to keep track of how many coins were actually picking up and we could store that information in a number of different places but I'm just going to go ahead and stick it on the pawn so let's find our pawn and I'm gonna make a new variable and I'll just call it coins and we'll turn that into an integer all right then back on our pick up I'm going to add another variable and I'm going to say this is the coin value that will also be an integer and we'll compile and set that to one all right so now let's go ahead and select our sphere and we will say let's expand this on component begin overlap let's go ahead and add some interaction here and we'll make sure that the only thing that we're interacting with is the character so we'll find the third person character there cast to him and basically this is going to act like a true/false I would like once we found him I'll say that's true let's go ahead and find his total coins we're going to set his coins all right we'll want to get the number of coins that he already has and add that like so and we'll add that coin value so that way if we wanted gold coins silver coins copper coins they could each have a different monetary value associated with them okay and just to make sure that this is all working properly I'll just print this to the screen real quick okay and there we go okay one to touch it three times four times great alright so once we've touched it we don't actually want to hang around so we will go ahead and destroy this actor there we go okay that's better okay so we have our basic pickup let's go ahead and throw down a few of these so I'm going to select our guy and I'm holding alt and just dragging out I'll do like five yeah you'll have to forgive me here we're doing some scaling with the UI so things are a little bit easier to see but it means that some of the gizmos are a little bit off all right cool so by the time we pick all these up we should have five total coins okay so the next thing we're going to do we're going to get into a little bit of the game framework stuff and we'll use the game mode to monitor how many coins we have and then use that to be able to transition to a new level and I'm going to create let's go ahead and create another blueprint here I'm just going to duplicate this real quick and I'm going to call this VP portal all right so what'll happen is we'll pick up our coins if we've picked up enough then we'll be able to hit the portal and then transition to a new level so let's go ahead and pick a different static mesh so we have something different to look at about the cone and we don't need to scale him and we don't need a rotate a meter all right that should work just fine all right he won't have a coin value yes but we'll need to know which level we're going to transition to so let's go ahead and say this is going to be the next level and we're going to make that a name type like so alright save everything and let's drop him down over here scoot over a little bit alright so yeah we'll work on him first let's go to his event graph let's look at his spear collision here you should still have the on overlap okay so if it's third person character we're not dealing with a this coin stuff we don't need to destroy him we're going to go ahead and open a level and we're going to get the next level name and that'll be the level that we open up we'll want to make this public so that when we have it selected in the viewport if we look at the details over here there's our next level we're going to go to level 1 actually this would be a great time to save our level let's go ahead and make a new folder here called Maps very good and in our Maps folder we will save this as level 0 great okay real quick do we need anything else in this level I don't think so we have our coins our character and our portal so at this point we could go ahead and duplicate this and make our next level so let's just right click say duplicate it's going to be level 1 and we'll do that again to make level 2 quicksave and let's go in and make sure that we differentiate these so that we can tell them all apart yes yes yes ok so that is level 2 your level 1 I'm sorry let's find our post-process volume and in the details panel we'll look at our settings scene color and I'm just going to tint this one sort of greenish okay that'll work and we'll do the same here for level 2 got a post-process volume and I'm going to tip this one blue okay and since we're here we might as well tint this one red okay now it should be perfectly clear which level we are in at any particular time okay so we need to determine whether or not we have enough coins to be able to transition to the next level once we've hit the portal so this is a good time where we can use the actual game mode so let's go over to our world settings here I'm going to open up the blueprint folder so game mode override let's go ahead and create a new game mode and I'll just leave default names so that anytime we're looking for the new game framework classes they'll be prefaced with new all right so this allows us to change which pawn we're using and we'll go ahead and use third person character and the player controller we're going to make a custom player controller again new player controller that should show up let's close some of the stuff down alright and a new game state okay so game state is a part of the framework that we can use to set rules and conditions for whatever it is we're trying to do right so like I said we want to collect five coins and then transition the next level so we're going to make a custom event with in-game state we don't need these guys right now so let's do a custom event and this will be coin test we'll call it and it's going to take in an integer and we'll say that is the total coins all right let's keep it the same we'll say coin total all right and let's go ahead and we will use begin play let's go ahead and get the controlled pawn get the player pawn and we're going to figure out that that is the third person character we're going to cast to him so that we can get at the variables that we set up and we're going to look for coins we're going to get coins okay actually all that let's do this we'll just set this promote to variable this will be our let us call this a pawn now we could hang these wires right off of here and wire them right into our coin test thing but I like to try to keep things as organized as possible so I'm going to go ahead and like I just did promote that to a variable so now we will get the pawn will get his coins and we'll do a test on that we'll say if it's a greater or equal to let's promote this we'll say we'll say five there's five and I'm going to promote that that's the coin goal okay if that is true now we can either we could do this a couple different ways doesn't really matter I don't believe but we could either call open level from here or I think we had already originally set it up from the from the portal so we'll go ahead and do that it's going to be a little bit of jumping back and forth talking to a couple different things but we'll say this is level clear and we want that to default to false and we'll set that to true okay so every time we call coin test we're going to get the pawn find out how many coins he has if it's greater or equal to five that's true then we're going to set level clear and we'll jump back over to our portal and we'll want to get the game mode our game state game state and that's going to be our new game state and from there we will get our what we call it level clear get little clear and again will branch where the back in and I usually like a little bit of a delay here so I'm going to say delay just so it's not jarring as we jump into the new level I'll put in one second oh excuse me okay so quick review picked up all the coins casting to the character and to make sure that we're actually the character is what is overlapping the portal object we don't want them overlapping it other other pickups or pieces geometry we're basically using this as a test there we're getting the game state that we created let's go ahead and wire this good stuff up here reaching down in and grabbing the flag for level clear if it's true we're going to pause for a second and then we're going to open up the new level that is set back over here and of course if none of that is true then we're just going to fail out and do nothing all right so let's see if that all works so 1 2 3 4 and 5 now what have I missed oh we haven't called coin test anywhere so let's go to our coin we'll do this from the coin so on overlap third person character before we destroy the actor let's go ahead and from up here probably going to end up setting up a bunch of this stuff as we build onto the project so I'm going to use a sequence node to try to keep things a little more organized and we'll get that state we'll get game state once again and we'll cast to the new game state and from there we will just promote the variable and we'll call that our game state all right now back down here we can just drag that in and we should be able to call coin test okay great let's take a look at our coin test once again yes yes yes very good okay let's give that shot one two three four now if I go and try to connect with the portal nothing happens if I hit number five there we go now we've loaded up the next level and again so now this is another instance we're going to get into another part of the game framework so I collected five coins but I loaded a new level and so when I go to hit the portal nothing's going to happen because the total number of coins that are set on the third person character on our pawn is getting reset if I collect five again I should be able to go to the blue level oh we did not set up where we're going next let's go ahead and go back and do that all right so he's going to go to level to save he'll go to level three well you don't have a level three let's go back to level zero okay one two three four five why are you not going back should be there he's got his thing set let's take a look at our there we go we didn't set up our game oh there we go so now okay so what was happening there is when we initially created this level the game mode wasn't set so you saw all of this other game framework stuff was also set to none by switching to our new game mode it's going to fill in all of these slots so as we were connecting with the portal object it wasn't checking the new game state it wasn't calling coin test because it didn't know to actually use that as the game state so we'll need to set that on this level as well new game mode okay let's try it again there we go that's better okay perfect okay you know let's add a little bit of polish to this let's go back to our let's go back to our portal here even though we have a little bit of a delay it's kind of difficult to tell that we've actually hit the portal so I'm going to do a little time dilation and we going to set this to pretty slow and we'll want to take this down too so now when we hit this bad boy there we go slow motion we know we're transitioning all right cool all right so let's jump into some UMG before we hit the next piece of game framework let's let's keep track of how many coins we actually had now previously we were just pointing the screen but let's let's close down some of this stuff here and I'm going to make a new folder and we'll call this UI and from within you I will make a new widget and let's call this coin widget actually I'm getting backwards I like to say widget first weighted coin okay this is going to be pretty straightforward we're just going to take some text drop that in and we'll make it a little bit larger maybe a bigger font like so and this will just say coins okay and I'll copy and paste that and this one will just be 0 all right now I'm going to select the both of them and I'm going to say I'm going to right click and I'm going to wrap with a horizontal box which is right here let's go ahead and move that around I'm also going to throw in a spacer I believe that's in the primitives let's go ahead and drop that in like so there we go and we'll just kind of put that in the corner right about there okay so another part of game framework player controller so we'd already created one previously when we set up our game mode so the question came up on the forums where is the best place to start creating and housing your widgets and it really depends on the type of game that you're making and a bit of personal preference so in this particular case it's a single player game at this point you know we could house it just about anywhere but I typically go with the player controller because that way if you do have multiple players you want their UI is attached to the controllers that are actually of the player so let's go into player controller and on begin play let's go ahead and create a widget we'll get our new coin widget and I'm going to promote that to a variable and we'll call that the coin widget and then we'll add that to the viewport okay so now if we play there we go we've got our coins and let's go back to our widget and we'll hook it up so a couple of different ways that we could go ahead and increment the value here the more performant way would to have it all event base right like as soon as you pick up the coin it's going to go ahead and you know send a message up to the widget and increment this thing but the quick and dirty way is to go ahead and just do a binding so let's select this and where's our text right up here so we'll say bind create a binding alright so we need to get at the third person character and get the total number of coins that he has so I'm going to jump back to the event graph here and first let's again we'll get the pawn and we'll cast that and that's going to be the third person character and we'll just promote that to a variable and we'll say that's our pawn okay so now when we go back to our binding let's give ourselves some real estate here where are my variables there they are pawn we can drag our pawn in get we'll get the number of coins he has and we'll just attach that there all right so now when we play with each coin that we pick up it's going to add to the value sweet okay so what do we want to do next now as you saw the total number of coins is getting reset every time we load a new level perhaps we want to keep track of how many coins we've collected to the entirety of the game that's all we're going to get into game instance which is another piece of the framework so where as we saw initially when I screwed up and didn't set the game-mode properly that none of these fields were filled out right so these are all fields all pieces of the framework that are specific to the world that we have loaded at this time so world level map same same rough idea okay so game instance is a piece of the framework that lives up above everything else it's always present we can push and pull values to it so this is a good place to store I'll call our coin Bank so we need to go out to the project settings and let's drag us into view and I never remember where it is offhand so I'm going to look for the instance is it in maps and modes yes it is so we can create this is the default game instance we're going to go ahead and create a new one that's going to drop it right into the blueprints folder I'm just going to leave the name new game instance and now jump back to our blueprints folder here's our new game instance so let's double click and open that up and we need to store the total number of coins for the game and I think I said we'll call that the coin bank and that's going to be an integer and let's we can do this from the coin over that's the widget we don't want that let's go back to our coin blueprint and we'll need a reference to our game instance so let's go ahead and get the instance and we'll cast to the new game instance that we created so we'll say cast and we'll promote that to a variable and that'll be our game instance okay so now we can refer that from the coin whenever we need it and we'll do it let's do it right around here this looks good so basically the same thing that we're doing here with the actual character we're going to do a similar thing with the game instance but it'll actually persist level a level so let's get that and let me zoom in there for you and we'll get the coin Bank and we'll set the coin Bank and we're going to add where are you integer and integer right here like so kind of shuffle these around a little and we'll again plug in the coin value I guess we could just wire off a here to whatever gives me excuse too difficult to do reroute nodes with the scaling so let's go ahead and plug that in all right and then we'll want to hook the rest of this back up okay so currently we don't have a way to display the coin Bank so let's go ahead and add that to our widget go back to our coin widget here and I'm going to take this horizontal box and I think if I just go ahead and copy and paste it down everything should come along for the ride yes very good we'll say this is our bank all righty whoops don't want to shuffle that we want to move this around so now I'm going to select both of these horizontal boxes and I'm going to go ahead and wrap those with a vertical box so now they're sitting nice and pretty together go ahead and resize that a little bit and we can adjust our spacer so that these guys are a little bit better in terms of being lined up otherwise that's going to drive me insane mmm all right fine close enough so real quick there we are coins Bank let's hook that back up so again we'll just do the easy binding and we'll need a reference to our game instance so let's go ahead and again I like to try to keep these things somewhat organized so I use a lot of sequence nodes so hook that one up there this one back here kind of spread these out a little bit okay so let's get our game instance we need to cast to it so we can talk to our particular flavor of game instance and we'll promote that to a variable game instance so that in our new binding we can just drag that in and get our bank get the coin bank and wire that right up all right so initially this should look it should read one-to-one right but now when we go to our next level we see that coins is reset but the bank is actually holding it five because again the game instance is part of the framework that exists throughout the running of the executable right so doesn't matter which levels I load the game instance is always there we can push and pull values to it do what we like okay um before we get into the next part let's see I was going to talk a little bit about saving games we could set up a simple save game but maybe let's jump over to the questions and see if there's anything we can answer there okay can you briefly describe the use of game instance game mode game State and player state as they relate to multiplayer games in terms of which should be used for replication and types of data so again it really depends on your project and in many cases personal preference so much like just for example I'm housing the the UMG widgets in player controller depending on what type your game what type of game you're making you may want to store those in different places now I believe all the different pieces of the framework are replicated so they should be valid but I'll have to go double check to see make sure that that is the case and in all circumstances any significant difference on putting the coin count on the pawned versus gamestate or perhaps something else entirely now again personal preference in this single-player game it really wouldn't matter but if we did want to make this a multiplayer game whether it's couch co-op or online we could store the coin count on the player so they could have individual counts for example I mean you could put it on the player controller if you wanted all right let's see how well would you e4 batch coins if you wanted 200 of them pacman style a lot of different factors there so certainly people have done pacman style games with lots of little pickups so many different factors go into that how complex the thing is you're picking up what kind of materials you're using so on and so forth there's a lot of optimizations that you can make in order to make that run but 200 I wouldn't expect that that would be a big deal at all how can we build blueprint or C++ the loading sublevels process into a large level so I kind of think I understand what you're getting at there so okay this is kind of outside of what we're doing so far but we can take a look at this if perhaps this will answer it if you're unaware if we go to where are our levels here we go so we can open up this levels browser and if we wanted to let's say we wanted to separate out our background from our pickups and maybe we have enemies maybe each one of those lives in a separate level we can go ahead and load in C we can go ahead and add existing we can pick from the selection of maps that are actually in our project so the persistent level is sort of the master level for this particular world and it can be built up of multiple sub levels now those sub levels can then be set to being loaded all of the time or being triggered by blueprint or C++ I assume so that's how you would set up like streaming so on and so forth hopefully that gives you some insight into what you're asking there is casting messy for migrating migrating maybe some more information migrating we're migrating to what what are we looking at migrate and is the game instance intended to replicate in multiplayer scenarios so I haven't done a tremendous about a multiplayer stuff but I believe so yes I believe the game instance replicates across the whole I'll say project ok that's all we have right there so yeah let's move on ok so a couple things we could do next we want to I want to get it in the save game thing because that's pretty cool but maybe first what we'll do is we'll build a new level to house our main menu so that we can either just play and go directly into the game that we've got set up now or we can set up another button to go ahead and load save and load our progress oh hold on let's see is casting messy for migrating and migrating blueprints to other projects well so in the case I mean you're also going to have a game mode game State player state game instance but the depending on your subclasses of those that could potentially get messy right so like I've just created new game instance and another project I might call it something else like and let's run our instance or something and it may not have the same variables and so yeah that could break alright so let's go ahead and actually we can do some level streaming stuff not level streaming but loading up multiple levels so let's go to maps and I'm going to make a new level here and we'll call this our level and menu let's go ahead and open that up save all this goodness alright so totally black and let's jump back to our blueprints folder let's go ahead and I'm going to create a new game mode just for the menu now there may be a different way of doing this but this is just a habit that I got into I'm not recommending one way or another but so let's call this our menu game mode I'm just going to copy that little strip of text there okay and we don't actually need a pawn because we're just going to be looking at a menu and player controller I guess when I guess if we need that later we'll go ahead and mess with that so let's make a new widget user interface and this will be our widget main menu all right let's get this out of the way make some real estate alright there's our screen and let's go ahead and take a button drop that down make that a little bit larger throw a piece of text on it and we'll just say that's new game and let's copy and paste and we'll say that's load and I'm going to bundle those together with a vertical box by wrapping and let's go ahead and you know what make some ginormous buttons okay and let's go ahead and anchor that in the middle of the screen and we'll just use some nice easy round numbers here should be roughly Center ish and just for kicks let's throw this down we'll say this is our coin game okay all right that should work and let's go ahead and once again just because how I typically do it I'm going to stick this on the player controller so go ahead and make a new menu player controller and much like we did before we'll go ahead to begin play we'll create a widget it's going to be our main menu widget we'll call it that and we're going to go ahead and add that to the viewport so add view and now if we play there we go and I typically let's we'll do this as well go in our player controller and once again with the sequence nodes let's shuffle this around a little bit let's go ahead and show mouse cursor will say that's true just so that when we play we can actually see what we're doing all right okay so back to our widget let's go ahead and start our new game so I'm going to select that button and we'll say on clicked again with the delay just because I don't want it to be so darn jarring pardon me we'll go ahead and open up a level and we'll always start at level zero all right so we hit play nothing happens when we hit load when we hit new game half a second and we're in okay so we've got a simple game shell there again using parts of the framework we're using the player controller or the game mode next so saving and loading so let's go back and what we want to be able to do is initially we'll just go ahead and we will save the number of coins in our Bank and reload that so first thing we need to do is go ahead and create a new blueprint class if we go to the class browser down here and type save we have a new object here we go alright come on I'm not sure why he's not allowing me to select him let's try again Oh select okay don't you and we're going to call that let's go ahead and rename him do save game alright so we go ahead and open them up and we want to save the total number of coins in the bank we know that's an integer so we'll just say we'll call that coin Bank change that to an integer all right then from our playercontroller I'm just going to quickly hook up this is our menu player controller we want to actually do it on our game player controller so that is new player controller here I'm going to go ahead and we'll just hit the Q key and we'll use that to save our game but first thing we need to do is create a save game so let's see create a save game object and yeah let's go ahead and organize this in that whoops let's go ahead and organize this now again with the sequence my favorite cool and we'll pick our new savegame let's go ahead and cast a new save game and we'll promote that to our variable that'll be our save game all right so we've got that created so as soon as we create the player controller we're going to go ahead and create a save game object and then from down here you can save game to slot now we could potentially create a fancy UI for entering a custom name for all this stuff but we're just going to have for the sake of this purpose we're just gonna have one slot I'm just going to call it slot name a alright so now every time we hit Q first thing it's going to do is go ahead and write out the data that is in coin Bank and let's see the other thing we want to do is we'll just go ahead and again just a tiny little bit of delay we'll say half a second and I'm just going to let's do this print will say game saved and then we'll quit okay but we're not actually storing anything in our value here so let's go ahead and we'll jump back to our coin where we're doing all the rest of this good stuff and maybe we could do this here let's think about this for a second so we want to write to the savegame let's so let's wait let's take a look at our game instance maybe it makes more sense to put it there new game instance we've got our coin Bank here so we want to get it from the game instance because we want to save it throughout all the different levels that we have spoken to so let's go back to our player controller and what do we have here we have our coin widget let's go ahead and get our game instance again and let's see get game instance cast to the new game instance variable game instance okay so now let's get that alright let's scooch scooch this down so from game incidence we should be able to get our bank and from our save game we should be able to set our bank and then save our game alright so let's see if that works first things first you know what I'm not sure where this install is I'm not going to go track it down we'll be able to figure out if it works in a second here let's go back to our main menu widget ok from our load button on clicked so we want to actually load a game load game from slot and since we're just hard coding this that should do it and then we want to go ahead and we'll just open up this level for now all right I don't think I've missed anything let's see what happens so we're going to play a new game here we are we've got 1 2 3 4 5 we'll go to the next level 1 2 3 coins all right now I'm going to hit Q tells me the game is saved the game is quit now if I load it back up okay so we're not setting our coin bank alright so from within our widget let's take a look and so we can get our game instance and again cast a lot of casting going on or should we get our seat yeah let's so if we've loaded this let's see let me see something here that's our actual save game so we should be able to get our bank hook this back up and let's go up here cast our game instance and yeah we'll just promote this game instance okay let's get that and we want to set our bank in the instance all right let's see if that works yeah there we go so our game was actually saved it saves the number of coins that we had so again let's walk back through that real quick so when we hit Q we save out the game this is on our player controller we're getting the coin Bank and we're saving that same name there similarly named variable into the save game and then we write it out to the slot that we've just called slot a now if you dig down into your your project save game area actually I do know where this is let's go find it let's pull this off of here in case there's any top-secret stuff you never know what's on these things all right game framework okay I think I'm safe to pull this back okay so within my project folder I'm going to go to saved save games there you see if there's a dot Save that's where we're storing our coin Bank and then when we go back to load when we click the load button we're going to load that save game we're going to cast to that save game instance grab the coin Bank and then we're going to set the coin back in the instance which will automatically update the widget due to the binding that we set up earlier so go ahead and take a look at that again so everything's reset okay so one thing that you'll notice let's go to the third level here all right 13 coins I hit Q let's go back and play again now we're we're saving our coins but we're not actually saving the level that we were in so I think I think we have time for that and then we can do a little more QA so how about on our portal let's open this up so we're already storing which level we're going to why don't we go ahead and store which level we're already on so we'll say current level and we'll say that's public and that's going to be of name type very good and we'll need to go into let's see did I actually save and compel it to save everything just to be safe okay yeah so let's go to our maps let's open these back up here and now you should see in the details panel current level so we just need to fill these in okay save next level one save and level to level two all right so that should all be good and let's open up our save game new save game are you there you are now that's the game instance new game state why can it not read a new safe game at the end my apologies okay so this is going to be current level again of name type save that and within the game instance we'll pull it from there as well current level all righty and from our portal we'll say again with the sequence node let's go ahead and we'll get the game instance cast brought variable game instance oops clack click off of it try that again why are you up and we'll get this you know tell you what most we don't really need this just do it right from here ugly style and level that's wonderful okay so what are we doing alright here we are in the portal we're going to push up the name of the current level to the game instance as soon as the portal is created alright then back on our player controller as part of this let's go ahead and push this back a little bit again from our game instance let's go ahead and get the current level and we should have current level in here set current level look that bad boy up okay so it should be saved out and then when we go to load our game let's disconnect that but I do want to open a level and from the game instance let's get let's see go ahead and get the current level and that's the one we're going to load up all right hopefully we didn't mess anything up let's see what happens so we started in the blue level let's go to the red one all right so seven eight coins in the bank and we'll hit Q to save and quit play again oh you know what I'm not on main menu let's go to main menu need to go to our main menu map so we can launch from there save everything I try again so that should have saved so should be able to jump right in and what have we done wrong has happened let's see so we trace our steps so let's take a look let's start fresh let's go to our UI main menu widget load let's take a look at the binding here so on clicked we're going to load the game from the slot cast to the saved game we're going to get the coin Bank ah that's where I went wrong can I just do this now it's tight wrong so we'll say well we don't want from there do we that's dumb we want it from the save game get current level all right let's see if that'll work there we go actually don't never which level we were on let's go to the green one all right now it's a Q and if we hit play and load are we going to go - yeah there we go okay so we left off on the green level okay so I think that was largely what I wanted to show so we're picking up coins or storing the value on the pawn for the actual level we're in we're also adding that total to a the bank which gets pushed up to the game instance so it's persistent level to level and we're using save and load to write those out load them back in so yeah let's take a look and see what kind of questions we have see the question is why I have to cast two new save game if I'm creating it with new save game class excellent question that seemed odd to me as well when I first started messing with save games and I wasn't quite sure why that was I am definitely gonna ask somebody because it definitely seems like let's see that was on our player controller wasn't it a new player controller yeah so it seems like here we should be able to just promote this to a variable and that'll be our new save game I'm not exactly sure why I'm sure there's a great reason that I'm just not aware of at the moment but yes you actually have to cast to it first all right those are actually all of the questions that I have written for me right now so yeah I guess that'll be it for today if you do want to ask more questions jump into the thread on the forums I'll be happy to get in there and try to answer some of those for you also I would like to promote that this Thursday I believe it is we are doing the match 3 livestream so I'll be on here with Loren we'll talk about that project a little bit some of the optimizations we made on the art side and she'll talk about program retype stuff I have no idea of no understanding of so um yeah I think that's it for today thank you very much
Info
Channel: Unreal Engine
Views: 70,314
Rating: 4.9170423 out of 5
Keywords: Unreal Engine, Epic Games, UE4, UDK, Unreal, Game Engine (Software Genre)
Id: 0LG4hiisflg
Channel Id: undefined
Length: 65min 8sec (3908 seconds)
Published: Wed Nov 11 2015
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.