GAS – Fireball Spells

Adding Caster Spells - Fireball
All good RPGs and MMOs will have spells, and these spells are a little more complex than simplistic melee attacks. Ranged spells generally require some projectile or particle system, some damage profiles that have lasting effects (debuffs or ticking damage), and perhaps longer cooldowns or resource usage.
This blog post will document the fireball spell and how it has been implemented, although I'm sure it could be further optimised and improved. As this is an educational project, each element will be iterated on further for future improvements.
The Fireball Spell
The anatomy of the fireball spell will be very similar to how the melee spell works, however the way the spell is visualised may be different and how the damage is applied would be different as well. While this fireball spell does function, it's still under development and will require resource implementation as well (might come in a later post). It would constitute:
- Fireball ability blueprint (Gameplay Ability)
- Fireball cooldown (Gameplay Effect)
- Fireball damage profile (Gameplay Effect)
- Fireball projectile (Blueprint)
- Niagara System for the VFX component.
With this ability, we've done something pretty cool with the fireball projectile, where we rely on hit events from the particles other than the projectile - so the projectile doesn't technically exist, but we'll discuss this a bit later...
Let's have a look at how the spell was developed.
Fireball Blueprint Development
The fireball is once again pretty straight forward in terms of functionality. We are just aiming to spawn a fireball 'projectile' blueprint and let this do the damage, but just to run through the blueprints really quickly:
- We commit the ability once again, to ensure it executes
- We apply the global cooldown gameplay effect to ensure we trigger the GCD.
- Get the fireball target, which is fed through to the BP Fireball Projectile blueprint (we've exposed this parameter on spawn and made it instance editable inside the projectile blueprint).
- We commit the ability cooldown making sure we can't cast this ability again until the set cooldown is finished.
- End the ability.
The magic of this ability happens within the Niagara particle itself, which we will look at next.
Fireball Projectile + Niagara System

Traditionally, projectiles would be comprised of a mesh of some kind (static mesh), and a projectile movement component that helps control the movement of said projectile. The problem with this is a lot of spell-based projectiles will have erratic movement, not direct paths to the target. We could attach a particile system to the projectile and let that visualise the erratic behaviour, but then we have to deal with inconsistent hits (when the projectile hits the target, it will apply damage, but have the particles actually hit the target?).
As such, we handle the majority of the projectiles in this instance not with a projectile movement component, but on the particle directly. We need to ensure particle collisions are tracked and communicated directly to the blueprint to apply the damage effect.
Niagara Settings
The particle effects were inspired by a tutorial from Breez-E Game Studios on YouTube called 10 Minute Tutorial: Craft Stunning Homing Missiles in UE5 Niagara System Unreal Engine - inspired being a loose word as I followed the core of the particle system and left it at that... In any case, there were a few noteworthy points in the tutorial that helped bring the ability together. These are annotated in the image above.
- The spring force has a User Parameter which is the selected target, as this applies a 'spring like force' to the particle towards this location. Effectively, this pulls the particles to this location. This user parameter is set within the projectile blueprint spawned by the fireball Gameplay Ability.
- We have a collision with a generated collision event which is then exported to a blueprint through the Export Particle Data to Blueprint node. By doing this, we can set up an interface in the blueprint that will transmit the particle hit events directly to the projectile blueprint.
What's the benefit of this? Well, we could easily scale how many projectiles we want to be in a projectile ability within the Niagara system itself, rather than spawning multiple projectiles... Plus, we can add cool looking effects to our projectiles.
We also have a second Niagara system which handles the particle 'trail' by spawning particles from another emitter, which is within the tutorial above and worthwhile checking out if you are new to Niagara (I was!).
Projectile Blueprint
When we spawn the projectile blueprint through the Gameplay Ability, we need to initialise a few things through the Event Begin Play node. We send the target from our projectile to the Niagara System so we can update our HomingTarget User Parameter - this helps the projectile know what it is flying towards. We also update the User.BPCallback Actor User Parameter with a reference to the projectile blueprint, as this will be what the particle collision export will be sent to (as seen in diagram window 2 above).
To actually get the Particle Collision Export to work, we need to set up an interface within the projectile blueprint. There's an interface already built into Unreal Engine which we will use. This is done by:
Clicking Class Settings > Add Implemented Interface 'Niagara Particle Callback Handler'.
We can then implement this interface which will create the 'Event Receive Particle Data' node.
Every time a particle registers a hit, the Event Receive Particle Data callback handler pings a message back to the blueprint. Because we have already sent across the target in the Gameplay Ability, we can just double check to see if the target can be damaged (at the moment, this is set up through an interface called Apply Debuff but perhaps this would be better called Apply Damage). If it does, we get the gameplay ability system it has and apply the Gameplay Effect Spell Damage effect (which can be either ticking damage or instant damage, however we set this up to be). From that, we can handle the addition of tags to manage cooldowns etc.
There is one extra bit that helped this work correctly. Inside the Niagara System, on the Collision node, there's a setting called 'Age Colliding Particles' which I set to 50 - this forces the age of the particle to jump to the end and destroy itself on hit registration, otherwise the particle might 'bounce' off the target and trigger the hit damage multiple times. Just a nice little setting to get things working more reliably which I found deep on an Unreal Engine support forum...
Final Comments and Notes
There's not too much difference with the way the fireball is working here, but the magic all happens within the Niagara system. We still spawn a projectile blueprint, which contains just a Niagara particle system. This particle system communicates to the projectile blueprint when each of the particles collide through utilising the particle callback interface within Unreal Engine. Each hit registration applies damage through the Gameplay Effect damage profile, similar to how the melee works.
There's a number of things to still explore with this blog. I need to look into resource spending and generation as currently all the abilities are just connected to cooldowns rather than resources, I need to document the ticking damage with Damage over Time (DoTs), and I need to discuss the methods of controlling these abilities through the State Tree system within Unreal Engine.
Until next time...