﻿1
00:00:04,340 --> 00:00:05,870
‫Hello and welcome.

2
00:00:05,870 --> 00:00:11,870
‫In this lecture, we're going to learn about the game mode class in Unreal and we're going to see how

3
00:00:11,870 --> 00:00:15,890
‫that allows us to right click and use the play from here.

4
00:00:15,890 --> 00:00:20,120
‫Menu item to start from anywhere in our level.

5
00:00:20,120 --> 00:00:21,860
‫Very useful for play testing.

6
00:00:21,860 --> 00:00:24,380
‫Let's dive in and see how this works.

7
00:00:25,070 --> 00:00:31,550
‫So one thing we don't typically do in Unreal is actually have our character in the world when we start.

8
00:00:31,550 --> 00:00:36,560
‫We've seen in the past that often that character gets spawned in from a player start point.

9
00:00:36,560 --> 00:00:41,720
‫And the reason for this, among other things, is that it allows us to be a bit more flexible about

10
00:00:41,720 --> 00:00:46,940
‫how the player starts, so that if we were trying to play, test our level and wanted to start off already

11
00:00:46,940 --> 00:00:52,610
‫on the cliff, we could right click on the cliff and go play from here.

12
00:00:52,610 --> 00:00:58,790
‫If you try that out right now, you will notice that actually you just end up where we've placed the

13
00:00:58,790 --> 00:00:59,480
‫character.

14
00:00:59,480 --> 00:01:05,330
‫And the reason for that is that Unreal doesn't actually know what character we want to use.

15
00:01:05,540 --> 00:01:10,760
‫Now, the way this typically gets solved is with a class called a game mode.

16
00:01:10,760 --> 00:01:18,350
‫A game mode is essentially an actor that goes into your level and controls the rules for the game.

17
00:01:18,350 --> 00:01:24,080
‫It tells it how to do things such as who should spawn where, what class we're going to use for the

18
00:01:24,080 --> 00:01:28,130
‫player, as well as many other classes that define how a game works.

19
00:01:28,130 --> 00:01:34,280
‫And in multiplayer games it can control things like how many players are allowed in in a given game.

20
00:01:34,280 --> 00:01:36,410
‫It can also control wind conditions.

21
00:01:36,410 --> 00:01:42,770
‫So things like capture the flag tends to be a game mode or battle royale, maybe a different sort of

22
00:01:42,770 --> 00:01:43,430
‫game mode.

23
00:01:43,430 --> 00:01:48,020
‫These are what we mean by the rules of a particular game or a particular match.

24
00:01:48,290 --> 00:01:55,400
‫Now, if we go to the toolbar and click on the Blueprint dropdown, you can see that under the project

25
00:01:55,400 --> 00:02:00,590
‫settings and under the world override, there is a menu item called game mode.

26
00:02:00,590 --> 00:02:06,920
‫So we've got a setting for the project as a whole which tells us what is the default game mode for any

27
00:02:06,920 --> 00:02:09,200
‫level that we create within our project.

28
00:02:09,200 --> 00:02:16,490
‫And then we have the world override, which tells us this is the game mode for this particular level.

29
00:02:16,490 --> 00:02:23,060
‫So you can see that at the moment we are using something called the BP Learning Kit game mode and that's

30
00:02:23,060 --> 00:02:25,910
‫included with the kit and the project that we created.

31
00:02:25,910 --> 00:02:30,620
‫So what we actually want to do is go and create our own and we're going to do this in Blueprint for

32
00:02:30,620 --> 00:02:31,430
‫the time being.

33
00:02:31,430 --> 00:02:36,800
‫But it is possible to create game modes in C++ and we will do that later on in the course.

34
00:02:37,070 --> 00:02:45,140
‫So let's go to the project settings and game mode menu item and then go over to the create submenu.

35
00:02:45,140 --> 00:02:52,790
‫And then what we're going to do is we're going to select a base to base this active class off of and

36
00:02:52,790 --> 00:02:56,120
‫the one I recommend you use is the game mode base.

37
00:02:56,120 --> 00:03:00,320
‫It's the one with the most minimal settings and things included.

38
00:03:00,320 --> 00:03:02,000
‫So we don't get anything we don't need.

39
00:03:02,060 --> 00:03:08,930
‫So we can click on the game mode base to create a new game mode and we got to choose a name like we

40
00:03:08,930 --> 00:03:11,660
‫would for creating any other actor blueprint.

41
00:03:11,810 --> 00:03:15,800
‫So we're going to call it beep always starting with that beep prefix.

