#How to do Net Serialize for multiple damage types?

12 messages · Page 1 of 1 (latest)

alpine cradle
#

I want my abilities to be able to apply multiple damage types so I stuck with the initial TMap method Stephen used to create the first iteration of damage gameplay ability but using this method doesn't allow me to send over the TMap. If anyone has figured out how to handle this problem I'd appreciate your insights.

grim gorge
#

If I remember it should be enough to add damagetypes to the array in the GE that is later checked in the exec calc. There it goes through all the damagetypes and add it to damage. So do not think you need to serialize it. It might need some tweaking to fit your plan on how it should work.

alpine cradle
grim gorge
#

Hi Corvus,
Sorry for unclear answer, will try and elaborate.
If I understand correctly you wish you to add more then one type of damage type on one (ability or spell). Example a projectile could do both FireDamage and FrostDamage and the damage from these two should be combined, and maybe both debuffs should be able to occur?
If this is what you wish I do not think you need to do a NetSerialize. You could achive this with the following implementation:

#
  1. In the DamageGameplayAbility (or what you have named it) You have Stephens solution with DamageTypes, where you can map a specific damagetype to a gameplay tag
#
  1. In the GameplayTags you could do something like this to map a tag with a specific damage type
#
  1. In the BP of the ability you then add by using tags the wished damageType in the array of the GameplayAbility (sorry i wrote effect above my mistake).
#
  1. In the ExecCalc you will extract all your tags that are mapped with the damage type and you could now use them to apply the specific damage and debuff if you wish:
#

Hope this helps, let me know if you want me to elaborate further. Happy Coding

#

Also want to add that in the ExecCalc you should have a Array of GameplayTags instead of a single one as it is in my implementation as it would overwrite the previous tag as I have not implemented the solution of several damage types in one ability.

alpine cradle
# grim gorge Hope this helps, let me know if you want me to elaborate further. Happy Coding

This is great thank you for taking the time to explain, the way I have it set up for my implementation is having all the damage types consolidated on a data asset called "DamageTypeInfo" which is stored on my Game Mode class. I've coded it so that if I so choose, I can easily add new damage types whenever I see fit just by adding a new tag instead of coding it in C++. So essentially if I can access all the information from the data asset, there's no need to store all the Debuff variables on the Gameplay Ability and the only requirement is to net serialize a gameplay tag container with each damage type ability correct?

grim gorge
#

Cool solution!
Not sure if it need or dont need the serialization.
I have found this UE Network compendium that could be of use if you are intrested. Under the section ”Additional resources” there are links to custom serialization. Maybe that can help you solve the Tmap you want sent over.
Good luck, hope it helps.

https://cedric-neukirchen.net/docs/category/multiplayer-network-compendium/

This compendium is meant to give you a good start into multiplayer programming for Unreal Engine.