Simplify the damage formula


Although the central place for design discussion is ##crawl-dev on freenode, some may find it helpful to discuss requests and suggestions here first.

Swamp Slogger

Posts: 182

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

Location: United States

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: 8786

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: 287

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: 8786

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: 287

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: 4432

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: 8786

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...

Zot Zealot

Posts: 1004

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: 4432

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

Zot Zealot

Posts: 1004

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: 6454

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: 287

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: 3
PseudoLoneWolf, TheMeInTeam, VeryAngryFelid

Ziggurat Zagger

Posts: 4432

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

Zot Zealot

Posts: 1004

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)
User avatar

Vaults Vanquisher

Posts: 454

Joined: Thursday, 1st November 2018, 02:33

Post Tuesday, 19th February 2019, 11:23

Re: Simplify the damage formula

This would certainly be simpler than the current player damage formula, though I'm a bit skeptical about how well it would reproduce existing combat dynamics. This would make the tail quite a bit fatter, I think.

I'm skeptical about the idea overall for other reasons though. For one, you're not getting away from dice formulas, which are bad imo, you're just using simpler dice formulas. You're not incorporating AC or hit rolls into your formula either, so all that complexity remains untouched. You need to take a broader view of the problem to get to something qualitatively better than the current system. The current system is actually pretty good considering how goofy and ad hoc it looks from the formulas. (Of course it would also be good to deal with monster and player damage in a more uniform way.)

In broad terms, to get to something better than the current system, you need to stop thinking in terms of dice formulas and start thinking in terms of user-facing "statistics." For melee and ranged weapons, average and maximum damage are appropriate parameters to start with. You need to build your model out from there, trying to replicate the qualitative behavior of the current system, using easily conveyable formulas to describe the relationship between things like stats, skills, weapon properties, etc. and combat parameters like average and maximum damage. Of course, there are a lot of choices to make there and there is some potentially tricky math to work out and implement, but that, to my mind, is the general shape of the problem.
This is where mechanical excellence and one-thousand four-hundred horsepower pays off.

For this message the author tealizard has received thanks:
duvessa

Ziggurat Zagger

Posts: 4432

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

Post Tuesday, 19th February 2019, 15:58

Re: Simplify the damage formula

Current system is bad because it results in lots of actions when you deal 0 damage. Having chance to miss is fine, having min weapon damage 0 is fine, having monsters with AC > 0 is fine but having all 3 in the same game is awful especially with non-linear damage formula of crawl. You deal 0 damage during first 10 attacks vs curse toe (carefully checking situation after every action of course) and then you kill it in 2 attacks, wtf? At least simplify damage formula (like OP suggests) and give some meaningful feedback to player how it can be improved with skills/weapon etc. if you insist on keeping it this way.
Underestimated: cleaving, Deep Elf, Formicid, Vehumet, EV
Overestimated: AC, GDS
Twin account of Sandman25
User avatar

Vaults Vanquisher

Posts: 454

Joined: Thursday, 1st November 2018, 02:33

Post Tuesday, 19th February 2019, 18:01

Re: Simplify the damage formula

Actually, doing zero damage is good.
This is where mechanical excellence and one-thousand four-hundred horsepower pays off.

For this message the author tealizard has received thanks:
duvessa

Ziggurat Zagger

Posts: 4432

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

Post Wednesday, 20th February 2019, 05:42

Re: Simplify the damage formula

tealizard wrote:Actually, doing zero damage is good.
10 times in a row? Why?
Underestimated: cleaving, Deep Elf, Formicid, Vehumet, EV
Overestimated: AC, GDS
Twin account of Sandman25

For this message the author VeryAngryFelid has received thanks:
njvack

Ziggurat Zagger

Posts: 8786

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

Post Wednesday, 20th February 2019, 06:17

Re: Simplify the damage formula

It's good that you aren't guaranteed to kill a monster even if it's low on health.

Ziggurat Zagger

Posts: 4432

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

Post Wednesday, 20th February 2019, 06:57

Re: Simplify the damage formula

duvessa wrote:It's good that you aren't guaranteed to kill a monster even if it's low on health.


Evoking rage (probably at full HP) vs a monster (probably one at low health) and then dying to it is good? Where is the player's mistake here? Not ignoring the amulet?

