﻿1
00:00:04,380 --> 00:00:05,310
‫Hello and welcome.

2
00:00:05,310 --> 00:00:10,590
‫In this lecture, we're going to be learning about the difference between pawns such as this guy and

3
00:00:10,590 --> 00:00:12,630
‫characters such as this guy.

4
00:00:12,630 --> 00:00:19,350
‫And we're going to go ahead and set up a character blueprint and character C++ actor to look like this

5
00:00:19,350 --> 00:00:21,060
‫so that we've got our Wraith mesh.

6
00:00:21,060 --> 00:00:22,860
‫Let's dive in and see how it's done.

7
00:00:22,890 --> 00:00:29,850
‫Okay, so the first part of our greater project plan that we're going to want to start on is the player

8
00:00:29,850 --> 00:00:30,550
‫movement.

9
00:00:30,550 --> 00:00:31,620
‫That's number one.

10
00:00:31,620 --> 00:00:37,020
‫That's what we basically fundamental of most games, not just shooter games, then they would be going

11
00:00:37,020 --> 00:00:41,640
‫on to animation and shooting and health and enemy death and all those other things that we want to get

12
00:00:41,640 --> 00:00:42,060
‫to.

13
00:00:42,060 --> 00:00:45,660
‫But the first thing to tackle is the player movement.

14
00:00:46,050 --> 00:00:49,770
‫To do this, we're going to create a character class.

15
00:00:49,770 --> 00:00:51,030
‫Now, what's a character class?

16
00:00:51,030 --> 00:00:56,010
‫Well, first and foremost, there's a distinction between a pawn and a character.

17
00:00:56,130 --> 00:01:01,110
‫The pawn is anything that you can possess as a player.

18
00:01:01,110 --> 00:01:05,280
‫We'll talk more about possession later, but you'll have seen a little bit about it before already.

19
00:01:05,370 --> 00:01:10,320
‫But the idea here is that the pawn is the thing that is controlled by the player.

20
00:01:10,320 --> 00:01:10,890
‫A character?

21
00:01:10,890 --> 00:01:11,760
‫What's a character?

22
00:01:11,760 --> 00:01:15,120
‫Well, the first thing to say is the character is a pawn.

23
00:01:15,150 --> 00:01:17,760
‫It directly inherits from the pawn class.

24
00:01:17,760 --> 00:01:20,850
‫So it can do everything that the pawn can do.

25
00:01:20,850 --> 00:01:25,740
‫And more so a character is a specialization of a pawn.

26
00:01:26,130 --> 00:01:28,470
‫It adds character like features.

27
00:01:28,470 --> 00:01:29,760
‫Well, that's not very informative, Sam.

28
00:01:29,760 --> 00:01:33,030
‫What kind of things are character like about a character?

29
00:01:33,120 --> 00:01:39,930
‫Well, for example, movement moving around just like a normal person would do, moving around on the

30
00:01:39,930 --> 00:01:43,800
‫floor, being able to jump, being able to run, all that sort of stuff.

31
00:01:43,800 --> 00:01:49,500
‫That tends to be the domain of a character rather than a pawn, because pawns can fly around like spaceships,

32
00:01:49,500 --> 00:01:50,010
‫for example.

33
00:01:50,010 --> 00:01:53,730
‫They aren't people like, so that is what a character is like.

34
00:01:53,730 --> 00:01:59,130
‫And it also adds things like nav mesh movement, which we'll see more when we get to the AI section

35
00:01:59,130 --> 00:02:05,220
‫of this section, and that's going to help us move the character around, avoid obstacles and stuff

36
00:02:05,220 --> 00:02:06,300
‫like that.

37
00:02:06,720 --> 00:02:09,840
‫So how do we go ahead and create a character?

38
00:02:09,870 --> 00:02:13,350
‫Pretty much same as we would create any other C++ class.

39
00:02:13,350 --> 00:02:16,410
‫We're going to add new, new C++ class.

40
00:02:16,410 --> 00:02:21,210
‫And you can see here amongst the options, there is -- and there is character.

