Damage Calculation Help in Blueprint Project

Hello, I am working on damage calculations for characters abilities in a blueprint project, and I was wondering if anyone could recommend a more efficient way of handling the calculations.

The project I’m working on is a 5 v 5 battle arena like Marvel Strike Force. At the start of a characters turn, I check if the character has any buffs or debuffs like Attack Up/Attack Down and run through a serious of Booleans that modify the values accordingly. After all is said and done with all combinations of Attack modifiers and targets Defense modifiers there are 16 different end results. Add critical hits into the equation and now its 32 different results. Each character has 4 abilities with 32 calculations each, so 10 characters and 320 calculations per battle. The calculations are currently sitting inside a macro due to the size and number of nodes required. Currently there are only a few characters in the game, so those checks aren’t causing an issue, but as more are added I don’t want efficiency to tank. Any help would be appreciated.

  1. Calculate on hit.
  2. Calc on load and store in a struct. reference struct on hit.

if you mean efficient for the CPU then dont worry those calculations are cheap, especially if its event driven.

if you mean efficient for the developer then it sounds like some serious spaghetti. what you want is a damage struct and an array of modifiers. then loop the array and modify the final damage.

now instead of 32 different branches you have one extendable loop