I think crawl would be better if it was possible to plan risky actions instead of relying on pure luck. Especially if monsters didn't deal 0 damage so often too.
If I can deal 0-40 damage to stone giant and stone giant can deal 0-60 damage to me, I still can try to melee it exactly like I do in current crawl, there is no need to have consecutive zeroes.

Edit. I play slay the spire. That game has great design: some monsters have randomized attacks but still obey to patterns like "it is guaranteed to not use its most dangerous (or least dangerous) attacks 2 (or 3) times in a row". It allows planning while fights are still somewhat random and not repetitive.
Underestimated: cleaving, Deep Elf, Formicid, Vehumet, EV
Overestimated: AC, GDS
Twin account of Sandman25
User avatar

Vaults Vanquisher

Posts: 454

Joined: Thursday, 1st November 2018, 02:33

Post Wednesday, 20th February 2019, 07:37

Re: Simplify the damage formula

Introducing state information into combat that is not readily apparent from looking at the screen would be bad.

One reason that zeros are good is that you want to have a diversity of combat outcomes on any given turn, even when the combatants are at very low hp as duvessa says. It's also important to match time and length scales of the dungeon to average damage so that combat movement has value comparable to attacking or using other combat effects. In order to do this in a way that produces surprising and dynamic combat, you need a lot of low damage rolls, in particular a lot of zeros. That's just math, folks.
This is where mechanical excellence and one-thousand four-hundred horsepower pays off.

For this message the author tealizard has received thanks:
duvessa

Ziggurat Zagger

Posts: 4432

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

Post Wednesday, 20th February 2019, 07:57

Re: Simplify the damage formula

In reality this means players just hold tab because no sane person is going to pay attention to typical 5.000+ attacks during a single game. And if for some reason they do (win streaks?), that means several extra hours (1 second per attack results in 1.5 hours per 5.400 attacks)
Underestimated: cleaving, Deep Elf, Formicid, Vehumet, EV
Overestimated: AC, GDS
Twin account of Sandman25

Abyss Ambulator

Posts: 1131

Joined: Tuesday, 4th January 2011, 15:03

Post Wednesday, 20th February 2019, 12:02

Re: Simplify the damage formula

VeryAngryFelid: I think you overestimate the time impact. For example, MrMan's streak games in the tournament are about 3-4 hours long. I do not think he stops for 1 sec for the vast majority of attacks. It is relatively rare that you have to assess situations after every attack so carefully, most monsters are very weak compared to the player. Of course, it needs a lot of expertise to tell which situations are actually dangerous amongst the sea of popcorn, but most of the time dealing 0 damage does not matter because the monster can't really damage you anyway. (One reason many people hate playing felids: they are designed to be watched after every single damn attack. Maybe you only play felids?)

I also do not agree with your evoke rage example, it seems very artificial. A good player can evoke rage with nearly 100% certainty that she will win the battle before rage runs out, and simply will use a consumable in the remaining cases. That's how rage works, and as long as you have a chance to miss with an attack it won't be really any different. Either you have random battle output, where you have a chance to lose even against the odds, or determined battle, without randomness.

You seem to imply that the output of attacks has a too large variance. I personally do not like the very rare very high damage outputs because they are rare thus hard to learn about/predict, but absolutely do not mind the frequent, thus easily learnable, low damage outputs. I also find most battle outcomes are easily predictable, so while individual attacks vary, due to the large number of attacks the battles are not really.

For this message the author sanka has received thanks:
duvessa

Ziggurat Zagger

Posts: 4432

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

Post Wednesday, 20th February 2019, 12:10

Re: Simplify the damage formula

sanka wrote:VeryAngryFelid: I think you overestimate the time impact. For example, MrMan's streak games in the tournament are about 3-4 hours long. I do not think he stops for 1 sec for the vast majority of attacks. It is relatively rare that you have to assess situations after every attack so carefully, most monsters are very weak compared to the player. Of course, it needs a lot of expertise to tell which situations are actually dangerous amongst the sea of popcorn, but most of the time dealing 0 damage does not matter because the monster can't really damage you anyway. (One reason many people hate playing felids: they are designed to be watched after every single damn attack. Maybe you only play felids?)

I also do not agree with your evoke rage example, it seems very artificial. A good player can evoke rage with nearly 100% certainty that she will win the battle before rage runs out, and simply will use a consumable in the remaining cases. That's how rage works, and as long as you have a chance to miss with an attack it won't be really any different. Either you have random battle output, where you have a chance to lose even against the odds, or determined battle, without randomness.

