WEBVTT

00:06.870 --> 00:07.680
All right.

00:07.680 --> 00:10.320
So things are looking pretty good in this video.

00:10.350 --> 00:17.940
We're going to do a little bit of final polish and try to pinpoint any issues, any bugs, anything

00:17.940 --> 00:20.980
that doesn't look right before we continue.

00:21.000 --> 00:27.210
Now, one of the things that I want to fix right away, and I noticed when testing earlier was with

00:27.210 --> 00:34.260
my shaman, it's launching its fireballs too high, and that's because of the pitch override.

00:34.290 --> 00:36.360
See, it's going upward, right?

00:36.390 --> 00:41.340
The pitch override is in our enemy ranged attack.

00:41.340 --> 00:48.720
So if we go to ability system enemy abilities and open ranged attack where doing a pitch override here

00:48.720 --> 00:52.590
in spawn projectile and that pitch override is 25.

00:52.620 --> 00:56.970
Now our enemy Firebolt is based on that class.

00:56.970 --> 01:02.880
If we go to class settings, we see that it's based on a ranged attack and it does everything the same

01:02.880 --> 01:03.540
way.

01:03.540 --> 01:08.190
Aside from any variables that we set here in our class defaults.

01:08.200 --> 01:14.200
So what we need to do is take our ranged attack and promote these to two variables so we can choose

01:14.200 --> 01:19.920
not to have an override for our pitch in firebolt for the enemy.

01:19.930 --> 01:23.320
So I'm going to take that override pitch and promote it to a variable.

01:23.320 --> 01:31.600
And we can call this should override pitch and I'm going to take pitch override and promote that to

01:31.600 --> 01:32.440
a variable.

01:32.440 --> 01:36.340
And that can be pitch override.

01:36.340 --> 01:42.370
I'm going to expose both with the eye icon and come back to enemy firebolt and uncheck should override

01:42.370 --> 01:45.010
pitch and that should fix the problem.

01:45.100 --> 01:47.080
Let's just test and make sure.

01:48.290 --> 01:52.610
And sure enough, that fireball is not going high.

01:54.620 --> 02:02.000
I do want to show you something that is revealed about our system because they continue to attack.

02:02.030 --> 02:08.470
This gives us a unique opportunity to catch an issue and to show you the issue.

02:08.480 --> 02:12.650
I'm just going to drag in some of our ranged attacker demons.

02:12.650 --> 02:17.480
So I'm going to go to character demon and bring in a demon ranger.

02:17.570 --> 02:25.160
I'm going to delete the shaman and I'm going to duplicate this Ranger demon several times.

02:25.310 --> 02:27.860
So I have one, two, three, four.

02:27.860 --> 02:31.280
I'm going to highlight them all and duplicate it again.

02:31.280 --> 02:38.930
Now, this depends on your machine and what it's capable of, but I'm going to show the four here and

02:38.930 --> 02:43.250
take a look at the DPS as our demons are launching their rocks.

02:43.250 --> 02:48.320
This is something I noticed in testing and we're going to see what happens.

02:48.320 --> 02:49.760
Let's just press play.

02:50.390 --> 02:53.170
And we die right away.

02:53.180 --> 03:01.040
And of course, because we haven't prevented any attacks, once our character dies, the enemies continue

03:01.040 --> 03:01.490
to attack.

03:01.490 --> 03:02.450
But look right here.

03:02.450 --> 03:09.070
I showed the and notice it's now down to 40 and steadily dropping very rapidly.

03:09.080 --> 03:15.320
Now, when something like this happens, this is indicative of some kind of memory leak.

03:15.320 --> 03:15.710
Look at that.

03:15.710 --> 03:23.660
It's going down to sub 15 and it's really, really going to keep going down until we basically run out

03:23.660 --> 03:24.320
of memory.

03:24.350 --> 03:24.640
Right.

03:24.650 --> 03:28.970
We're already down to ten and that is definitely not normal.