41
00:02:21,300 --> 00:02:28,200
‫Now I'm going to go ahead and give you a challenge right off the bat to create the Blueprint Children

42
00:02:28,200 --> 00:02:29,970
‫and the C++ for that matter.

43
00:02:29,970 --> 00:02:34,110
‫So we're going to, first of all, follow along to create the C++.

44
00:02:34,110 --> 00:02:35,940
‫This is not going to be part of your challenge.

45
00:02:35,940 --> 00:02:41,910
‫We're going to create ourselves a --, which I'm just going to call my -- for because we're not

46
00:02:41,910 --> 00:02:46,230
‫going to be using the --, but we're going to want to see the difference between that and the character.

47
00:02:46,230 --> 00:02:48,330
‫So go ahead and create that class.

48
00:02:48,540 --> 00:02:53,970
‫And once that goes ahead and finishes, you'll end up with a -- class, the sort of thing that you

49
00:02:53,970 --> 00:02:54,930
‫will have seen before.

50
00:02:54,930 --> 00:03:00,570
‫It's got to begin, play a tic, set up, play input component, etc. So what we're going to do is we're

51
00:03:00,570 --> 00:03:04,200
‫going to do the same procedure again, add new C++ class.

52
00:03:04,200 --> 00:03:07,290
‫This time we're going to create a character, go to next.

53
00:03:07,290 --> 00:03:12,690
‫And instead of calling it something unimaginative like my character, I'm going to call it the shooter

54
00:03:12,810 --> 00:03:18,120
‫character, which is more descriptive about what kind of character we're trying to create here.

55
00:03:18,120 --> 00:03:20,640
‫And we're going to go ahead and create that class.

56
00:03:20,970 --> 00:03:26,700
‫And when that's finished building, you can see that we get a pretty similar looking header file.

57
00:03:26,700 --> 00:03:32,850
‫In fact, pretty much everything is identical except for what it inherits from the character class instead

58
00:03:32,850 --> 00:03:34,380
‫of the --.

59
00:03:34,380 --> 00:03:36,900
‫It's very, very similar other than that.

60
00:03:36,900 --> 00:03:41,520
‫So to see the differences, we're going to have to look at the blueprint children of these things to

61
00:03:41,520 --> 00:03:43,740
‫see what kind of components are there.

62
00:03:44,160 --> 00:03:50,130
‫So that's going to be your challenge to follow along to create the C++, as I just did, and a blueprint

63
00:03:50,130 --> 00:03:55,050
‫child for each of those the my spawn and the shooter character.

64
00:03:55,050 --> 00:04:01,200
‫Then what differences can you see when you open up those two separate blueprints, pause a video and

65
00:04:01,200 --> 00:04:01,980
‫have a go?

66
00:04:02,010 --> 00:04:02,340
‫Okay.

67
00:04:02,340 --> 00:04:03,180
‫Welcome back.

68
00:04:03,180 --> 00:04:04,770
‫So let's give this a shot.

69
00:04:04,770 --> 00:04:12,390
‫If we go into the editor and I'm just going to navigate to the top of my content directory and then

70
00:04:12,390 --> 00:04:15,480
‫I'm going to add some new blueprints.

71
00:04:15,630 --> 00:04:19,020
‫So I'm going to right click create a blueprint class.

72
00:04:19,020 --> 00:04:25,320
‫And instead of inheriting from one of these, I'm going to select all classes and look for the my --

73
00:04:25,320 --> 00:04:28,380
‫class, which is a child of the pawn, as we can see.

74
00:04:28,380 --> 00:04:32,670
‫Select that one and go and create an override of that.

75
00:04:32,670 --> 00:04:39,540
‫I'm going to call it the BP underscore my pawn to use that convention, which helps us differentiate

76
00:04:39,540 --> 00:04:42,210
‫between the C++ and the blueprint.

77
00:04:42,390 --> 00:04:45,330
‫So I'm going to then right click and create another blueprint class.

78
00:04:45,330 --> 00:04:48,240
‫This time I'm going to be looking for the shooter character.

79
00:04:49,180 --> 00:04:50,530
‫And select that one.

