Welcome back.
In this video we're going to talk about a new type of gameplay cue.
Notify the gameplay cue notify burst type.
Now if we're going to create a new gameplay cue notify I'd like to place it in ability system gameplay
cue notifies just so we can keep them here.
And before we even go about doing that, we're going to need a gameplay cue tag.
And I can just create this right here in project settings.
I don't feel like I'm going to need a tag for this natively in C plus plus, so I'm going to go to Gameplay
tags.
I'm going to find my gameplay cue tags.
So here's gameplay cue.
I'm going to click plus and get a new gameplay cue tag called Gameplay Cue Dot Arcane Shards.
And with that, I can close project settings and I can make my new gameplay cue.
I'm going to right click create a New blueprint class, and for this class I'm going to search for Gameplay
Cue notify and choose Gameplay cue notify burst.
Why?
Because burst is great for one off gameplay effects such as sounds and things like our shards.
It's going to be perfect for that.
This is a static gameplay cue notify, so it's not instanced.
It cannot hold any state.
We're going to select this and we're going to call this G c underscore arcane shards.
And before we go and start using it I'm going to do a project wide search here for gameplay queue notify
underscore burst.
And here we see the CPP file for it.
And we can go into the h file for it.
And here's the class.
It's not big.
It's kind of small.
It has even an on burst.
That's a blueprint implementable event which we can add our own custom logic to in the blueprint.
And it also has an on execute implementation.
And if we go into it, we see that it's doing some stuff when it's executed.
Here we see things like execute effects.
So it has this burst effects, which as you can see has its own type of gameplay queue notify burst
effects.
Now let's just read the comment above the class.
It says this is a non instanced so static gameplay queue notify for effects that are one offs.
Since it is not instance, it cannot do latent actions such as delays and timelines.
So one offs only one offs and we can't store state in it.
So we can't start something that's looping and then go kill it later.
No, that's not what the burst is for.
The burst is a little bit more basic than that.
So now that we've seen the C plus plus class, let's take a look at the Blueprint Arcane Shards gameplay
queue.
And here it is.
We can see that its details panel is quite plain, and notice that the gameplay queue tag is set to
gameplay queue arcane shards by default.
So that's kind of nifty, a little bit mysterious.
And now that we have our arcane shards, we can decide what happens on burst.
So the first thing I'm going to do is go to functions and override.
There it is on burst and I'm just going to print a string.
Nothing crazy print string here.
That's what we're going to start with.
And the string is going to say arcane shards burst exclamation point.
Because why not?
So the first thing I'm going to do is execute one of these in conjunction with our debug spheres, so
we can go back to arcane shards right here, where we're drawing our debug spheres right at the end,
I'm going to right click and type execute.
And for these bursts we execute them.
We don't add them to actors because those looping queues, those gameplay queue notify actor queues,
those get added to actors, but bursts just get executed and we're going to execute gameplay queue on
owner.
But we can use params too.
I like to pass params through just in case I like to use them.
Of course that means we have to make gameplay queue params, so we'll get to that.
But first we set the gameplay queue tag, we'll set it to arcane shards, and then we'll drag off the
gameplay queue parameters.
We'll make gameplay queue parameters, and we'll pass in just an empty struct for now.
And now our arcane shards has arcane shards burst printed.
Let's see what happens now.
When we save all and press play and go ahead and cast our spell.
There we have our burst message.
So we know that that gameplay queue is being executed.
That's great, but print strings are not the coolest looking thing in the world.
So there's that.
But before we go and start spawning particles and sounds, I want to bring your attention to something
in the class defaults.
If you open the class defaults and we bring our details panel out a bit, you'll notice we have burst
effects.
And remember in Burst effects in the C plus plus class, we saw that on execute.
That class was doing something with the burst effects.
It was executing these and take a look.
Burst effects seems to have a couple arrays in here.
It has a burst particles array.
It has a burst sounds array and it even has camera shake, camera lens effect, burst force feedback
burst device, property effect, burst decal.
I mean, this is kind of insane.
Now what happens if we add a burst of particles by just clicking the plus there and expanding the index?
Well, whoa, look at this.
This is a lot more than just a Niagara system.
It's actually what looks to be a struct, right?
It has some properties in it, including a Niagara system.
So what I want to do is just learn a little bit about how this burst effects works before we go and
tweak any parameters, any settings.
Let's just set this Niagara system to something.
We have NS arcane shards.
We can set that and just see what happens when we execute this gameplay queue.
Let's just go ahead and cast the spell.
Okay, so we see something happening where spawning a whole bunch of shards.
So we know that that's working, but it all spawned at the same location.
So that's something to be aware of.
Where is it spawning the location?
Well, there are a couple of overrides in here with checkboxes.
And if we expand these their spawn condition override and placement info override.
But there's nowhere in here to set a location, so that seems to indicate that it's getting its spawn
location from elsewhere, right?
In fact, where did that spawn location start?
Let's see.
It started at our owning actor location, so it seems to default back to that.
Okay, so what happens if we start this gameplay queue with a location passed in to its gameplay queue
parameters?
Let's just see.
Let's take the world location where we're drawing our debug sphere and hook it in to the location here,
and let's cast our spell.
Oh look at that okay, okay.
So that's a lot different, isn't it?
It seems like whatever location we're passing in, we're getting some particles there.
Now.
They don't seem to coincide with those debug spheres do they.
So there's a discrepancy there.
And as soon as I stopped we see that we access none.
Trying to read property call func get array item.
So we're trying to get an array item here.
And it's here in the gameplay ability Arcane shards.
When we execute gameplay queue with params right here, we can click on this and it'll take us directly
to the violation here.
So we're attempting to get an array element out of bounds.
So we're going to have to take this blueprint pure return value and promote this to a variable and call
this shard spawn point or shard spawn location.
And we're just going to have to write over this vector every time we execute this event.
And then we don't have to rely on those blueprint pure values.
We can just go ahead and use shard spawn location, our cached location variable, and I'm going to
use that here as well in the gameplay queue parameters here.
So let's see what happens now.
Okay, so that's better.
We seem to get one shard at each of our spheres, and that's looking pretty consistent.
Right.
And it's a little hard to see the spheres.
We can draw them a little bit bigger just to prove to ourselves let's draw them at 50 and make them
red.
So they stand out a bit.
And we can definitely see that those shards are spawning at those sphere locations.
So that's looking good.
Really nice.
Okay, so that tells us something.
Our gameplay queue burst is a little bit more interesting than we might have initially thought.
On burst.
Yes, we can override it.
We can do things in it like print strings, cool, cool strings.
But we can also go to our class defaults and add burst effects, which is huge because if we add burst
effects to this and it just takes care of things, well, we don't have to come in here and call spawn
system at location and all that stuff.
We can just add to burst effects and this takes care of it for us.
Now it does have a rotation override, but it just lets us hard code XYZ values in it, so we can't
really spawn these particles on a sloped surface by just adding them here, unfortunately.
But that's okay.
That's what on burst is for.
We can just spawn system at location here if we want that sort of control.
Okay, so now that we have burst particles we can collapse that dropdown and take a look at burst sounds.
I'm going to click plus and expand it.
And it appears to look kind of like burst particles looked where we had spawn condition override placement
info override a Niagara system.
Our Niagara system can even cast shadows.
Look at that.
But collapsing burst particles burst sounds is similar.
We have spawn condition override.
We have placement info override a sound, a looping fade out duration, a looping fade volume level,
and then we can have sound parameter interface info if we want, but really we can just pass in a sound
here.
And if I search for shards, we have this arcane shards.
We can browse to it and hear what it sounds like.
It sounds kind of like rocks or shards.
I'm going to just stick that in there and see what happens when I execute this.
So let's listen closely.
How about that?
Pretty cool.
Okay, so this shows us the magic of gameplay cue bursts and the limitations of it.
Of course, we saw that when using burst particles, we could only override the rotation with a specific
hard coded x, y, z set of values.
But then again, we have on burst so we can do anything here, and we can take those parameters and
we can use those too.
So we have a bit more freedom.
All right.
Now before we wrap up, I'd like to just see what happens in multiplayer with this by setting the number
of players to two.
Pressing play and splitting the screen.
And I'm first going to cast this spell on the server.
Let's see what happens.
Okay, so that looked pretty good.
Let's cast the spell on the client this time.
That's looking pretty good.
And it looks like our random locations are pretty consistent.
Let's go into GA Arcane shards, and let's set our num points from 11 down to four.
And let's just take a look.
It's easier to analyze a smaller number of shards.
So on the client I'm going to cast, and I want you to pay attention to two things.
One, look at the spheres that we're drawing, the debug spheres.
And two, look at the actual particles that are Niagara systems are spawning.
So two things to look at.
Now I'm going to center this.
Right here.
And that's another thing we should notice, is that we're showing this, this magic circle locally,
but we're also showing it on the server.
That's something that our gameplay ability is predictively doing that we don't want it to do.
We only want to show this on the local character.
So that's something to fix.
But centering this on the other character, let's take a look.
First of all, look at the spheres.
Notice the spheres are inconsistent.
Okay, so the spheres don't appear to be predicted.
But now I'm going to cast it again.
And this time take a look at the shards.
Ready.
Interesting, right?
The shards appear to be correct.
And if you take a look at the server.
We see that those shards appear at those sphere locations.
But on the client, it's all out of whack.
If I go over here on the client and I just actually just cast over here.
Notice that there's a discrepancy between the spheres and the shards.
They don't all spawn exactly at those sphere locations.
But notice that the shards on the server do.
We'll cast over here this time.
Notice the spheres and the shards are consistent and they're in the same spot.
So it's working on the server.
But regardless, if we just look at the shards and compare them to each other.
We'll see that they spawn at consistent locations.
And if we suppress the debug sphere, because this could be distracting us a bit if we bypass that draw
debug sphere.
Now we should be able to analyze this a little easier if I cast this here.
Notice that those shards.
Are consistent with the server.
So this tells us that simply drawing a debug sphere in a gameplay ability is not a predicted action,
but executing a gameplay cue is.
So executing that gameplay cue burst is taking care of this for us.
And that's great, because on the server, we're going to be using those locations to do important things
like cause damage, right?
But on clients, we're just going to get that replicated gameplay cue burst.
And that's going to be nice because when one of these shards knocks a goblin flying away, we'll get
to see it and it'll look consistent.
So now we know about a new type of gameplay cue.
Notify the gameplay cue, notify burst.
And it works pretty well as we've seen.
I'm going to go ahead and bypass the print string.
We don't need it anymore.
We know that on burst is being executed so we can go ahead and save that.
And now that we have this gameplay cue notify burst, we're one step closer to having a really cool
looking ability.
And we know that it's going to work and scale according to our ability level.
If we take that num points and we set it back down to one, well then we're always going to get that
shard spawned in the middle right there.
So we'll start off with our spell looking like that.
And then we're going to slowly level it up and then spawn more and more shards.
And it's going to be awesome.
For now, for testing, I'm going to set it back to 11.
And with that excellent job and I'll see you in the next video.