Tuesday, July 20, 2010

The trouble with game balencing is that it is hard....seriously

So part of the long delay between this and the last post was a (hopefully?) well deserved break after a mammoth week of coding. However, part of it is related to my lack of progress in balancing the new monster/weapon/quality types. Trying to keep individual fights interesting while keeping ambushes from turning into two turn player-deaths and making it scale after (for now) 5 levels is hard. Like harder than writing the code that allowed it.

Part of the problem is I want to get rid of the issue I call "rounding-error bonuses". For example, let's say that having a quality weapon improves the damage by 15%. If your sword base damage is 1d4, then 15% is less than 1 point of damage. It'd have effectively no effect. One could solve this by increasing all the numbers by a factor, say 10, then the sword base damage would be 10d4 (10-40) and 15% is on average 3-4 additional damage. Getting these numbers correct, along with making them look reasonable isn't going so well. It seems weird to have the starting sword do 10d3 damage and average swings totaling 18 or more (maybe that is my experience in d&d based roguelikes and games talking).

Does anyone have a good system or set of tools for figuring this out? Bonus points if it has been proven in a shipping game or one at least farther along than magecrawl...


Ben said...

There is a general method for mitigating rounding error over a large number of computations. Essentially, instead of using a floating-point number, you use two numbers, one for the actual value and one for the rounding error, which is assumed to be so small that adding it to the value would have no effect (analogous to your 15% of a small damage value). When you do calculations with these numbers, you update the error on the result, and when the error for a number gets to be large enough that it would have an effect on the value, you add in the part that would show up and save the rest.

What this might mean for your system is saving the leftover bits from each damage calculation and adding them back in when they accumulate to something big enough.

Feldar said...

You could just use floats and round them before they're displayed.

Worthstream said...

What Ben suggested is one of the two methods to solve this problem.
The other is to round randomly, with the right weight.

For example, if you have 1.2 you round to 2 20% of the times, to 1 the remaining 80%

In the long run you have a balanced solution to the rounding errors, in the short run it keeps the "random" feeling that is loved by players ;)