03:28.970 --> 03:35.750
And the way you can tell that it's a memory leak as opposed to just bad performance, is that usually

03:35.750 --> 03:42.170
with bad performance, you go down to a baseline and you stay there for whatever it is you're doing.

03:42.170 --> 03:49.970
But if you're doing the same thing and that keeps going lower and lower and lower, see, right now

03:50.070 --> 03:51.120
it's not too bad.

03:51.120 --> 03:52.890
It's around 100.

03:53.010 --> 03:56.670
If it keeps getting lower, then you know something's wrong.

03:56.850 --> 04:03.240
Now, in addition to that, I'm noticing that those rocks, when they hit the ground, they appear to

04:03.240 --> 04:11.460
be spawning too many particles as really our particle system should only be spawning about 20 and our

04:11.460 --> 04:12.510
spawn burst.

04:12.510 --> 04:15.000
So something isn't right, right?

04:15.000 --> 04:18.390
Something is not happening as it should.

04:18.390 --> 04:23.820
And I suspect that we're getting too many projectiles.

04:23.820 --> 04:28.680
So first what I'm going to do is see how many projectiles we're actually spawning.

04:28.680 --> 04:30.120
So I'm going to close the editor.

04:30.120 --> 04:31.710
I'll go ahead and save it.

04:31.710 --> 04:35.070
And I'm going to go into my aura projectile.

04:35.430 --> 04:41.430
So let's go ahead and just close all tabs and open in the private folder.

04:41.430 --> 04:44.310
Actor or a projectile.

04:44.340 --> 04:48.150
And right here, I want to see how many of these were spawning.

04:48.150 --> 04:54.960
So essentially, just before we use play sound at location and spawn system at location, I'm going

04:54.960 --> 04:56.700
to use a log.

04:58.260 --> 05:06.210
With log temp warning text, and I'm going to see what the name of the projectile is.

05:06.210 --> 05:14.970
So I'm going to use percent s for a string and we'll just say spawned and just after the text we need

05:14.970 --> 05:15.840
that string.

05:15.840 --> 05:22.140
So I'm going to use an asterisk with get name and we'll print the name of the projectile we're spawning.

05:22.140 --> 05:23.640
So let's run in debug mode.

05:25.240 --> 05:25.930
All right.

05:25.930 --> 05:28.810
So we can go ahead and open up those asset editors.

05:28.810 --> 05:35.140
But really, I just want to open the output log docket in the layout and press play and see what happens

05:35.140 --> 05:35.740
now.

05:35.740 --> 05:37.720
Okay, We're seeing a lot of red.

05:37.750 --> 05:39.070
So that's one issue.

05:39.070 --> 05:43.110
I'm going to hit pause and we have an error here.

05:43.270 --> 05:49.720
Gameplay ability spec get magnitude called for data when magnitude had not yet been set by caller.

05:49.720 --> 05:52.420
So that's something we'll have to check out in a second.

05:52.420 --> 05:55.330
But for now, let's see what's going on here.

05:55.360 --> 05:59.380
Now, we're spawning an awful lot of rocks, right?

05:59.380 --> 06:01.540
So what's going on with that?

06:01.570 --> 06:06.700
Well, I'm going to delete all of these ranged attackers except for one.

06:06.700 --> 06:10.930
And let's see just how many rocks a single one of these is spawning.

06:12.590 --> 06:13.760
We're spawning.

06:13.760 --> 06:16.220
Looks like multiple rocks, right?

06:16.250 --> 06:17.450
Each time.

06:18.830 --> 06:21.890
Yes, definitely more than one each time.

06:21.980 --> 06:23.540
So that's an issue.

06:23.690 --> 06:25.480
So we'll get back to this error.

06:25.490 --> 06:27.230
We can fix that quite easily.

06:27.230 --> 06:31.450
But we do want to fix the fact that we're spawning more than one rock.

