Welcome back.
In this video, we're going to create our player state class and assign that to aura.
So let's go into C plus plus classes.
Aura public.
And we have the player class which contains our player controller.
I'd like to create our player state class here in this folder as well.
So I'm going to make a new C plus plus class and find the player state base class.
Here it is.
Clicking next and we'll call this aura player state and create class.
I'm going to close out of the editor and wait for that class to appear right here in writer.
And here it is.
So we have or a player state dot H and Dot CP.
I'm going to go ahead and close the other tabs and just have my header and CP files open here and I'd
like to create a constructor straight away.
So I'll make a public section and add an Aura player state constructor here and generate the definition
for it.
And I'd just like to set one thing here in the player state, and that's the net update frequency.
I'm going to set that to 100.
Now, what is the net update frequency?
Well, this is how often the server will try to update clients.
So as changes occur on the server for the player state, then the server will be sending updates out
to all clients so that they can sync up with the server version.
So any variables that should be replicated, they'll update and the server will try to meet this net
update frequency if it can.
Now normally the net update frequency is quite low for the player state, something like half a second.
So if we're going to have our ability system component and our attribute set on the player state, we
should set this to update faster.
And in fact, in the Lyra project, in games like Fortnite, where the ability system component and
attribute set are on the player state, they set the net update frequency to a higher value and that's
usually about 100.
Now we'll talk more about replication throughout the course and the significance of things changing
on the server versus clients and what all that means.
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
and launch the editor so that I can make a blueprint based on ora player State.
So now the next step is for us to create a blueprint based on our new player state class.
We'll right click on a player state, create a blueprint based on it, and we'll stick it in blueprints
and we have player.
We'll stick it in that folder and we'll call this BP underscore or a player state.
We'll create that class.
And so far, there's really nothing to do here in the blueprint.
We're just going to go ahead and save and close it.
But we do want to make sure that that is the player state we're using.
So we'll go to our blueprints folder into game and open BP or a game mode where we can set the player
state class here.
We're going to open the dropdown and set this to BP or a player state and compile and save.
And now we successfully have created our own custom player state class and Aura is using it.
Now, we haven't done anything in this class.
We can press play and run around and really we won't see any difference because, well, our player
state isn't really doing anything, but we know that that is where our ability system component and
our attribute set are going to live for our player controlled character called Aura.
And for the enemies.
We know that the ability system component and attribute set are going to go on the enemy class itself
and we'll learn the different nuances and things we have to consider when doing it one way versus the
other.
So now what's left to do is to start creating those gameplay ability system classes and we'll do that
next.