80
00:04:50,530 --> 00:04:54,740
‫And predictably, I'm going to call that BP underscore shooter character.

81
00:04:54,760 --> 00:04:59,350
‫It kind of helps us in terms of not having to be too imaginative about naming things.

82
00:04:59,350 --> 00:05:02,350
‫You don't want to be imaginative about naming those blueprint children.

83
00:05:02,380 --> 00:05:06,910
‫You just want to be able to say it's going to be exactly the same name just with BP underscore on the

84
00:05:06,910 --> 00:05:07,480
‫front.

85
00:05:07,630 --> 00:05:13,360
‫So let's go ahead and open those two up and dock them to the main window so we can compare them nice

86
00:05:13,360 --> 00:05:14,100
‫and easily.

87
00:05:14,110 --> 00:05:19,660
‫Open up the shooter character dot to the main window and straightaway we can see some differences.

88
00:05:19,870 --> 00:05:24,420
‫The pawn basically has nothing going on in the component view.

89
00:05:24,430 --> 00:05:28,030
‫It has a default scene root and nothing else.

90
00:05:28,540 --> 00:05:32,440
‫If we go over to the shooter character, however, you can see there's a few more things going on.

91
00:05:32,470 --> 00:05:39,730
‫For a start, we have got ourselves a capsule component here, which is kind of implying already that

92
00:05:39,730 --> 00:05:44,110
‫it's expecting a humanoid shape to fit inside that capsule.

93
00:05:44,110 --> 00:05:50,470
‫The capsule is for doing rough physics and manipulation or collision with the terrain.

94
00:05:50,470 --> 00:05:54,610
‫And then obviously something that fits inside that very nicely is a humanoid character.

95
00:05:54,640 --> 00:05:59,590
‫We've got an arrow component which just basically tells us which way is forward for this character.

96
00:05:59,710 --> 00:06:02,350
‫And then we have a mesh, which is an inherited.

97
00:06:02,350 --> 00:06:03,810
‫It's inherited from the C++.

98
00:06:03,820 --> 00:06:09,070
‫In fact, it's inherited from two levels up because we haven't defined any meshes here in the A Shooter

99
00:06:09,070 --> 00:06:09,690
‫character.

100
00:06:09,700 --> 00:06:14,130
‫They must have been defined up in the A character class instead.

101
00:06:14,140 --> 00:06:21,520
‫So that mesh component is trickling all the way down here to this blueprint class and it doesn't have

102
00:06:21,520 --> 00:06:23,530
‫anything in that mesh just yet.

103
00:06:23,530 --> 00:06:26,890
‫So we can go ahead and put a mesh in there.

104
00:06:26,890 --> 00:06:28,000
‫So let's go ahead and try that.

105
00:06:28,000 --> 00:06:31,240
‫Go over to the details pane to the skeletal mesh.

106
00:06:31,240 --> 00:06:34,720
‫And we want to basically put in our Wraith character.

107
00:06:34,720 --> 00:06:37,540
‫So I'm just going to select Wraith in here and there we go.

108
00:06:37,540 --> 00:06:39,910
‫It has put him in a little bit off the ground.

109
00:06:39,910 --> 00:06:43,630
‫So what I want to do is go ahead and adjust his feet.

110
00:06:43,750 --> 00:06:48,340
‫So they meet up with the bottom of the capsule as best I can manage.

111
00:06:48,620 --> 00:06:50,920
‫Looks like I pretty much got that right first time.

112
00:06:50,920 --> 00:06:57,070
‫And then we want to also align him so that he is facing towards that forward arrow so we can do a little

113
00:06:57,070 --> 00:07:01,930
‫bit of rotation magic 90 degrees that way and we are golden.

114
00:07:01,930 --> 00:07:04,870
‫I was hitting the R key to get to the rotation widget, by the way.

115
00:07:04,870 --> 00:07:12,130
‫Or you could use these little widgets at the top of top right of your viewport to get between your translation

116
00:07:12,130 --> 00:07:13,460
‫and rotation.

117
00:07:13,480 --> 00:07:17,650
‫Another thing that's worth noting here in the component hierarchy, apart from the fact it's got this

