Patchwerk Prototype – Part 3: Healing and Implementation


Overview

Patchwerk Prototype Project Page
This got done way later than I expected but I lost some of some of August and all of September diverted away to some other work. But I’ve finally finished the balancing scripts for healing and implemented the first set of calculated values into Warcraft 3.

Healing

Healing was a bit more complicated to calculate than damage. Damage dealers typically use the most powerful ability available to them at any time, but healers are different. Healers need to use a resource called mana to cast their healing spells and have a limited amount of mana to work with for the duration of the fight. Abilities that heal less and might be considered weaker are usually more mana efficient. Spells need to heal enough to cover the boss’ damage throughout the fight, but cost enough mana so that the healer will run out of mana before the fight is over if they’re used wastefully.

I made many attempts at different ways to try and set up the relationships between the healing values. One attempt in particular got pretty far but ultimately ended up getting thrown away. For the final attempt, I started by calculating the healing of spells with relative weights just like damage. Next I set two levels of boss damage, normal and heavy. This leads to two equations to cover the damage being dealt to the tank. We already know the hps, or healing per second, of our spells. We also know the boss’ damage per second, or dps, which is based on the tank’s total health.

BossDpsNormal = EfficientSpellHps * RatioNormal + ExpensiveSpellHps
BossDpsHeavy = EfficientSpellHps * RatioHeavy + ExpensiveSpellHps

So every value in both equation is known other than the ratios. Therefore, you can solve for both ratios. These ratios represent the “correct” way to heal, perfectly covering the damage in the situation. Say RatioNormal is 0.5. This would mean the healer should cast 1 efficient spell for every 2 expensive spells during normal damage. Say RatioHeavy is 0.2. This would mean the healer should cast 1 efficient spell for every 5 expensive spells during heavy damage. These ratios were needed to calculate mana costs of spells. I set up two rules to dictate how mana should work.


1.
If the healer heals perfectly, healing at exactly RatioNormal during normal damage and exactly RatioHeavy during heavy damage, they should end the fight with some mana remaining, P%.

2.
If the healer heals wastefully, healing at RatioHeavy all the time, they should run out of mana some percentage through the fight, O%

We need to suppose a few other things. How much mana does the healer have available? Consider total mana, mana regeneration rate, and fight duration to determine the mana per second available to the healer, let it be M. Also, we need to set what percentage of the fight the tank will be taking heavy damage, which will be H. That’s everything needed to represent the above two rules in equation form. What needs to be solved for is the mana cost per second of the healer’s efficient and expensive spells Emps, and Xmps. Also, to make this more compact, let RatioNormal and RatioHeavy be Rn and Rh.


1.
(1 – P) * M = H * (Emps * Rh+ Xmps) + (1 – H) * (Emps * Rn + Xmps)

2.
M / O = Emps * Rh + Xmps

There’s two equations and only two unknowns, Emps and Xmps, so you can solve the system of these two equations to calculate mana costs. I’m not going to go into further details because I feel like I’ve already lost people with what’s above.

Implementation

With damage and healing calculation done, the next step was to actually implement these calculated values into the game. Because I knew these values might change as I continue development, I didn’t want to go through my custom abilities setting all these individual calculated values. I put all the calculated values in one place, in variables.

When the map starts, or initializes, all the heroes are set up in triggers, and the values in these variables are used to set the properties of their abilities.

Continuing the trend of looking at Rexxar, here’s the trigger to set him up.

Up Next

So the first thing I did when I had all the numbers in was throw down a Patchwerk and try fighting him.

He was way harder than I expected. It’s going to be even harder once I actually implement his enrage ability. The difficulty is some combination of issues in certain abilities that need fixing and the balance numbers that need to be tweaked. That’s what I’ll be working on next, finishing the normal Patchwerk fight and getting it to a nice stable state as a fight for these three heroes.