Simplify the damage formula


Although the central place for this kind of discussion is on the CDO wiki, some may find it helpful to discuss potential requests and suggestions here first.

Lair Larrikin

Posts: 20

Joined: Monday, 2nd July 2018, 16:47

Post Wednesday, 13th February 2019, 21:33

Simplify the damage formula

The scope of this proposal is the initial damage calculation before AC and brand application.

The current damage formula has a lot of separate rolling, and at least one nested roll, and random rounding occurs many times. This makes the distribution complicated and pretty much impossible to visualize. I think it would be much better if we could reduce this to a uniform distribution or something very close to it. This would be much easier to visualize, as most people are familiar with the concept of dice, and would help people compare the relative values of skills and equipment. (For example, some people don't realize that strength is about as good as - or potentially, better than - slaying on characters with big weapons and high skills, and make bad equipment choices as a result.)

Here's how to achieve this: instead of calculating each bonus (skill, slaying, etc) with a roll and then adding or multiplying it to your rolled base damage, have each bonus be a deterministic addend or factor, and have each bonus be "inside" the base damage roll.

For a simple picture, the new damage formula would look something like:
  Code:
damage = 1d( randomRound( base * strBonus * skillBonus + slayingBonus ))

base = base damage of weapon
strBonus = 0.75 + strength * 0.025
skillBonus = 1 + weaponSkill * 0.02 + fightingSkill * 5/300
slayingBonus = weaponEnchantment + totalSlaying + corrosion


There are many more possible modifiers (such as might) that would be applied in the same way (either a multiplier of the base, or an addition to the multiplied base). There are some total damage modifiers (such as indirect cleave) that would be a multiplier wrapping all of the above, but still be "inside" the roll and the random round.

Random rounding would only occur once; after all modifiers are calculated and before the dice is rolled.

The resulting distribution is nearly uniform. The only way in which it differs from uniform is: the maximum value is less likely than the rest of the values, because the random round makes it so that sometimes your dice doesn't have that maximum value on it.

General version of the formula:
  Code:
damage = 1d( randomRound( product(totalDamageMultipliers) * (baseDamage * product(baseDamageMultipliers) + sum(damageBonuses)) ))

totalDamageMultipliers is a list/array including items such as the indirect cleave modifier, shadow form modifier, etc
baseDamageMultipliers is a list/array including the strength modifier and skill modifier
damageBonuses is a list/array including the enchantment modifier, corrosion modifier, starvation modifier, etc

For this message the author stormdragon has received thanks: 4
chequers, duvessa, PseudoLoneWolf, VeryAngryFelid

Ziggurat Zagger

Posts: 8530

Joined: Sunday, 5th May 2013, 08:25

Post Wednesday, 13th February 2019, 23:06

Re: Simplify the damage formula

Don't forget to do this with weapon-using monsters too.
User avatar

Shoals Surfer

Posts: 265

Joined: Friday, 19th August 2016, 21:21

Post Wednesday, 13th February 2019, 23:18

Re: Simplify the damage formula

This results in a pretty large variance. Is it a desired behaviour? How does that compared with the variance of the original formula (I mean an estimation, since like you said its awful to calculate analytically)? Maybe make it a normal dist, or some other skewed distr?
make food great again

Ziggurat Zagger

Posts: 8530

Joined: Sunday, 5th May 2013, 08:25

Post Wednesday, 13th February 2019, 23:26

Re: Simplify the damage formula

The current formula has higher variance than a uniform distribution until it applies enchantment/slaying.
User avatar

Shoals Surfer

Posts: 265

Joined: Friday, 19th August 2016, 21:21

Post Thursday, 14th February 2019, 00:24

Re: Simplify the damage formula

ah yes I seem to remember you mentioning it had a very large right tail
make food great again

Ziggurat Zagger

Posts: 4138

Joined: Friday, 8th May 2015, 17:51

Post Thursday, 14th February 2019, 07:41

Re: Simplify the damage formula

The suggested change would make it possible to give meaningful feedback to player. Something like "With your current skills and equipment increasing Strength by 1 will increase your melee damage by 5%", "With your current skills and equipment increasing Polearms skill by 1 will increase your melee damage by 7%" etc.
Underestimated: cleaving, Deep Elf, Formicid, Vehumet, EV
Overestimated: AC, GDS
Twin account of Sandman25

Ziggurat Zagger

Posts: 8530

Joined: Sunday, 5th May 2013, 08:25

Post Thursday, 14th February 2019, 09:23

Re: Simplify the damage formula

you can give that exact same feedback with the current formula too...

Snake Sneak

Posts: 118

Joined: Thursday, 16th August 2018, 21:19

Post Thursday, 14th February 2019, 14:44

Re: Simplify the damage formula

I think the suggested change to weapon damage would be nice.
I would like to be able to see the number which is the max damage with the new damage formula, quite regardless of whether the new formula gets implemented, because it is twice the average damage either way.
That way I could figure out the information suggested by VeryAngryFelid, the same way I can examine the effect of equiptment, Strength and Dodging on EV.

Ziggurat Zagger

Posts: 4138

Joined: Friday, 8th May 2015, 17:51

Post Thursday, 14th February 2019, 14:57

Re: Simplify the damage formula

duvessa wrote:you can give that exact same feedback with the current formula too...


Really? I thought that the existing formula is so complicated that nobody is going to write code to calculate data for the feedback.
While with new formula it is straightforward to do.
Underestimated: cleaving, Deep Elf, Formicid, Vehumet, EV
Overestimated: AC, GDS
Twin account of Sandman25

Snake Sneak

Posts: 118

Joined: Thursday, 16th August 2018, 21:19

Post Thursday, 14th February 2019, 15:27

Re: Simplify the damage formula

The old formula functions like a product of (uniformly distributed) random variables, added to a sum of random variables, with complicated rounding rules. The complicated rounding changed the distribution, but doesn't change the average. The same goes for the way the product of random variables is taken. Hence it is fairly easy to check that the original system and the formula in the OP have the same average. (Assuming the wiki is correct.)
Since they have the same average, you can give the same feedback.

For this message the author petercordia has received thanks:
duvessa

Ziggurat Zagger

Posts: 5926

Joined: Tuesday, 30th October 2012, 19:06

Post Thursday, 14th February 2019, 17:43

Re: Simplify the damage formula

VeryAngryFelid wrote:
duvessa wrote:you can give that exact same feedback with the current formula too...


Really? I thought that the existing formula is so complicated that nobody is going to write code to calculate data for the feedback.
While with new formula it is straightforward to do.

I believe that's only a small part of the issue the other parts are:

1. nobody with commit rights is convinced that it's an interesting and useful sort of feedback that needs to be given (at least to the point where they're inspired to do so)