06:31.460 --> 06:35.420
So let's go to a ranged attack where we're spawning this rock.

06:35.420 --> 06:38.450
Here is our spawn projectile.

06:38.540 --> 06:43.550
And what I'm going to do is I'm going to place a print string before we call play montage and wait.

06:43.910 --> 06:50.240
That way we can see each time we're playing a montage, I'm going to say playing montage.

06:51.800 --> 06:59.420
And then after we receive the gameplay event, I'm going to print another string that says Event received,

06:59.450 --> 07:03.770
event received and event received can be yellow.

07:03.890 --> 07:05.810
We'll make it a different color there.

07:05.810 --> 07:10.400
So let's see what happens with our single one Ranged Demon.

07:11.860 --> 07:12.670
Okay.

07:13.510 --> 07:19.660
Now I'm seeing multiple events received and after Aura dies, it seems like it gets even worse.

07:19.660 --> 07:22.460
We're receiving lots and lots of events.

07:22.480 --> 07:25.430
Well, that's something we can fix pretty easily.

07:25.450 --> 07:28.870
Our wait gameplay event can be set to only trigger once.

07:28.900 --> 07:31.690
If I check that then press play.

07:32.840 --> 07:39.620
Now I see that I'm only receiving that event once and we're only spawning those particles once.

07:39.770 --> 07:41.840
So that's going to fix that problem.

07:41.840 --> 07:49.640
But let's just make sure that we don't have memory leaks by taking a whole bunch of copies of our ranged

07:49.640 --> 07:57.490
demon and having them all throw lots of rocks and see what that baseline performance should be.

07:57.500 --> 07:58.370
So I'm going to show.

07:59.420 --> 08:00.530
Press play.

08:00.560 --> 08:02.240
We're starting at 120.

08:02.270 --> 08:03.590
Looks pretty good.

08:03.620 --> 08:08.780
Now they're all throwing rocks and let's just let them all throw rocks for a while.

08:11.340 --> 08:13.810
Okay, so we were around 120.

08:13.830 --> 08:20.850
Now we're going down to about 110 and it's still going down and we should be at a baseline around right

08:20.850 --> 08:21.570
now.

08:23.050 --> 08:23.570
There we go.

08:23.590 --> 08:25.510
We're below 100.

08:26.270 --> 08:28.660
We'll give it a few more seconds.

08:28.670 --> 08:29.960
A couple more minutes.

08:31.500 --> 08:33.120
All right, We're down to 80.

08:34.040 --> 08:36.320
We'll let it go just a little more.

08:37.590 --> 08:43.080
But definitely we should be at some kind of baseline as nothing's really changing.

08:43.080 --> 08:47.010
We're only spawning rocks at basically the same rate.

08:47.010 --> 08:47.730
Pretty much.

08:47.730 --> 08:55.320
We're down to 64, so something is not right and I'm suspecting it has to do with those particles.

08:55.320 --> 08:57.570
So let's go to the particle system itself.

08:57.570 --> 09:02.520
We'll go to assets effects, combat and slingshot impact.

09:02.520 --> 09:03.350
Here it is.

09:03.360 --> 09:05.850
So let's see what's going on here.

09:05.850 --> 09:09.570
And one thing you should notice right away is for particle state.

09:09.570 --> 09:13.380
We see these to infinity signs, right?

09:13.380 --> 09:16.530
The infinity sign means that this is going to live forever.

09:16.530 --> 09:22.980
And if we click on particle state and check the checkbox kill particles when Lifetime has elapsed,

09:23.010 --> 09:25.590
well then that infinity sign is gone.

09:25.590 --> 09:31.980
So that infinity sign should jump out to us if we have killed particles when Lifetime has elapsed set

09:31.980 --> 09:33.780
to true for both of these emitters.

09:33.780 --> 09:40.440
Well, with that, let's just see what happens to our my computer can handle a little bit more.