You seem to imply that the output of attacks has a too large variance. I personally do not like the very rare very high damage outputs because they are rare thus hard to learn about/predict, but absolutely do not mind the frequent, thus easily learnable, low damage outputs. I also find most battle outcomes are easily predictable, so while individual attacks vary, due to the large number of attacks the battles are not really.


I regularly spectate MrMan during this tournament and I am sure he does not check surrounding after every attack, it is not rare to see "no targets are in range" which proves he uses tab a lot.
I don't think my evoke rage example is that artificial, I still remember a game where I was berserked in Spider Nest and killed lightly wounded Wiglaf and several spiders with 10+ attacks. The funny thing is that I was at 1 HP when it started and I had all those monsters adjacent to me. I don't think it is good that it is possible. Low damage outputs do nothing but waste our time and either make us play with tab waiting for "you're are too wounded to attack/there are no targets in range" or be killed with hubris because we stop paying attention to what is going on.
Last edited by VeryAngryFelid on Wednesday, 20th February 2019, 13:33, edited 1 time in total.
Underestimated: cleaving, Deep Elf, Formicid, Vehumet, EV
Overestimated: AC, GDS
Twin account of Sandman25

For this message the author VeryAngryFelid has received thanks:
sanka

Abyss Ambulator

Posts: 1131

Joined: Tuesday, 4th January 2011, 15:03

Post Wednesday, 20th February 2019, 13:26

Re: Simplify the damage formula

Well, at least they result in good tales to tell! :-)

For this message the author sanka has received thanks:
VeryAngryFelid

Swamp Slogger

Posts: 182

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

Location: United States

Post Wednesday, 20th February 2019, 15:16

Re: Simplify the damage formula

VeryAngryFelid wrote:Current system is bad because it results in lots of actions when you deal 0 damage. Having chance to miss is fine, having min weapon damage 0 is fine, having monsters with AC > 0 is fine but having all 3 in the same game is awful especially with non-linear damage formula of crawl. You deal 0 damage during first 10 attacks vs curse toe (carefully checking situation after every action of course) and then you kill it in 2 attacks, wtf? At least simplify damage formula (like OP suggests) and give some meaningful feedback to player how it can be improved with skills/weapon etc. if you insist on keeping it this way.

The proposal would not change this; all it would do is make it easier for the player to get a sense of the odds of 0 damage happening. The topic of whether or not 0 damage is good is irrelevant.

For this message the author stormdragon has received thanks: 2
duvessa, VeryAngryFelid

Ziggurat Zagger

Posts: 5382

Joined: Friday, 25th November 2011, 07:36

Post Friday, 22nd February 2019, 18:26

Re: Simplify the damage formula

There have been previous threads about this where someone (Was it berder? bloax? I think it started with a B) went ahead and actually wrote an anydice.com simulator which showed the distribution of the current formula. If you wanted to visualize crawl damage, that'd do it, although I'm having trouble searching for it.

Edit: I have found some things:

Melee weapon (not unarmed) damage simulator:
viewtopic.php?f=17&t=15669

Bloax crawl fork: (main feature: combat damage averaging)
viewtopic.php?f=17&t=13896

Ziggurat Zagger

Posts: 5382

Joined: Friday, 25th November 2011, 07:36

Post Friday, 22nd February 2019, 18:59

Re: Simplify the damage formula

To give an example from that old calculator, you have a 58% chance to hit for zero damage (the monster has a fairly high AC value here), but if you do hit for at least 1 damage, the most likely amount you hit for is either 7 or 8 damage. Yet the max damage that can be done goes all the way up to 64. But any hit over 40 is so rare as to basically not exist.

The exact code there is of course out of date, and some things (like strength/dex weighting) have been removed. I think it was also before the multiplier for strength got buffed. In short, lots of little things have changed, but I think the overall big picture, and crawl damage being fairly heavily skewed to the left, are still true to this day.

Ziggurat Zagger

Posts: 4432

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

Post Saturday, 23rd February 2019, 19:47

Re: Simplify the damage formula

tasonir wrote:To give an example from that old calculator, you have a 58% chance to hit for zero damage (the monster has a fairly high AC value here), but if you do hit for at least 1 damage, the most likely amount you hit for is either 7 or 8 damage. Yet the max damage that can be done goes all the way up to 64. But any hit over 40 is so rare as to basically not exist.

