WEBVTT

00:06.860 --> 00:07.970
Welcome back.

00:08.000 --> 00:15.170
Thus far, our gameplay effects that affect our health are reaching in to our attribute sets and changing

00:15.170 --> 00:17.150
the value of health directly.

00:17.180 --> 00:23.360
Now, in more complicated RPG style games with gas, this is not typically the way we do it.

00:23.360 --> 00:30.650
And that's because whenever we apply damage to an enemy, for example, there are a number of calculations

00:30.650 --> 00:37.730
that should be made, and those calculations have to do with attributes both on the attacker and the

00:37.730 --> 00:38.480
victim.

00:38.510 --> 00:45.620
For this reason, to keep the mathematics simple, we often use a placeholder attribute that behaves

00:45.620 --> 00:52.520
as an intermediary, allowing us to perform all of the math that we need to perform before actually

00:52.520 --> 00:54.690
setting the value of the health.

00:54.710 --> 01:01.820
In the case of damage, these intermediary values are referred to as meta attributes.

01:01.970 --> 01:06.990
Now, here's the difference between a meta attribute and a normal attribute.

01:07.020 --> 01:16.130
A normal attribute is often replicated and it can be changed on the server and replicated down to clients.

01:16.140 --> 01:23.860
Whereas a meta attribute, on the other hand is not replicated and it's really just a temporary placeholder.

01:23.880 --> 01:31.110
We only use these on the server to perform calculations and after those calculations are performed we

01:31.110 --> 01:35.800
can then apply the change to the real attribute that matters.

01:35.820 --> 01:42.930
Now, in the case of damage, for example, we may have a meta attribute called incoming damage.

01:43.050 --> 01:45.090
Now it's not replicated.

01:45.090 --> 01:46.890
This is a meta attribute.

01:46.920 --> 01:48.600
Now here's how it works.

01:48.690 --> 01:53.180
Let's say a gameplay effect is going to apply damage.

01:53.190 --> 01:58.140
Let's say this gameplay effect says I'm applying 11 damage to you.

01:58.170 --> 02:05.340
Now, rather than subtracting 11 from the health of the victim, the gameplay effect is going to add

02:05.340 --> 02:09.690
11 points to the incoming damage meta attribute.

02:09.960 --> 02:14.610
Now we have ways to respond to attribute changes in the attribute set.

02:14.640 --> 02:21.120
For example, we can use post gameplay effect, execute and check to see if that attribute that's changed

02:21.120 --> 02:23.700
is the incoming damage meta attribute.

02:23.730 --> 02:27.690
Now if it is, we can perform any necessary calculations.

02:27.690 --> 02:33.780
We can determine if there was a block by taking in the victim's block chance we can determine if there

02:33.780 --> 02:40.200
was a critical hit, if there needs to be an intelligence bonus in the case of magical damage, for

02:40.200 --> 02:43.830
example, or does there need to be a strength bonus?

02:43.830 --> 02:48.020
Maybe it's physical damage and strength boosts physical damage.

02:48.030 --> 02:55.260
Whatever the case, we perform any of those calculations to determine the final real amount of damage

02:55.260 --> 02:56.490
that should be caused.

02:56.490 --> 03:03.680
And then we take that attribute in this case health and subtract that number from the health.

03:03.690 --> 03:12.230
So the gameplay effect is not the actual decider of how much health is subtracted from the health attribute.

03:12.240 --> 03:18.210
It's the rules that we set based on those mathematical equations that determines the final value.

03:18.390 --> 03:25.740
So this incoming damage meta attribute will be set by these damage gameplay effects and the attribute

03:25.740 --> 03:32.880
set will perform any calculations it needs to and then zero out that incoming damage meta attribute.

03:32.880 --> 03:40.320
In a sense, it'll consume that value in its calculations and set the value of health and also respond

03:40.320 --> 03:42.780
in any other ways that we need to respond in.

03:42.810 --> 03:50.550
For example, when taking damage, perhaps we need to show some floating text popping up on the screen.

03:50.790 --> 03:56.040
Maybe that floating text is a different color depending on if there was a block or a critical hit.

03:56.430 --> 04:01.140
Maybe the attribute set determines that there was a debuff in response.

04:01.140 --> 04:06.030
If it was fire damage, maybe the victim will be burned for a moment.

04:06.030 --> 04:10.560
Or if it was lightning damage, the victim will be stunned for a moment.

04:10.770 --> 04:17.190
These are things we can do in response to receiving a change in our incoming damage meta attribute.

04:17.430 --> 04:23.670
So meta attributes are the way that we often see gas projects handling damage, and that's how we're

04:23.670 --> 04:26.220
going to implement damage in our project.

04:26.310 --> 04:28.050
So we'll do that next.

04:28.080 --> 04:29.310
I'll see you soon.
