Friday, January 30, 2015

The Sort Of Work That Balancing A Game Requires

Last week, I dove into the task of balancing WarStrike numerically. Having done this before at earlier stages of the project, I had a good feel for the kinds of approaches that would work best in Excel (my primary tool for this), but I didn't really have an appreciation of how involved the process would be. Or how many variables would be involved. So read on, and you'll get a feel for the kind of complexity that just four little special rules can add to the calculations for what a particular weapon range might be worth. Then you'll have a better appreciation for why so many games just don't bother trying to figure out the math behind their mechanics, and just wing it.

Setting Up My Range Tables

Wednesday, I posted the following table, which showed the range bands for the game.

After creating that guide for myself, I then went about creating another table just underneath it. One where a value was assigned to each 8" range band, representing the effects of the short/long range modifiers (after I'd played around with values for those in another table).

Over to the right, you can see the average score for each row (divided by a theoretically perfect 11). This is going to be multiplied against the chance to hit, the rate of fire, and the damage potential of each shot to determine a final offensive score for each weapon.

But of course, there's going to be some special rules...

These are:

  1. Rapid Fire (extra shot within 16" of target)
  2. Scope (no long-range penalty for the weapon's shots)
  3. Indiscriminate (weapon can re-roll missed attacks)
  4. Unwieldy (weapon can't be used within 8" of the target)

Note that these aren't ALL of the special shooting rules. Just the ones that will affect the weapon's range value calculations.

So, for each special rule, we need another table that shows its benefits to the standard range values. Here's the one for the Scope rule:

As you can see, it just brings the long range numbers back up even with the medium range numbers. If I wanted to make the rule work differently (say +1 at medium range, and +2 at long range), I could make those adjustments here.

The result of doing this for all four special rules is numbers that can be added to the standard range values to reflect the bonus, or penalty given by the rule.

But The Tricky Part Is...

I'm working in the best off-the-shelf program for this kind of thing, which is Microsoft's Excel. It's a powerful tool for crunching numbers. But while I could program a bunch of custom VBA scripts to look up (or calculate) raw range numbers, cross-reference special rules, and spit out final costs, that's not the best way to use the program. Scripting runs SLOW in Excel (Especially on the Mac), and I've filled pages with pretty simple scripts where a change to one variable would take 2+ minutes to update across the rest of the page.

So what should you do in Excel? Well, you pre-calculate everything you can and put the results in tables that can be referenced quickly using the built-in functions. So that you're using as few scripts as humanly possible.

Which means that I need to pre-calculate EVERY combination of those 4 special range rules. So that I can pick the combo I want from a drop-down list on a calculation page, have excel grab the range value cross-referenced with that rule combo, and be on my merry way.

How many combinations of 4 special rules can you have? The answer is 4^2, or 16.

Here's what that lookup table ends up looking like:

That's just the table for range, which is only one part of the ranged offense calculation. Which is only 1/2 of the total offense calculation. Which is only 1/4 of the complete model value calculation.

I'm not complaining about that, as I enjoy the process. But it is a lot of work. All of the numbers for which are built on first-approximation assumptions about individual rules values that will have to be adjusted as we do more tests. But once the mathematical model is complete, it will (much like the written rules), be much easier to modify later.

Special thanks go out to Eriochrome, by the way. When I get stuck on something math-related, he's my go-to guy. :)

No comments:

Post a Comment

Popular Posts