I am currently working on designing my damage system. I plan everything out ahead of time before I attempt blueprinting, and then make changes as needed. I have seen some information about integrated damage types within Unreal. However, I have a unique issue that I don’t think I’ve seen someone address.
*I want to extend multiple damage types from the base damage class. For each damage type, I also want to define whether it is direct (single target) damage or splash damage, with control over the range of the splash damage.
*Weapons in my game will be capable of inflicting multiple damage types simultaneously. I considered performing a check for each damage type whenever a monster is attacked, but I feel like checking for 8 different damage types per monster when the player is fighting 6-8 monsters at the same time will be hard on performance. Is there a more efficient way of doing this? Am I over-thinking it? Is there a way to simply attach multiple defined damage types to a single damage source?
I can handle the blueprinting most likely. I just a little help with working through the logic of it. Thanks.
Why don’t you use a struct containing values of your damage types?
(I’ll call types now elemental)
All your weapons contain a struct that stores the elemental damage.
For example:
Ice : 0.0
Fire: 0.1
Thunder : 0.2
Water : 0.0
etc.
When attacking, you just use some math to multiply the elemental damage with your base damage.
For example:
Base Damage (Stored in weapon or Character Strength+Weapon Base Damage or whatever you want it to be) : 50
Ice Damage = 500.0 = 0
Fire Damage = 50 * 0.1 = 5
Thunder Damage = 50 * 0.2 = 10
Water Damage = 50.0 = 0
Now your enemy stores “Resistance” Struct:
Ice Res.: 1
Fire Res. : -.5 (absorb)
Thunder Res.: 1.0
Water Res. : 1
Multiply the Elemental Damage with the Resistance and then add them all to the Base Damage.
Thanks for the response. However, that doesn’t really answer my question. Let me explain my concern more thoroughly.
Say I have a weapon that does 5 Fire Splash damage, and 5 Electric direct damage. Obviously I can add them together (and take monster defense/resistances into account), but if I add them together, how do I make sure the 5 points of fire damage does the appropriate splash damage? How do I add the damage values together without losing the perks of each damage type?
Easy.
Create enum “damage type” - direct, splash
In damage blueprint - switch on Edamagetype
Direct goes to - apply damage
Radial goes to - apply radial damage (+with fallof if you want)
In your hero character - you shoot with your weapon, pass first damage (10 with enum direct) to damage bp, then 10 damage with enum splash
If its not enough tell me, ill make simple bp and post screen
If you wouldn’t mind, I would very much appreciate it. I’m relatively new, and still learning. Plus before its all said and done I’ll need to include defense ratings, energy shield penetration, and status effect chance/resist in all of these damage calculations. So having a strong foundation will be very helpful. Thanks.
So i created something like this in few minutes… Its very simple approach but it should work (i didnt tested it), you can have much more things here, like damage calculation order etc… damage handling is only simple math
If you really want to make games i can only recommend this tutorial: , it learned me really much things. I spend with that tutorial few months but it definitely worth it