09:40.440 --> 09:44.100
So I'm going to go ahead and do another row of these guys and press play.

09:44.760 --> 09:49.600
And I should see that hit some kind of baseline and stay there.

09:49.620 --> 09:57.120
Now I'm at around 120 FPS and it's fluctuating around there.

09:57.120 --> 09:59.250
It's not really changing much.

09:59.280 --> 10:05.100
It's about one 2119 and we're throwing an awful lot of rocks.

10:05.100 --> 10:08.050
So those particles are going away.

10:08.070 --> 10:13.620
They're actually getting killed when their lifetime has elapsed as opposed to before when they were

10:13.620 --> 10:16.530
not being killed, they were just staying around.

10:16.530 --> 10:20.250
And that would definitely be a form of memory leak.

10:20.250 --> 10:24.180
So that's something we have to be aware of with all of our particles.

10:24.180 --> 10:29.790
And now that we know that that's not an issue anymore, I'm going to go ahead and duplicate this row

10:29.790 --> 10:35.220
a couple more times and just make sure that our phps stays stable.

10:35.220 --> 10:41.940
So lots and lots of rocks and of course our PHP is lower, but that's not because of a memory leak,

10:41.940 --> 10:49.810
that's because we have just a lot more things going on on the screen as we have about 90, maybe close

10:49.810 --> 10:57.970
to 100, but fluctuating between 90 and 95 mostly, and it's staying constant, it's not going down.

10:57.970 --> 11:02.050
Whereas if we had that memory leak, let's go ahead and put it back in there.

11:02.050 --> 11:08.200
We'll go to particle state and uncheck kill particles with that memory leak.

11:08.200 --> 11:14.140
Now we should see the SPS go down very quickly, so we'll give it a few seconds.

11:16.840 --> 11:18.460
We're already down to 80.

11:18.490 --> 11:19.990
We're in the 70s.

11:29.500 --> 11:32.450
Down into the 60s you get the idea.

11:32.470 --> 11:37.180
So we'll make sure that that checkbox is checked for both of these.

11:37.210 --> 11:39.820
And that's going to fix the problem.

11:39.970 --> 11:42.760
Okay, so we have way too many demons in the world.

11:42.760 --> 11:47.380
That was kind of a stress test, but I'm going to take most of the demons and delete them.

11:47.380 --> 11:54.490
We'll leave one and let's go to our next issue that popped up, which was when we press play and look

11:54.490 --> 12:00.340
at the output log, we're getting some red text, so we're going to need to fix that and let's see what

12:00.340 --> 12:00.760
it says.

12:00.760 --> 12:11.200
It says F gameplay effects spec get magnitude called for data damage arcane on def default g damage

12:11.200 --> 12:14.020
when magnitude had not yet been set by caller.

12:14.020 --> 12:21.220
So it's getting a magnitude for a set by caller and it's doing it for arcane for lightning and for fire.

12:21.250 --> 12:23.170
Notice we don't see physical here.

12:23.200 --> 12:26.440
That's because those rocks are using physical damage.

12:26.440 --> 12:32.990
So it is getting a set by color magnitude, but it's checking all the damage types and we're getting

12:32.990 --> 12:38.990
an error printed to the output log when it attempts to get a set by color magnitude that isn't there.

12:38.990 --> 12:42.470
Now let's go ahead and go back into Cplusplus.

12:42.470 --> 12:49.310
I'm going to close the editor and or a projectile does not need this log anymore so I can remove that.

12:49.310 --> 12:53.750
And let's go into where we're getting a set by caller magnitude.

12:53.780 --> 12:55.070
Do you remember where?

12:55.600 --> 13:03.790
It would be an exact calc damage if we go to exact calc damage here in execute implementation, we're

13:03.790 --> 13:09.340
looping through each of our damage types and we're calling get set by caller magnitude here.

13:09.340 --> 13:13.480
And this function has additional optional parameters.

13:13.480 --> 13:17.340
One of them is a boolean for warn if not found.

