WEBVTT

00:07.040 --> 00:08.330
Welcome back.

00:08.540 --> 00:14.030
In this video, we're going to create our player state class and assign that to aura.

00:14.240 --> 00:16.550
So let's go into C plus plus classes.

00:16.580 --> 00:17.990
Aura public.

00:17.990 --> 00:22.390
And we have the player class which contains our player controller.

00:22.400 --> 00:27.410
I'd like to create our player state class here in this folder as well.

00:27.440 --> 00:32.960
So I'm going to make a new C plus plus class and find the player state base class.

00:32.960 --> 00:34.130
Here it is.

00:34.160 --> 00:42.050
Clicking next and we'll call this aura player state and create class.

00:43.980 --> 00:49.820
I'm going to close out of the editor and wait for that class to appear right here in writer.

00:49.830 --> 00:50.970
And here it is.

00:50.970 --> 00:55.320
So we have or a player state dot H and Dot CP.

00:55.980 --> 01:04.050
I'm going to go ahead and close the other tabs and just have my header and CP files open here and I'd

01:04.050 --> 01:06.630
like to create a constructor straight away.

01:06.660 --> 01:14.970
So I'll make a public section and add an Aura player state constructor here and generate the definition

01:14.970 --> 01:15.840
for it.

01:16.200 --> 01:24.030
And I'd just like to set one thing here in the player state, and that's the net update frequency.

01:24.710 --> 01:26.600
I'm going to set that to 100.

01:26.630 --> 01:28.810
Now, what is the net update frequency?

01:28.820 --> 01:34.270
Well, this is how often the server will try to update clients.

01:34.280 --> 01:41.930
So as changes occur on the server for the player state, then the server will be sending updates out

01:41.930 --> 01:46.310
to all clients so that they can sync up with the server version.

01:46.310 --> 01:53.630
So any variables that should be replicated, they'll update and the server will try to meet this net

01:53.630 --> 01:55.880
update frequency if it can.

01:55.910 --> 02:03.380
Now normally the net update frequency is quite low for the player state, something like half a second.

02:03.410 --> 02:10.310
So if we're going to have our ability system component and our attribute set on the player state, we

02:10.310 --> 02:13.220
should set this to update faster.

02:13.220 --> 02:21.140
And in fact, in the Lyra project, in games like Fortnite, where the ability system component and

02:21.140 --> 02:27.210
attribute set are on the player state, they set the net update frequency to a higher value and that's

02:27.210 --> 02:28.740
usually about 100.

02:28.770 --> 02:34.470
Now we'll talk more about replication throughout the course and the significance of things changing

02:34.470 --> 02:37.890
on the server versus clients and what all that means.

02:37.890 --> 02:45.360
But for now, we're just going to have this set to a value of 100 and I'm going to go ahead and compile

02:45.360 --> 02:51.150
and launch the editor so that I can make a blueprint based on ora player State.

02:51.630 --> 02:57.060
So now the next step is for us to create a blueprint based on our new player state class.

02:57.090 --> 03:03.120
We'll right click on a player state, create a blueprint based on it, and we'll stick it in blueprints

03:03.120 --> 03:04.230
and we have player.

03:04.230 --> 03:11.250
We'll stick it in that folder and we'll call this BP underscore or a player state.

03:11.280 --> 03:12.810
We'll create that class.

03:12.810 --> 03:17.430
And so far, there's really nothing to do here in the blueprint.

03:17.460 --> 03:20.460
We're just going to go ahead and save and close it.

03:20.460 --> 03:24.430
But we do want to make sure that that is the player state we're using.

03:24.450 --> 03:31.140
So we'll go to our blueprints folder into game and open BP or a game mode where we can set the player

03:31.140 --> 03:32.330
state class here.

03:32.340 --> 03:39.120
We're going to open the dropdown and set this to BP or a player state and compile and save.

03:39.120 --> 03:45.990
And now we successfully have created our own custom player state class and Aura is using it.

03:46.170 --> 03:48.870
Now, we haven't done anything in this class.

03:48.870 --> 03:55.210
We can press play and run around and really we won't see any difference because, well, our player

03:55.210 --> 04:00.940
state isn't really doing anything, but we know that that is where our ability system component and

04:00.940 --> 04:06.910
our attribute set are going to live for our player controlled character called Aura.

04:06.910 --> 04:08.380
And for the enemies.

04:08.380 --> 04:14.470
We know that the ability system component and attribute set are going to go on the enemy class itself

04:14.470 --> 04:20.380
and we'll learn the different nuances and things we have to consider when doing it one way versus the

04:20.380 --> 04:20.950
other.

04:20.950 --> 04:27.790
So now what's left to do is to start creating those gameplay ability system classes and we'll do that

04:27.790 --> 04:28.450
next.