118
00:07:17,650 --> 00:07:23,050
‫mesh, the arrow and the capsule component is we've got this character movement component.

119
00:07:23,050 --> 00:07:29,080
‫This is what is entirely responsible for giving it character like movement, being able to walk and

120
00:07:29,080 --> 00:07:34,240
‫run, etc. You can see here in the details pane we've got a bunch of movement settings, we've got the

121
00:07:34,240 --> 00:07:35,320
‫gravity scale.

122
00:07:35,320 --> 00:07:39,990
‫So you could make it look like we're playing on Mars or on the moon or on Jupiter.

123
00:07:40,000 --> 00:07:42,670
‫Whatever you want to do, you can change the gravity scale can be fun.

124
00:07:42,790 --> 00:07:49,570
‫We've got default movement types for whether we are on land, whether we're on water, all this kind

125
00:07:49,570 --> 00:07:53,980
‫of stuff, walking, jumping, information network stuff.

126
00:07:53,980 --> 00:07:56,650
‫This automatically works well in multiplayer games.

127
00:07:56,650 --> 00:08:01,960
‫It's got all of that built in, so basically lots of stuff already being done for us here.

128
00:08:01,960 --> 00:08:06,610
‫So that's why we want to use a character over a pawn where we would have to write all of this movement

129
00:08:06,610 --> 00:08:08,950
‫code from scratch if we use the character.

130
00:08:08,950 --> 00:08:15,310
‫It's already set up with this character movement component for us, and that's far from being all of

131
00:08:15,310 --> 00:08:17,170
‫the things that the character provides for us.

132
00:08:17,170 --> 00:08:22,960
‫It also provides lots of niceties and nice functions that we can call in the base class to get our job

133
00:08:22,960 --> 00:08:24,250
‫done even more easily.

134
00:08:24,250 --> 00:08:26,650
‫We'll be seeing that in upcoming lectures.

135
00:08:26,650 --> 00:08:32,500
‫So the final thing we might want to do is make sure that this character is the pawn that gets spawned

136
00:08:32,500 --> 00:08:34,000
‫in our map.

137
00:08:34,000 --> 00:08:38,050
‫So the way I'm going to do this is going to the root of our content again.

138
00:08:38,050 --> 00:08:39,070
‫And this is revision.

139
00:08:39,070 --> 00:08:45,850
‫So many challenge for you if you want it, well, you could go ahead and create a clone of this map

140
00:08:45,940 --> 00:08:52,950
‫and a blueprint game mode set from this map that will spawn our BP shooter character.

141
00:08:53,290 --> 00:08:57,010
‫I do encourage you to attempt these mini challenges as well as the main big challenge.

142
00:08:57,010 --> 00:09:00,340
‫I'm going to move on and give no challenge slide for that one.

143
00:09:00,340 --> 00:09:07,030
‫So we've got the modular sci fi season one starter bundle collection maps, got map one here.

144
00:09:07,030 --> 00:09:12,550
‫I'm actually going to just go ahead and copy that into the route of my project for now and we can reorganize

145
00:09:12,550 --> 00:09:17,320
‫things a little bit later as the route gets a little bit more stuff in it and the organizational structure

146
00:09:17,320 --> 00:09:18,550
‫becomes clearer.

147
00:09:18,790 --> 00:09:23,170
‫I'm going to rename that map to Sandbox.

148
00:09:23,680 --> 00:09:29,980
‫I'm going to set it as the project default by going to project settings, maps and modes and then changing

149
00:09:29,980 --> 00:09:35,830
‫it from Map one to Sandbox for both the game and the editor.

150
00:09:38,020 --> 00:09:39,670
‫Then I'm going to make a game mode.

151
00:09:39,670 --> 00:09:42,760
‫So I'm going to right click and create a blueprint class.

152
00:09:42,760 --> 00:09:50,290
‫I'm going to create a game mode base blueprint, call it beep, underscore shooter game mode.

153
00:09:50,930 --> 00:09:52,630
‫I'm going to open up that.