13:17.350 --> 13:23.860
Basically, if we don't find a set by caller magnitude that we're looking for with this gameplay tag,

13:23.860 --> 13:25.480
then we need a warning.

13:25.480 --> 13:27.280
That's what that boolean is for.

13:27.280 --> 13:33.160
But in our case, attempting to get a set by caller magnitude that isn't there is a valid operation.

13:33.160 --> 13:38.500
We're checking for all of our damage types, so it's valid if we don't find one.

13:38.500 --> 13:41.320
We don't want to consider that an error or a warning.

13:41.320 --> 13:43.390
So we're going to pass false in for that.

13:44.610 --> 13:47.070
Now for default if not found.

13:47.100 --> 13:50.570
Why do we actually get an error when we don't find something?

13:50.580 --> 13:57.210
Well, if we right click on get set by caller magnitude and we go look at it, we'll see that error,

13:57.210 --> 14:04.590
its ability log error, it says get magnitude called for data percent s on def percent s when magnitude

14:04.620 --> 14:06.390
had not yet been set by caller.

14:06.420 --> 14:08.820
That's if one if not found is true.

14:08.850 --> 14:12.210
So that tells us what causes that error.

14:12.300 --> 14:16.080
So default if not found, can be zero.

14:16.110 --> 14:18.360
We don't have to pass anything in for that.

14:18.360 --> 14:21.810
So now we should no longer get that error message.

14:21.810 --> 14:23.160
We're suppressing that.

14:23.160 --> 14:24.990
So let's test that out.

14:26.650 --> 14:28.750
Okay, we're back in the editor.

14:29.020 --> 14:30.910
We got our asset editors open.

14:30.910 --> 14:33.340
Let's press play and open the output log.

14:33.340 --> 14:37.120
And we're seeing things are looking pretty good.

14:37.210 --> 14:39.200
We're not getting that error anymore.

14:39.220 --> 14:44.290
We are still printing some strings, so we're going to go back to our range attack and remove those

14:44.290 --> 14:45.300
print strings.

14:45.310 --> 14:48.550
We don't want to spam the screen anymore if we don't have to.

14:49.990 --> 14:52.090
That takes care of that.

14:52.660 --> 14:53.470
All right.

14:53.500 --> 14:54.680
Things are looking better.

14:54.700 --> 15:00.280
Notice we're taking less damage now because we're not getting hit by 3 or 4 rocks at a time anymore.

15:01.470 --> 15:02.640
That's looking good.

15:03.530 --> 15:07.190
Now we can also get our shaman back in.

15:09.300 --> 15:19.020
So we'll get our shaman and we can stress test the shaman as well by putting 3 or 4 of them in and seeing

15:19.020 --> 15:23.340
how this looks when they spawn in lots and lots of enemies.

15:23.370 --> 15:27.270
We can also eject so we can show the here.

15:28.590 --> 15:30.180
And I've already died.

15:30.180 --> 15:34.740
So no need to really worry about repossessing.

15:35.260 --> 15:43.060
But notice that with this many enemies in doing all of their thing, we find a baseline of about 50

15:43.090 --> 15:43.630
ish.

15:44.620 --> 15:47.680
And that's kind of a lot of things going on on the screen.

15:47.680 --> 15:54.850
So, you know, it's going to depend on, of course, what your specs are for your computer.

15:54.850 --> 16:01.480
But we found a baseline and it's not continuously going down, so that is a good thing.

16:02.710 --> 16:08.440
And we could just double check that fireball and make sure that it's not lingering around as well by

16:08.440 --> 16:16.510
going to assets effects, projectiles, firebolt And we can just check each of these.

16:16.510 --> 16:18.190
We'll just look at fire.

16:18.220 --> 16:22.750
I don't see any infinity signs we can check fire to.

16:24.590 --> 16:26.930
I don't see any infinity signs there.