IMHO it proves that current distribution is rather bad and there should not be preserved when simplifying the damage formula.
Underestimated: cleaving, Deep Elf, Formicid, Vehumet, EV
Overestimated: AC, GDS
Twin account of Sandman25

Blades Runner

Posts: 593

Joined: Tuesday, 11th December 2018, 19:14

Post Tuesday, 26th February 2019, 21:05

Re: Simplify the damage formula

tasonir wrote:To give an example from that old calculator, you have a 58% chance to hit for zero damage (the monster has a fairly high AC value here), but if you do hit for at least 1 damage, the most likely amount you hit for is either 7 or 8 damage. Yet the max damage that can be done goes all the way up to 64. But any hit over 40 is so rare as to basically not exist.

The exact code there is of course out of date, and some things (like strength/dex weighting) have been removed. I think it was also before the multiplier for strength got buffed. In short, lots of little things have changed, but I think the overall big picture, and crawl damage being fairly heavily skewed to the left, are still true to this day.


Getting some hit > 40 in that example has a bit more than .3% chance of happening. Across a 3 rune game we should expect to see such an outcome happening several dozen times, depending on build type it could be significantly more or less (player might swing a weaker weapon more times, similarly seeing more enemy attacks = more odds of an outlier hit).

I don't mind 0 damage hits though. I'm all for more intuitive representation of expected average damage by players/monsters. This lets a diligent but relatively new player make threat assessments closer to experienced players if they take the time to consider each enemy on screen + potential adds.

Zot Zealot

Posts: 1004

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

Post Monday, 25th May 2020, 19:39

Re: Simplify the damage formula

I'm wondering whether the same feel as the current situation could be achieved by simplifying the damage formula and increasing the monster dodge chances.

Currently the large variance from the damage formula (ie the large tail and large chance of very small damage) makes combat feel relatively 'swingy'. We could achieve the same swingyness with misses.
Additional benefits (in addition to making the game simpler):
Dexterity would become more useful
Crossbows being more accurate than bows would become more relevant
Sniper could actually become good.

Additional challenges:
The dodging formulas would need to be looked at, in addition to the damage formulas
It would be non-trivial to balance this whilst keeping the monster damage formulas the same as the player damage formulas (simple fixes like damage = D(4*current average damage) would make monsters affected differently by weapons than untrained players).

Dungeon Master

Posts: 250

Joined: Thursday, 27th November 2014, 19:12

Post Tuesday, 26th May 2020, 05:26

Re: Simplify the damage formula

I’ll start this with: part of the reason why the combat formulas don’t see a lot of change is that in the dev team we like the current playfeel of the formulas that were ad hoc matched to behave similar to linley’s ad hoc formulas long ago when crawl was much more opaque with numbers.

A consequence of the strange formulas is that it’s hard for the player to connect player facing variables (skills, stats, weapon numbers, and brands) to the distribution.

Here’s the fundamental tension: it’s not just mean and variance that make the playfeel of the formulas, but the higher moments too. A compelling simplification would produce a collection of combat formulas that are clearer but also preserve at least the third and fourth moments of the distributions involved.

So here’s your challenge, would be simplifiers: work out the moment generating function of the crawl damage formula in terms of player facing variables (maybe skip brands for round 1), and see if you can find a simpler formula that matches the first four moments pretty well (at least over a typical range of values for the player variables).
User avatar

Zot Zealot

Posts: 982

Joined: Monday, 29th September 2014, 09:04

Post Tuesday, 26th May 2020, 07:00

Re: Simplify the damage formula

The third central moment is the measure of the lopsidedness of the distribution; any symmetric distribution will have a third central moment, if defined, of zero. The normalised third central moment is called the skewness, often γ. A distribution that is skewed to the left (the tail of the distribution is longer on the left) will have a negative skewness. A distribution that is skewed to the right (the tail of the distribution is longer on the right), will have a positive skewness.

The fourth central moment is a measure of the heaviness of the tail of the distribution, compared to the normal distribution of the same variance. Since it is the expectation of a fourth power, the fourth central moment, where defined, is always nonnegative; and except for a point distribution, it is always strictly positive. The fourth central moment of a normal distribution is 3σ4.

https://en.wikipedia.org/wiki/Moment_(mathematics)#Standardized_moments
User avatar

Vaults Vanquisher

Posts: 454

