WEBVTT

00:07.030 --> 00:08.260
Welcome back.

00:08.290 --> 00:13.480
We've now constructed our ability system component and attribute set.

00:13.660 --> 00:19.720
But I mentioned there was something related to replication that we were going to do that still needs

00:19.720 --> 00:25.830
to be done and that needs to be done where we construct our ability system component.

00:25.840 --> 00:30.460
We've already set our ability system components to replicate here in Aura Enemy.

00:30.460 --> 00:36.330
I'll drag that over to the left and here in Aura Player State, I'll drag that here as well.

00:36.340 --> 00:42.850
We see that we're setting ability system component to replicate for both of these classes.

00:42.880 --> 00:46.410
Now the thing that also needs to be done is the following.

00:46.420 --> 00:52.990
I'm going to take ability system component and call the function set replication mode.

00:53.020 --> 01:01.690
Now notice set replication mode takes an enum of type E gameplay effect replication mode and notice

01:01.690 --> 01:05.200
that it has some comments here, but it gets cut off.

01:05.200 --> 01:09.650
That means the comment is a little bit longer than what we're seeing here.

01:09.650 --> 01:14.300
So what I'd like to do is browse to this function set replication mode.

01:14.300 --> 01:19.760
I'm going to right click go to declaration or usages in Visual Studio.

01:19.790 --> 01:25.070
You can peek or go to the definition, but here we see set replication mode.

01:25.070 --> 01:30.770
It's just setting a variable on the ability system component called replication mode to what we set

01:30.770 --> 01:31.070
it.

01:31.070 --> 01:35.810
But I'd like to actually browse now to gameplay effect replication mode.

01:35.810 --> 01:41.330
Let's right click and go to that definition that's going to open up ability system component.

01:42.230 --> 01:43.970
And here we see some comments.

01:43.970 --> 01:45.080
Let's see what it says.

01:45.110 --> 01:50.180
It says how gameplay effects will be replicated to clients.

01:50.210 --> 01:55.880
Now I know we haven't learned about gameplay effects yet, so don't worry too much about this.

01:56.000 --> 02:00.500
We're going to keep this in mind for when we do start learning about gameplay effects.

02:00.500 --> 02:07.310
We'll circle back to this later, but let's just read what the three options do for us in this enum.

02:07.310 --> 02:13.130
We have minimal and it says only replicate minimal gameplay effect info.

02:13.130 --> 02:18.530
Note This does not work for owned ability system components use mixed.

02:18.530 --> 02:23.540
Instead, we'll talk about what owned ability system components means.

02:23.630 --> 02:24.800
Now we have mixed.

02:24.800 --> 02:32.480
It says only replicate minimal gameplay effect info to simulated proxies, but full info to owners and

02:32.480 --> 02:33.800
autonomous proxies.

02:33.800 --> 02:39.430
And then we have full which says replicate full gameplay info to all.

02:39.440 --> 02:45.470
Now what does this mean by minimal gameplay effect info and full gameplay info?

02:45.470 --> 02:48.980
Exactly what does that really amount to?

02:49.010 --> 02:51.100
Well, here's exactly what it means.

02:51.110 --> 02:58.070
If we set replication mode to full, then gameplay effects will be replicated to all clients.

02:58.070 --> 03:01.280
So we have full replication for gameplay effects.

03:01.280 --> 03:05.330
When a gameplay effect happens, that gameplay effect will be replicated.

03:05.330 --> 03:06.410
Pretty simple.

03:06.410 --> 03:11.540
Now for mixed gameplay effects are replicated to the owning client only.

03:11.570 --> 03:17.630
Now again, we haven't learned what gameplay effects are, but it's enough to know for now that they're

03:17.630 --> 03:20.390
used to change attribute values.

03:20.420 --> 03:28.130
We use gameplay effects to do things like cause damage or heal the player, and if that kind of change

03:28.130 --> 03:30.950
happens on the server, the client should know about it.

03:30.950 --> 03:35.900
If the character's health goes down, the client is going to want to show that in the HUD, maybe a

03:35.900 --> 03:37.520
health bar of some kind.

03:37.550 --> 03:43.100
Now for mixed gameplay cues and gameplay tags are replicated to all clients.

03:43.100 --> 03:46.670
Now those are a different story and we haven't learned about those yet.

03:46.670 --> 03:53.210
But in mixed, those are replicated to all clients that will be significant to us once we learn what