154
00:09:52,630 --> 00:09:58,180
‫I don't need any C++ in this base class, so I'm basically not deriving it from C++.

155
00:09:58,180 --> 00:10:05,380
‫But once we do need it, we can always repair and blueprints to C++ classes of our own devising.

156
00:10:05,560 --> 00:10:08,590
‫So what I'm going to do is go over to the details.

157
00:10:08,590 --> 00:10:14,440
‫If that's not selected for you need to go to class defaults here in the top bar and then you can go

158
00:10:14,440 --> 00:10:20,860
‫to classes section and find the should be something like the default -- class like so.

159
00:10:20,860 --> 00:10:25,900
‫And we're going to look for the BP shooter character on the blueprint version because it's got the mesh

160
00:10:25,900 --> 00:10:33,370
‫set up and then we're going to go back to our sandbox, open up our sandbox and change out its game

161
00:10:33,370 --> 00:10:33,970
‫mode.

162
00:10:33,970 --> 00:10:39,730
‫Now, the reason I've created a sandbox is because I don't want to be editing the original map, because

163
00:10:39,730 --> 00:10:43,960
‫I might always want to go back to that one for reference if I've mucked up my sandbox.

164
00:10:44,200 --> 00:10:50,680
‫So let's go to the blueprints dropdown in the top bar and select the game modes currently set to game

165
00:10:50,680 --> 00:10:51,520
‫mode base.

166
00:10:52,030 --> 00:10:58,120
‫I'm going to select instead the BP underscore shooter game game mode, shooter game mode, rather.

167
00:10:58,270 --> 00:11:03,280
‫And the final piece of the puzzle is going to be to put in a player, start somewhere.

168
00:11:03,280 --> 00:11:08,080
‫In actual fact, I didn't realize this, but the map already contains a player start.

169
00:11:08,080 --> 00:11:14,050
‫So adding this extra one means that you can now accidentally spawn in two separate places.

170
00:11:14,050 --> 00:11:16,180
‫We'll fake this later on in the course.

171
00:11:16,180 --> 00:11:20,110
‫But just so you know, if you end up spawning in a different location and you're getting confused,

172
00:11:20,110 --> 00:11:20,890
‫that's why.

173
00:11:20,890 --> 00:11:24,160
‫So go to your place, actors tab over to the left.

174
00:11:24,160 --> 00:11:29,260
‫If you haven't got it, go to window and select a place actors to make it show up.

175
00:11:29,350 --> 00:11:32,290
‫And we want basic actors and we want the player start act.

176
00:11:32,290 --> 00:11:37,090
‫If you just go ahead and bring that in, it gives us this little capsule with a forward arrow that shows

177
00:11:37,090 --> 00:11:41,560
‫us where our pawn is going to spawn so we can go ahead and hit play.

178
00:11:41,560 --> 00:11:45,550
‫And it's not immediately obvious whether this has worked or not.

179
00:11:45,550 --> 00:11:53,470
‫So what you've got to do is go to F eight to eject from your pawn to possess it, and if you turn around,

180
00:11:53,470 --> 00:11:54,190
‫you can see that.

181
00:11:54,190 --> 00:11:56,980
‫Sure enough, we have got our character here.

182
00:11:56,980 --> 00:12:00,850
‫He just had a camera somewhere inside his groin, unfortunately.

183
00:12:00,850 --> 00:12:04,450
‫And so we are going to fix that later on.

184
00:12:04,450 --> 00:12:12,640
‫But at the moment we were have got our mesh in place and we are going to be continuing from this to

185
00:12:12,640 --> 00:12:18,580
‫fix up the animations, get a third person character and so on, and get it moving, most importantly.

186
00:12:19,570 --> 00:12:23,740
‫So we've got the correct shooter character spawning at the moment.

187
00:12:23,740 --> 00:12:25,180
‫It's not a third person camera.

188
00:12:25,180 --> 00:12:26,590
‫We're going to fix that later on.

189
00:12:26,590 --> 00:12:30,190
‫But first of all, we're going to get our movement working.

190
00:12:30,190 --> 00:12:32,590
‫So let's dive on to the next lecture.