2. average and max damage aren't directly proportional, so the feedback of just listing one or the other is incomplete, and putting both in there seems awkward and possibly confusing.

3. If someone writes code to do this, it needs to be consistently maintained to retain parity with changes to attack, which introduces later overhead and drag on future changes.

(The OP's suggestion for a formula change would at fix issue #2, and reduce the burden of #3)

I don't think it's primarily (or even tertiarily) because "it's hard to write such code, because damage is complicated" DCSS devs are generally pretty smart and capable, and the math isn't really that hard to implement in code.
Spoiler: show
This high quality signature has been hidden for your protection. To unlock it's secret, send 3 easy payments of $9.99 to me, by way of your nearest theta band or ley line. Complete your transmission by midnight tonight for a special free gift!

For this message the author Siegurt has received thanks:
duvessa
User avatar

Shoals Surfer

Posts: 265

Joined: Friday, 19th August 2016, 21:21

Post Thursday, 14th February 2019, 20:01

Re: Simplify the damage formula

I think both new and veteran players would stand to gain if they could see in a simple format the damage a weapon does. A uniform distribution really helps there. I'd be able to examine a weapon and see displayed:

"Broad axe of freezing. It does 10-25 damage + 5-8 fire per turn, given your current skills, buffs and attributes. This may be further mitigated due to your foe's defences, such as AC or resistances".

The min-max damage displayed implies a uniform distribution, and is more or less standard for other similar games, so new players would feel right at home.

Implementation is probably a big headache because of all the balancing needed: You'd want to make sure a player still, on average, damages and gets damaged in the same manner as before the changes. Statistics from before/after would need to be gathered for a set of representative scenarios, and numbers adjusted accordingly.
make food great again

For this message the author pedritolo has received thanks: 2
PseudoLoneWolf, VeryAngryFelid

Ziggurat Zagger

Posts: 4138

Joined: Friday, 8th May 2015, 17:51

Post Friday, 15th February 2019, 05:39

Re: Simplify the damage formula

Siegurt wrote:
VeryAngryFelid wrote:
duvessa wrote:you can give that exact same feedback with the current formula too...


Really? I thought that the existing formula is so complicated that nobody is going to write code to calculate data for the feedback.
While with new formula it is straightforward to do.

I believe that's only a small part of the issue the other parts are:

1. nobody with commit rights is convinced that it's an interesting and useful sort of feedback that needs to be given (at least to the point where they're inspired to do so)

2. average and max damage aren't directly proportional, so the feedback of just listing one or the other is incomplete, and putting both in there seems awkward and possibly confusing.

3. If someone writes code to do this, it needs to be consistently maintained to retain parity with changes to attack, which introduces later overhead and drag on future changes.

(The OP's suggestion for a formula change would at fix issue #2, and reduce the burden of #3)

I don't think it's primarily (or even tertiarily) because "it's hard to write such code, because damage is complicated" DCSS devs are generally pretty smart and capable, and the math isn't really that hard to implement in code.
IMHO you have just confirmed my point. Not interested ENOUGH, does not make MUCH sense and is not EASY to support is exactly what I meant.
Underestimated: cleaving, Deep Elf, Formicid, Vehumet, EV
Overestimated: AC, GDS
Twin account of Sandman25

Snake Sneak

Posts: 118

Joined: Thursday, 16th August 2018, 21:19

Post Friday, 15th February 2019, 20:26

Re: Simplify the damage formula

Just imagine, if the weapon damage distribution get characterised by a single number, as suggested in the OP, you could display ATtack / To Hit / attack DElay in the same way the game currently displays Armour Class / EVasion / SHield. I'd really like that.

As a side note, does crawl use the unrounded values of AC etc internally, in a similar way as is suggested by the OP? (ie, by using the randomly rounded value)

Return to Game Design Discussion

Who is online

Users browsing this forum: Google [Bot] and 10 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.