16:30.410 --> 16:33.390
Kill particles is checked for these.

16:33.410 --> 16:35.600
We can go to fire three.

16:36.280 --> 16:37.300
Same thing.

16:37.300 --> 16:38.770
We're looking good there.

16:39.660 --> 16:42.240
And we have a fireball.

16:43.360 --> 16:44.080
Same thing.

16:44.080 --> 16:45.160
Those look good.

16:47.010 --> 16:48.960
And finally, let's go into fire.

16:48.960 --> 16:50.040
Explosion.

16:50.920 --> 16:53.170
And make sure there are no infinity signs.

16:53.170 --> 16:59.740
The infinity signs make this a lot easier to detect at first glance, so that one looks good.

16:59.740 --> 17:03.280
And of course, our second one looks good as well.

17:03.280 --> 17:05.800
So everything looks great.

17:05.830 --> 17:07.840
I'm going to close the slingshot impact.

17:07.870 --> 17:12.190
We're done with enemy Firebolt and for now, we're done with Ranged Attack.

17:13.670 --> 17:15.230
Things are looking good.

17:15.500 --> 17:18.350
We're going to remove a couple of those enemies.

17:19.620 --> 17:21.480
We're back up to 120.

17:22.470 --> 17:26.490
We have a good number of enemies on the screen.

17:27.790 --> 17:35.980
And we have a good idea of what the budget is for, how many things can go on at the same time on the

17:35.980 --> 17:36.710
screen.

17:36.730 --> 17:42.370
So at any given point in time, you want to try to limit how many things are going on at the same time

17:42.370 --> 17:46.020
and kind of gauge how that's going to affect your ops.

17:46.030 --> 17:52.660
But you should never have an ops drain steadily as that's indicative of a memory leak.

17:52.960 --> 17:53.590
All right.

17:53.590 --> 17:54.490
So great job.

17:54.490 --> 18:01.930
We have some good enemies and some really cool enemy behavior, especially for our shaman, which has

18:01.930 --> 18:06.850
the ability to attack and summon other creatures, which is really cool.

18:06.850 --> 18:11.290
And things are starting to look like an actual game.

18:11.290 --> 18:13.960
But we're not done by far.

18:13.960 --> 18:17.290
We're going to definitely want to do a lot more.

18:17.380 --> 18:19.120
For one, we need more abilities.

18:19.120 --> 18:20.980
That's coming up later on.

18:20.980 --> 18:28.490
But we also are going to want to get some kind of experience points when we kill enemies.

18:28.490 --> 18:36.110
So basically, every time we kill an enemy, we should see some kind of experience bar racking up experience.

18:36.110 --> 18:39.290
And when it fills up, we should level up, right?

18:39.290 --> 18:45.740
We should be able to advance to the next level and then we can do things like earn attribute points

18:45.740 --> 18:52.970
when we level up, use those attribute points to spend on our primary attributes with these plus buttons.

18:52.970 --> 18:55.310
We still haven't implemented that yet.

18:55.340 --> 18:56.480
We want to do that.

18:56.480 --> 19:03.830
And on top of that, we also want a spell menu where we can assign and reassign our spells to inputs

19:03.830 --> 19:07.310
and also gain spell points so we can level up our spells.

19:07.310 --> 19:13.790
It Wouldn't it be nice if we could upgrade our fireball ability to launch perhaps multiple fireballs

19:13.790 --> 19:16.640
depending on our firebolt ability level?

19:16.640 --> 19:21.530
And we also have more abilities that we're going to create in this course as well.

19:21.530 --> 19:24.170
So lots of great things coming up.

19:24.170 --> 19:28.520
We're going to start by implementing a level up system in the next section.

19:28.520 --> 19:35.210
So awesome, awesome job getting through our section on finishing up our enemies.

19:35.210 --> 19:36.290
At least for now.

19:36.290 --> 19:42.200
We're going to consider them pretty much done and I'll see you in the next section.