42
00:03:15,800 --> 00:03:24,350
‫When we're creating blueprints, it's going to be beep underscore obstacle assault game mode, and I'm

43
00:03:24,350 --> 00:03:28,130
‫going to put that in the root of the content folder and hit save.

44
00:03:28,550 --> 00:03:32,750
‫And now it's going to open up into its own tab.

45
00:03:32,750 --> 00:03:38,330
‫And you can see that it is really just the actor tab exactly like any other actor.

46
00:03:38,630 --> 00:03:44,150
‫And the interesting thing is if we go to our class defaults to have a look at the properties and settings

47
00:03:44,150 --> 00:03:45,710
‫of the actor itself.

48
00:03:45,710 --> 00:03:54,140
‫You can see that there is a section called classes and this is what dictates what player we can have

49
00:03:54,140 --> 00:03:55,910
‫spawned into the world.

50
00:03:55,970 --> 00:03:57,650
‫So this is what we want to change.

51
00:03:57,650 --> 00:04:02,150
‫We want to find particularly the section called the default -- class.

52
00:04:02,150 --> 00:04:06,560
‫We've talked about how -- is essentially the player that you play with.

53
00:04:06,560 --> 00:04:13,370
‫So we're going to instead of the default --, select the dropdown and look for the BP third person

54
00:04:13,370 --> 00:04:13,760
‫character.

55
00:04:13,760 --> 00:04:18,980
‫That's the character that we've created and we're going to set that as the default.

56
00:04:18,980 --> 00:04:26,090
‫Then we're going to hit, save and go back to the main level, go to the Blueprint dropdown and you

57
00:04:26,090 --> 00:04:30,770
‫can still see we have this world override for this particular map.

58
00:04:30,770 --> 00:04:36,230
‫We want to clear that so that the default project game mode is the one that's going to be used.

59
00:04:36,230 --> 00:04:44,300
‫So let's select the world override and go to where it says select game mode class and we're going to

60
00:04:44,300 --> 00:04:46,010
‫go and select none.

61
00:04:46,010 --> 00:04:50,330
‫So now in the dropdown, if you have a look at it, you can see that it's saying that the game mode

62
00:04:50,330 --> 00:04:55,100
‫is not overridden and we're using the project default game mode instead.

63
00:04:55,100 --> 00:05:00,530
‫However, if you right click somewhere in the world and click play from here, it's still not going

64
00:05:00,530 --> 00:05:01,040
‫to work.

65
00:05:01,040 --> 00:05:03,830
‫And the reason for that is we still have this character.

66
00:05:03,890 --> 00:05:10,460
‫In the level that wants to take over, essentially because we've told it to and we don't have any player

67
00:05:10,460 --> 00:05:11,150
‫starts.

68
00:05:11,150 --> 00:05:14,200
‫So I'd like to challenge you to fix that by adding a player start.

69
00:05:14,210 --> 00:05:21,200
‫Remove the current character from the scene, open up the place actors panel and drag in the player.

70
00:05:21,200 --> 00:05:25,700
‫Start actor, then test it out and see if when you play, you start from the player, start and also

71
00:05:25,700 --> 00:05:30,980
‫see if you can right click somewhere and click play from here and see if that works to pause the video

72
00:05:30,980 --> 00:05:32,090
‫and have a go.

73
00:05:35,180 --> 00:05:35,720
‫Okay.

74
00:05:35,720 --> 00:05:36,350
‫Welcome back.

75
00:05:36,350 --> 00:05:39,510
‫So I'm going to start off by deleting the character here.

76
00:05:39,510 --> 00:05:41,690
‫I got my place actors open.

77
00:05:41,720 --> 00:05:47,450
‫Obviously we can do that from the quickly add to project, button the toolbar and open the place actors

78
00:05:47,450 --> 00:05:53,600
‫panel that way and we can drag in a player start into the scene so place it it in roughly where the

79
00:05:53,600 --> 00:06:01,310
‫character was hit play and boom our character is spawned in now what about that right click menu option?

80
00:06:01,310 --> 00:06:05,810
‫So I'm going to go on top of our platform, right click play from here.

81
00:06:05,810 --> 00:06:12,290
‫And here we are right on top of the platform allowing us to play, test our game far more easily than

82
00:06:12,290 --> 00:06:15,200
‫if we had to go through the entire level every time.

83
00:06:15,200 --> 00:06:15,830
‫Great stuff.

84
00:06:15,830 --> 00:06:22,460
‫We've developed a bit of an understanding of the game mode class, really crucial in Unreal Game development.

85
00:06:22,460 --> 00:06:24,170
‫I'll see you in the next lecture.