03:53.210 --> 03:54.230
those things are.

03:54.230 --> 03:58.520
And for minimal we see that gameplay effects are not replicated.

03:58.700 --> 04:05.900
Gameplay cues and gameplay tags are so gameplay effects things that change our attributes.

04:05.930 --> 04:12.140
Values are going to have different replication behavior based on this replication mode.

04:12.140 --> 04:16.220
So the question is which mode do we choose in which situation?

04:16.220 --> 04:21.380
And that's why this table here is useful because, well, these are the rules of thumb here.

04:21.410 --> 04:28.520
Gameplay effects being replicated to all clients is not necessarily something that you're going to ever

04:28.520 --> 04:29.270
want.

04:29.270 --> 04:35.030
So you'd only really ever do that in single player where there's just one game playing.

04:35.030 --> 04:36.800
It's a single standalone game.

04:36.800 --> 04:42.920
But for multiplayer player controlled characters like Aura, we're going to want those gameplay effects

04:42.920 --> 04:45.350
replicated to the owning client.

04:45.380 --> 04:47.060
That's going to be us.

04:47.060 --> 04:55.550
If we are a client, then if an effect is applied to us on the server, we want to be notified of that.

04:55.550 --> 05:01.970
We want it to be replicated so that we can update our HUD and respond accordingly on our client machine.

05:01.970 --> 05:06.380
And just remember, gameplay cues and gameplay tags are replicated as.

05:06.450 --> 05:11.750
Well and then for minimal gameplay effects are not replicated.

05:11.760 --> 05:18.960
So this is good for AI controlled characters where a gameplay effect may happen on the server, but

05:18.960 --> 05:24.600
it doesn't necessarily mean that that gameplay effect should be replicated down to clients.

05:24.720 --> 05:32.520
However, gameplay cues and gameplay tags will still be replicated to all clients, even for a character

05:32.520 --> 05:36.330
whose ability system component is set to minimal replication mode.

05:36.420 --> 05:38.850
So we're going to follow these rules of thumb.

05:38.850 --> 05:46.590
We're going to set the ability system component on our player state for our player controlled character

05:46.590 --> 05:55.320
to mixed and we'll set the ability system component on the enemy or an enemy to minimal as it's a AI

05:55.350 --> 05:56.700
controlled character.

05:56.700 --> 06:00.870
And we'll be programming this project for multiplayer.

06:00.870 --> 06:07.660
And the cool thing is you can program a project for multiplayer and it will still work in single player.

06:07.690 --> 06:09.130
The reverse is not true.

06:09.160 --> 06:14.770
You can't program a single player game and then just try to play it in multiplayer and expect anything

06:14.770 --> 06:15.370
to work.

06:15.370 --> 06:20.020
No multiplayer has to be designed from the get go and that's what we're doing.

06:20.020 --> 06:24.220
So let's set the replication mode for our ability system components.

06:24.220 --> 06:25.300
Now how do we do that?

06:25.300 --> 06:30.730
Well, the ability system component class has the set replication mode function.

06:30.730 --> 06:35.200
So let's use that and that will be your quest for this video.

06:35.230 --> 06:37.630
I want you to set the replication mode.

06:37.660 --> 06:44.920
I want you to do this using set replication mode and use the rules of thumb that we discussed.

06:44.950 --> 06:48.100
You're going to do this for the player controlled character.

06:48.130 --> 06:53.470
You're going to do that in the player state constructor and you're going to do this for the enemy character

06:53.470 --> 06:56.290
as well in the Aura Enemy constructor.

06:56.290 --> 07:00.070
So pause the video and set the replication mode now.

07:02.890 --> 07:03.400
Okay.

07:03.400 --> 07:11.530
So I'm going to go ahead and close out of ability system components and CP and here in Aura Player State,

07:11.530 --> 07:17.920
I know that this is for the player controlled character, so I'm going to set this to E game play effect

07:17.920 --> 07:22.990
replication mode mixed as per our rules of thumb.

07:23.180 --> 07:28.330
I'm going to copy this line and go into Aura Enemy and we'll set that here.

07:28.330 --> 07:35.620
And because this is the AI controlled character we're going to use minimal for this one we can compile.

07:35.620 --> 07:40.480
And now our replication mode is set for our ability system components.

07:40.720 --> 07:44.350
Excellent job and I'll see you in the next video.
