Welcome back.
We've now constructed our ability system component and attribute set.
But I mentioned there was something related to replication that we were going to do that still needs
to be done and that needs to be done where we construct our ability system component.
We've already set our ability system components to replicate here in Aura Enemy.
I'll drag that over to the left and here in Aura Player State, I'll drag that here as well.
We see that we're setting ability system component to replicate for both of these classes.
Now the thing that also needs to be done is the following.
I'm going to take ability system component and call the function set replication mode.
Now notice set replication mode takes an enum of type E gameplay effect replication mode and notice
that it has some comments here, but it gets cut off.
That means the comment is a little bit longer than what we're seeing here.
So what I'd like to do is browse to this function set replication mode.
I'm going to right click go to declaration or usages in Visual Studio.
You can peek or go to the definition, but here we see set replication mode.
It's just setting a variable on the ability system component called replication mode to what we set
it.
But I'd like to actually browse now to gameplay effect replication mode.
Let's right click and go to that definition that's going to open up ability system component.
And here we see some comments.
Let's see what it says.
It says how gameplay effects will be replicated to clients.
Now I know we haven't learned about gameplay effects yet, so don't worry too much about this.
We're going to keep this in mind for when we do start learning about gameplay effects.
We'll circle back to this later, but let's just read what the three options do for us in this enum.
We have minimal and it says only replicate minimal gameplay effect info.
Note This does not work for owned ability system components use mixed.
Instead, we'll talk about what owned ability system components means.
Now we have mixed.
It says only replicate minimal gameplay effect info to simulated proxies, but full info to owners and
autonomous proxies.
And then we have full which says replicate full gameplay info to all.
Now what does this mean by minimal gameplay effect info and full gameplay info?
Exactly what does that really amount to?
Well, here's exactly what it means.
If we set replication mode to full, then gameplay effects will be replicated to all clients.
So we have full replication for gameplay effects.
When a gameplay effect happens, that gameplay effect will be replicated.
Pretty simple.
Now for mixed gameplay effects are replicated to the owning client only.
Now again, we haven't learned what gameplay effects are, but it's enough to know for now that they're
used to change attribute values.
We use gameplay effects to do things like cause damage or heal the player, and if that kind of change
happens on the server, the client should know about it.
If the character's health goes down, the client is going to want to show that in the HUD, maybe a
health bar of some kind.
Now for mixed gameplay cues and gameplay tags are replicated to all clients.
Now those are a different story and we haven't learned about those yet.
But in mixed, those are replicated to all clients that will be significant to us once we learn what
those things are.
And for minimal we see that gameplay effects are not replicated.
Gameplay cues and gameplay tags are so gameplay effects things that change our attributes.
Values are going to have different replication behavior based on this replication mode.
So the question is which mode do we choose in which situation?
And that's why this table here is useful because, well, these are the rules of thumb here.
Gameplay effects being replicated to all clients is not necessarily something that you're going to ever
want.
So you'd only really ever do that in single player where there's just one game playing.
It's a single standalone game.
But for multiplayer player controlled characters like Aura, we're going to want those gameplay effects
replicated to the owning client.
That's going to be us.
If we are a client, then if an effect is applied to us on the server, we want to be notified of that.
We want it to be replicated so that we can update our HUD and respond accordingly on our client machine.
And just remember, gameplay cues and gameplay tags are replicated as.
Well and then for minimal gameplay effects are not replicated.
So this is good for AI controlled characters where a gameplay effect may happen on the server, but
it doesn't necessarily mean that that gameplay effect should be replicated down to clients.
However, gameplay cues and gameplay tags will still be replicated to all clients, even for a character
whose ability system component is set to minimal replication mode.
So we're going to follow these rules of thumb.
We're going to set the ability system component on our player state for our player controlled character
to mixed and we'll set the ability system component on the enemy or an enemy to minimal as it's a AI
controlled character.
And we'll be programming this project for multiplayer.
And the cool thing is you can program a project for multiplayer and it will still work in single player.
The reverse is not true.
You can't program a single player game and then just try to play it in multiplayer and expect anything
to work.
No multiplayer has to be designed from the get go and that's what we're doing.
So let's set the replication mode for our ability system components.
Now how do we do that?
Well, the ability system component class has the set replication mode function.
So let's use that and that will be your quest for this video.
I want you to set the replication mode.
I want you to do this using set replication mode and use the rules of thumb that we discussed.
You're going to do this for the player controlled character.
You're going to do that in the player state constructor and you're going to do this for the enemy character
as well in the Aura Enemy constructor.
So pause the video and set the replication mode now.
Okay.
So I'm going to go ahead and close out of ability system components and CP and here in Aura Player State,
I know that this is for the player controlled character, so I'm going to set this to E game play effect
replication mode mixed as per our rules of thumb.
I'm going to copy this line and go into Aura Enemy and we'll set that here.
And because this is the AI controlled character we're going to use minimal for this one we can compile.
And now our replication mode is set for our ability system components.
Excellent job and I'll see you in the next video.