Testing JRPG Strateges via Simulation
Inspired by a lot of Dragon Quest IV lay in recent weeks, I built a simple battle simulator model, dubbed “beefymage.py”, to test some assumptions of mine about JRPG strategy. It has a “hero”, “bruiser”, “priest”, and “mage” in a party fighting a boss that sometimes attacks all of them and sometimes just one. I wanted to see what sort of strategies are best applied in different situations.
The stats for the party and boss are as follows:
Character [HP, MP, Attack]
Hero [150, 20, 20]
Bruiser [250, 0, 35]
Priest [100, 40, 10]
Mage [80, 50, 2]
Under the current strategy:
-The hero uses no magic, and attacks every turn.
-The bruiser attacks every turn.
-The mage casts firebane (10MP cost, 60-100 HP damage to the boss) until out of MP, then attack every turn.
-The Priest casts healmax (8 MP costs, restores an HP total to the character's max) whenever a party member's HP total is less than 50% of their max. If multiple party members are below 50%, the one with the lowest percentage of their max HP gets the heal
-If anybody's HP drops below zero, they're dead and cannot act or be revived.
-Attacks do damage randomly from a minimum of the base attack to a max of twice the base attack (so the Bruiser does between 35 and 70 HP of damage, Hero does 20-40 HP, and so on).
-The party take their turn first.
Meanwhile, the boss has 2000 HP and 2 attacks. 2/3 of the time, it attacks a random party memeber for 20-30 HP of damage. 1/3 of the time, it attacks with a more devastating "coldbreath" that does 40-50 HP of damage to all party members.
Anyway, so I repeat battles under these conditions 10,000 times, to account for random variations and see what difference some stats can make in terms of how often the party wins and how long the battle takes. When following the strategy above, the party wins the battle ~29% of the time (2891 battles out of 10,000). Battles lasted an average of 15.5 turns.
Next, I tried varying a couple of parameters. Note that there are 10,000 trials, so I could see error of +/- 1% in win percentages if I ran these simulations again.
(To be clear, each of the below simulations take the base scenario described above and vary the one thing. They are not cumulative effects, just individual ones.)
-If they abandon magic use and just spam attacks, the party wins 89/10,000 battles (less than 1%!). Battles last 13.2 turns on average (because the heroes die quicker).
-If the hero starts out dead (0 HP), the party wins 0% of the time (0/10,000). Average time 11 turns.
-If the bruiser starts out dead, the party wins 0% (0/10,000). Average time 10 turns.
-If the priest starts out dead, the party wins 1% (115/10,000). Average time 13 turns.
-If the mage starts out dead, the party wins 0.5% (47/10,000). Average time 13 turns.
It's a weird paradox that the party is about equally boned when using no magic versus having one of two magic-users be dead (with the other actually using magic).
-If the mage and bruiser swap HP totals, so the bruiser is a twig with a sharp sword and the mage is beefy, the party wins 1378/10,000 battles. 14%, which is respectable, but less than the original win total. These battles last 18 turns - they're more drawn out because the mage is a quick starter and then useless once the MP is exhausted. The more drawn out the battle is past the expiration of the Mage's MP total, the more you'd rather have a sustained offense than a flashpoint one. Especially since, in this case, the character with the highest HP gives you the biggest bang for your buck when casting healmax. The same rule holds for somewhat shorter battles - if the boss has only 1000 HP, the win probability is 94% with the default party stats and 84% with the aforementioned swaps. Those battles only last about 7-8 turns, so it only takes about 3 turns for the bruiser's value to significantly outpace the mage. BIG CAVEAT that this depends heavily on what the stats actually are - if firebane does, say, 260-300 HP of damage, the mage can do damage in one turn that the bruiser can do in 5.
-If the priest and bruiser swap HP totals, the party wins 1734/10,000 battles. 17%, a few more than the mage-bruiser swap. Here the bruiser's a bit more likely to survive as well, helping in drawn-out battles. Plus the priest is a little less useless in the long run because they’ve got *some* Attack points. These battles last an average of 17.5 turns.
I'll be playing around with this some more over the next couple of days - the game theory of the Dragon Quest-style battle system fascinates me, and there are more nuanced problems (involving critical hits, stat buffs, items, grinding lebels, etc) it presents than the basic stuff shown here. If there's anything you've ever been curious about and would like to ask, feel free to do so.
Also, if you’re interested in articles like this, I also wrote late last year about the DQ series’ “Zing” spell, one of my favorite strat gambles, in some detail using a similar program: http://animetics.net/2014/12/08/game-like-a-statistician-the-sometimes-filthy-opportunity-cost-of-zing/