Joined: Thursday, 1st November 2018, 02:33

Post Tuesday, 26th May 2020, 12:12

Re: Simplify the damage formula

Actually, no, the higher moments are not individually important -- this is the same as saying you have to closely approximate the current distributions. The quantity you want to look at to control the unpredictability of combat is the Shannon entropy, to which the higher moments contribute. In fact, even variance by itself isn't that important. People use it as a proxy for this other less familiar idea.

I actually worked out an entire new combat system based on current formulas using entropy methods a couple years ago for an abortive project. It's an interesting exercise. It's not that hard to match existing formulas for melee and ranged weapons with new variants taking into account all stats and combat variables that go into crawl combat via this methodology. Doing the same for multidice spell formulas is more involved, but doable as long as you're willing to give up on formulas in favor of tables and interpolation.
This is where mechanical excellence and one-thousand four-hundred horsepower pays off.

Zot Zealot

Posts: 1004

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

Post Tuesday, 26th May 2020, 13:34

Re: Simplify the damage formula

Yea I was using 'variance' as a catch-all term; perhaps this was unwise. In the context of crawl I thought it meant a large chance of small damage and a tiny chance of really large damage. I was somewhat wrong, but more about that below.

I've just done some numerics, and the current crawl damage formulas are actually surprisingly close to a simple uniform distribution or a normal distribution with an average of 2 standard deviations (mu = 2 sigma). I wasn't expecting this. At the start of the game you have a uniform distribution (when only weapon base damage contributes) and in the midgame the various factors give you a small chance of having damage spikes but the slaying also suppresses the chance of very low damage.

Only in the very late game, practically Zot & Extended, you get significantly more skew (3rd moment) and kurtosis (4th moment) than you would with a uniform distribution.

This makes finding a nice distribution which has the same behaviour as the current distribution in all phases of the game tricky - all the nice distributions with a fat tail would be different in the early game whereas the more compact distributions don't capture the behaviour of the late game. Quick blades in particular profit from damage spikes, so simply looking at the max damage to determine the distribution would significantly nerf them.

Again though, I don't think that capturing the same behaviour as we've currently got should be the main goal. If the early-game behaviour is fun, why not have it in late game? If the late-game behaviour is fun, why not have it in early game? I understand that players need a bit more dependability in the early game, but... there are workarounds. If you really want both types of distribution in the game, perhaps make the type of distribution dependent on weapon type, and give players a choice.
I understand that changing the damage distribution would be a lot of work; if for example the damage distribution was made uniform throughout the game, the late game big bads might need to be rebalanced. Maybe.

I also understand that the devs don't want to change the damage distributions. A difference in design philosophy. I know they put in a lot of work, and I do appreciate the game, so I'll try not to complain ;)

Re Tealizard: the Shannon entropy (as I understand it) is also just a measure of property we're interested in in crawl, which is the chance of getting low rolls and having to retreat or getting a lucky hit allowing you to engage against big foes. To see why it is merely a measure, consider the following damage distributions:
(x-axis is damage, y-axis is chance)

  Code:
#  #  #  #
#  #  #  #
##########

high entropy, slightly predictable

  Code:
 
##########
##########

low entropy, slightly predictable

  Code:
    ###   
 ########
##########

middle entropy, very predictable

  Code:
#   
##
#################

high entropy, very swingy
  Code:
##             ##
###           ###
#################

middle entropy, extremely swingy
User avatar

Vaults Vanquisher

Posts: 454

Joined: Thursday, 1st November 2018, 02:33

Post Tuesday, 26th May 2020, 13:47

Re: Simplify the damage formula

So the highest entropy distribution on a bounded interval is the uniform distribution. Generally speaking, you impose some kind of constraint to select a set of distributions, for example a prescribed expectation value, then maximize entropy within that set of distributions. In this way you get interesting distributions, for example in the case of an expectation value constraint, you get an exponential distribution. Most common distributions in statistics have descriptions of this type.

The way to think about crawl distributions in this framework is to look at the distribution of damage for a given combat action -- of course, you must count misses as zero damage. For melee and similar attacks, the relevant constraints would be the interval of possible damage values (essentially the maximum damage) and the average damage. These are the most important variables in roguelike combat. Now you may want to find the most unpredictable distribution that satisfies these constraints. This turns out to be an exponential distribution, a nice object described by a single parameter, though the relationship between this parameter, the maximum damage and the average damage is slightly complicated and not easy to solve for directly in general. It's completely doable numerically though, of course.

