Sunday, January 10, 2021

How I automated calculating point values

Quick update, I picked my initial abilities:
(1) Head Scramble- The character can cause a target to become "shaken" (a condition that makes them unable to use most abilities, and may paralyze them).
(2) Soul Touch- If the character damages their target in melee, they can deal extra magical damage.
(3) Red Magic- The character can cast direct-damage spells.
(4) Shot- The character can make a basic ranged attack.
(5) Call Animals- The character can summon four weak creatures.
I'm also trying to price different stat boosts (e.g. what is it worth for a character to have +1 Armor?).  

Okay, on to today's topic...

In a previous post, I described how I could automate the initial stages of playtesting using computer simulations.  In these simulations, I'd have each ability fight each other ability 1000's of times, to estimate the odds that each wins.  However, let's say my simulations find that Head Scramble beats Soul Touch in 55% of battles, it beats Red Magic in 60% of games, it beats +1 Armor in 40% of games, etc.; what do I do with that?

Probably my all time favorite GDC talk covered this question in talking about balancing fighting games (it was by Alex Jaffe, the same guy who talked about cursed problems).   He talks about the important thing being meta-game balance, i.e. that every fighter (or in my case, every ability) does not need to be evenly matched against every other fighter/ability, but that there are strategies one can play to win at least 50% of the time.  For example, in rock-paper-scissors, the meta-game strategy is to play each strategy 33% of the time.  So, my goal becomes for there to be some meta-game strategy (i.e. one should play Head Scramble X% of the time, Soul Touch Y% of the time, etc.), where every strategy should be played some amount of the time, and no strategy should be played almost all the time.  This idea really jives with another great commentary I saw recently, which said that character's don't have to be evenly matched, but that you need to remove any "Gods" (i.e. characters that always beat non-God characters) or "Garbage" (i.e. characters that always lose to non-Garbage characters).  

How do we calculate the meta-game strategy?  Well, if you have an odds matrix (i.e. the chance each ability beats each other ability), you can do this with linear programming.  As a basic example, let's change rock-paper-scissors so that rock beat paper 20% of the time (rather than 0%).  The best strategy is that you should play rock and paper each about 38.5% of the time, and scissors 23% of the time.*  We can use similar math for fight outcomes, getting the frequency that each ability should be selected.  The unfortunate thing is that the best meta-game strategy pretty much always excludes several abilities.

*The intuition here is that you should play rock more, because it is a numerically better strategy (having no  loss), and because you think your opponent will play rock more, you should also play paper more (because it usually beats rock).  Scissors thus gets left out and chosen less.  

Alex's brilliant idea was that you should see if a character could still be used in a less-than-optimal meta-game strategy.  For example, you could ask something like, "If I only needed to win 45% of games, then how often could I play Head Scramble?" and he'd get a range of between 5% and 60%.  Then, abilities would be "balanced" if the upper limit for each character was at least 5% (otherwise it is never a good idea to play a character, making it Garbage), and the lower limit was no more than 50% (otherwise you should always play a character, making it a God).

A difference in Alex's game is each player had one character, so Gods and Garbage are a problem; in my game, a player can bring one God or multiple Garbage characters.  So, I go a step beyond Alex, to calculate point values of each ability.  For each ability, I alter the odds matrix to increase their chances against each other ability by 5%, and then calculate the new meta-game strategy.  If I find that the boosted ability should be used 0% of the time, then I give it a one-point advantage in the future.  I've used a few different ideas for what a "one-point advantage" should be.  Currently, if a character has an X-point advantage, and its opponent has a Y-point advantage (where X>Y), then at the start of the battle the character rolls X-Y dice, and for every 6, its opponent takes 1 damage (repeated in each world).  I then recalculate the meta-game strategy, reassess advantages, and repeat this process 30 or 50 times (until it approaches an equilibrium).  I then calculate the average advantage of a character with no abilities, and subtract the advantage for each ability.  For example, if "No Ability" typically has a 4-point advantage, and Head Scramble has a 2.5-point advantage, then Head Shot is worth 1.5 points.  

Once I have the points, it gives me an estimate of the relative values of abilities.  For example, my initial simulations were:
+1 hit point  => 4.8 points
+1 attack => 5.73 points
+1 armor = 6.07 points
shot => 7.33 points
soul touch => 7.0 points
head scramble => 4.2 points
red magic => 5.8 points
call animals => 6.93 points
Thus, this suggests that the abilities are decently well balanced, though Head Scramble is a little weak.  

Like I said previously, I then use my intuition on these.  For example, I think I'm under-valuing Head Scramble, as it's probably a good assist ability.  But, this gives me a first chance to estimate if any abilities are too weak or too strong, and make quick adjustments (before my one-hour playtest sessions).  

No comments: