‫Hello and welcome.
‫In this lecture, we're going to learn about the game mode class in Unreal and we're going to see how
‫that allows us to right click and use the play from here.
‫Menu item to start from anywhere in our level.
‫Very useful for play testing.
‫Let's dive in and see how this works.
‫So one thing we don't typically do in Unreal is actually have our character in the world when we start.
‫We've seen in the past that often that character gets spawned in from a player start point.
‫And the reason for this, among other things, is that it allows us to be a bit more flexible about
‫how the player starts, so that if we were trying to play, test our level and wanted to start off already
‫on the cliff, we could right click on the cliff and go play from here.
‫If you try that out right now, you will notice that actually you just end up where we've placed the
‫character.
‫And the reason for that is that Unreal doesn't actually know what character we want to use.
‫Now, the way this typically gets solved is with a class called a game mode.
‫A game mode is essentially an actor that goes into your level and controls the rules for the game.
‫It tells it how to do things such as who should spawn where, what class we're going to use for the
‫player, as well as many other classes that define how a game works.
‫And in multiplayer games it can control things like how many players are allowed in in a given game.
‫It can also control wind conditions.
‫So things like capture the flag tends to be a game mode or battle royale, maybe a different sort of
‫game mode.
‫These are what we mean by the rules of a particular game or a particular match.
‫Now, if we go to the toolbar and click on the Blueprint dropdown, you can see that under the project
‫settings and under the world override, there is a menu item called game mode.
‫So we've got a setting for the project as a whole which tells us what is the default game mode for any
‫level that we create within our project.
‫And then we have the world override, which tells us this is the game mode for this particular level.
‫So you can see that at the moment we are using something called the BP Learning Kit game mode and that's
‫included with the kit and the project that we created.
‫So what we actually want to do is go and create our own and we're going to do this in Blueprint for
‫the time being.
‫But it is possible to create game modes in C++ and we will do that later on in the course.
‫So let's go to the project settings and game mode menu item and then go over to the create submenu.
‫And then what we're going to do is we're going to select a base to base this active class off of and
‫the one I recommend you use is the game mode base.
‫It's the one with the most minimal settings and things included.
‫So we don't get anything we don't need.
‫So we can click on the game mode base to create a new game mode and we got to choose a name like we
‫would for creating any other actor blueprint.
‫So we're going to call it beep always starting with that beep prefix.
‫When we're creating blueprints, it's going to be beep underscore obstacle assault game mode, and I'm
‫going to put that in the root of the content folder and hit save.
‫And now it's going to open up into its own tab.
‫And you can see that it is really just the actor tab exactly like any other actor.
‫And the interesting thing is if we go to our class defaults to have a look at the properties and settings
‫of the actor itself.
‫You can see that there is a section called classes and this is what dictates what player we can have
‫spawned into the world.
‫So this is what we want to change.
‫We want to find particularly the section called the default -- class.
‫We've talked about how -- is essentially the player that you play with.
‫So we're going to instead of the default --, select the dropdown and look for the BP third person
‫character.
‫That's the character that we've created and we're going to set that as the default.
‫Then we're going to hit, save and go back to the main level, go to the Blueprint dropdown and you
‫can still see we have this world override for this particular map.
‫We want to clear that so that the default project game mode is the one that's going to be used.
‫So let's select the world override and go to where it says select game mode class and we're going to
‫go and select none.
‫So now in the dropdown, if you have a look at it, you can see that it's saying that the game mode
‫is not overridden and we're using the project default game mode instead.
‫However, if you right click somewhere in the world and click play from here, it's still not going
‫to work.
‫And the reason for that is we still have this character.
‫In the level that wants to take over, essentially because we've told it to and we don't have any player
‫starts.
‫So I'd like to challenge you to fix that by adding a player start.
‫Remove the current character from the scene, open up the place actors panel and drag in the player.
‫Start actor, then test it out and see if when you play, you start from the player, start and also
‫see if you can right click somewhere and click play from here and see if that works to pause the video
‫and have a go.
‫Okay.
‫Welcome back.
‫So I'm going to start off by deleting the character here.
‫I got my place actors open.
‫Obviously we can do that from the quickly add to project, button the toolbar and open the place actors
‫panel that way and we can drag in a player start into the scene so place it it in roughly where the
‫character was hit play and boom our character is spawned in now what about that right click menu option?
‫So I'm going to go on top of our platform, right click play from here.
‫And here we are right on top of the platform allowing us to play, test our game far more easily than
‫if we had to go through the entire level every time.
‫Great stuff.
‫We've developed a bit of an understanding of the game mode class, really crucial in Unreal Game development.
‫I'll see you in the next lecture.