Now if you want to model damage distributions where some measure of central tendency is important, for example spell damage formulas with many dice, then you need more constraints and things get more complicated. It's still completely doable of course. The point is that following this kind of recipe you can convert weird dice formulas into weird distribution formulas specified by understandable statistical quantities rather than built from scratch as dice throwing procedures. The difficulty is subsumed in some numerics that aren't super important to understand once implemented -- in some sense the distributions that come out of the process are naturally associated with the specified statistics.
This is where mechanical excellence and one-thousand four-hundred horsepower pays off.
User avatar

Zot Zealot

Posts: 982

Joined: Monday, 29th September 2014, 09:04

Post Tuesday, 26th May 2020, 23:45

Re: Simplify the damage formula

I'm not sure I agree with the idea that current playfeel is tightly connected with the specific details of the current damage distributions.

For all we know, the playfeel would be identical to replacing all these formula with much simpler formula which more-or-less match the mean and stddev.

"Meleebug" doubled all melee damage for two weeks and was noticed as a vague sense of something being off by one of the most experienced players. I do not think player sensitivity to these formulas is very high. I think the best approach is to simplify without regard to the more complex distribution details and then use an experimental branch to empirically compare "playfeel". The formulas should be as simple as possible.

For this message the author chequers has received thanks: 2
Jano, petercordia
User avatar

Vaults Vanquisher

Posts: 454

Joined: Thursday, 1st November 2018, 02:33

Post Wednesday, 27th May 2020, 00:32

Re: Simplify the damage formula

The important thing is the ease of design, not simplicity of the formulas themselves, which you don't have to know anything about other than a couple of key statistics. You will not come up with significantly simpler formulas than the existing ones that have the same kinds of narrow tails and produce the same swingy dynamics. To make any real progress here, you have to bite some bullets. If you don't want to do that, do nothing. It will be better than half-measures.
This is where mechanical excellence and one-thousand four-hundred horsepower pays off.

bel

Cocytus Succeeder

Posts: 2184

Joined: Tuesday, 3rd February 2015, 22:05

Post Wednesday, 27th May 2020, 14:25

Re: Simplify the damage formula

ebering wrote:I’ll start this with: part of the reason why the combat formulas don’t see a lot of change is that in the dev team we like the current playfeel of the formulas that were ad hoc matched to behave similar to linley’s ad hoc formulas long ago when crawl was much more opaque with numbers.

A consequence of the strange formulas is that it’s hard for the player to connect player facing variables (skills, stats, weapon numbers, and brands) to the distribution.

Here’s the fundamental tension: it’s not just mean and variance that make the playfeel of the formulas, but the higher moments too. A compelling simplification would produce a collection of combat formulas that are clearer but also preserve at least the third and fourth moments of the distributions involved.

So here’s your challenge, would be simplifiers: work out the moment generating function of the crawl damage formula in terms of player facing variables (maybe skip brands for round 1), and see if you can find a simpler formula that matches the first four moments pretty well (at least over a typical range of values for the player variables).

I refuse to believe that anyone could describe the "playfeel" of the old airstrike formula. Can someone tell me even now what this formula was trying to do?
  Code:
8+random2(random2(4)+floor(random2(power)/6)+floor(random2(power)/7))


More seriously, I think many of the justifications are retro-active. Crawl's damage formulae are extremely weird, and it's hard to even think of what they're trying to achieve. I have made this comment in another context, namely the XP curve of the game.

I do not think that it makes sense to try to reproduce the dynamics of such a system. It's better to look at what goals one wants to achieve, then design formulae based on those goals. Then, we can playtest them and see what the "playfeel" is. Crawl combat is so swingy and the numbers so opaque that I suspect that one can get away with a pretty wide range of formulae without anyone noticing much.
User avatar

Vaults Vanquisher

Posts: 454

Joined: Thursday, 1st November 2018, 02:33

Post Wednesday, 27th May 2020, 16:31

Re: Simplify the damage formula

Apparently understanding why something works and what makes it good is less important than figuring out what the goals of its designers were and then pursuing them more authentically. I don't know why I bother lmao
This is where mechanical excellence and one-thousand four-hundred horsepower pays off.

Return to Game Design Discussion

Who is online

Users browsing this forum: No registered users and 177 guests

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