Page 1 of 2

Rant:Yet again melee combat in crawl is too random and sucks

PostPosted: Tuesday, 4th August 2015, 20:25
by tasonir
So I recently won a TeMo, and figured let's start up a nice easy GrTm for some transmuter streaking. Then on d:2, I'm level 4 with level 5 in unarmed combat, and I encounter a single adder. Keep in mind I have 6 ac, 12 ev, and am completely immune to poison:

  Code:
Things that are here:
a club; a goblin corpse
You miss the adder. The adder closely misses you.
The adder bites you but does no damage.
You barely miss the adder. The adder closely misses you.
Health restored: 25
You closely miss the adder. The adder closely misses you.
You miss the adder. Your punch misses the adder. The adder closely misses you.
You completely miss the adder. The adder bites you but does no damage.
The adder barely misses you.
You hit the adder. The adder bites you but does no damage.
You miss the adder. The adder completely misses you.
You closely miss the adder. The adder bites you but does no damage.
You closely miss the adder. The adder closely misses you.
You closely miss the adder. The adder bites you.
You take 3 damage, and have 22/25 hp.
You miss the adder. The adder bites you. The adder bites you.
You take 3 damage, and have 19/25 hp.
You closely miss the adder. The adder bites you.
You take 3 damage, and have 16/25 hp.
You closely miss the adder. The adder misses you.
You closely miss the adder. The adder bites you.
You take 4 damage, and have 12/25 hp.
You are too injured to fight recklessly!
Your feet morph into talons. The adder bites you.
The adder misses you. The adder bites you.
* * * LOW HITPOINT WARNING * * *
You take 8 damage, and have 4/25 hp.
MASSIVE DAMAGE!!
You now have 6/7 mp.
Drink which item? (? for menu, Esc to quit)
Okay, then.
You barely miss the adder. The adder barely misses you.
You punch the adder! The adder bites you.
* * * LOW HITPOINT WARNING * * *
You take 2 damage, and have 2/25 hp.
You hit the adder but do no damage. Your kick misses the adder.
The adder bites you.
You die...


This was a completely solitary fight against a single adder from full health on a gargoyle. Now granted I should have cast beastly appendage at the start of the fight and not near the end. But look at my earlier fight against an adder:

  Code:
An adder comes into view.
The adder bites you but does no damage.
You punch the adder! The adder closely misses you.
You hit the adder.
You kill the adder!
Your Unarmed Combat skill increases to level 5!

Full morgue here if you want to see the log yourself: http://dobrazupa.org/morgue/tasonir/mor ... 080926.txt

I know people have argued for completely unpredictable combat because it "makes you have to be more careful" but this is completely BS.

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Tuesday, 4th August 2015, 20:44
by duvessa
this looks more like you discovering that unarmed is bad

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Tuesday, 4th August 2015, 20:44
by dowan
Well, clearly you should have run the moment you saw the adder :P

I think honestly crawl's randomness is unlikely to change, I think the easier way to fix situations like this is (and Sandman's gonna hate me for this) enabling pillar dancing before D3-D4 by not allowing any monsters over speed 10 to spawn. Because otherwise, any combat with an inescapable creature could end up like this. A jackal could do this too, although it's far less likely.
After a certain point the player can be assumed to have some sort of escape consumable, so it's ok at that point to have inescapable monsters because they're not really inescapable anymore.

Or, I guess if one is inclined to be more moderate, adder evasion could just be lowered a bit.

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Tuesday, 4th August 2015, 20:46
by Kate
Seems fine that adders on D:2 can still kill you if you just hold tab and don't, for example, cast (or even memorise???) any of your spells, or use any items at all. (Edit: if this is just a rant for therapeutic purposes then fair enough I guess, but it would be pretty hard to argue that this in particular is really the fault of randomness in melee combat, whether that randomness is reasonable or not!)

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Tuesday, 4th August 2015, 21:09
by tasonir
Yes this is a rant and no, I'm not expecting any changes.

But I don't think that it's fair to claim this isn't the fault of randomness - to respond to both marvin and duvessa's comments, this is why I included the earlier fight, while I was even weaker, against an adder where I took no damage and killed it in two hits. Level 5 unarmed is weak, sure - I doubt I'd have missed so often as a gladiator with a quarterstaff - but even with unarmed, I had no problem completely destroying the previous adder. The problem is consistency.

I did cast appendage, but I agree that it was far too late and I'm not claiming the game is a shining example of optimal play. I don't think it would be terribly helpful to have tried to cast sticks to snakes or spider form with no training, although arguably you'd have a decent enough chance to get sticks to snakes to work after a few tries, sure. I do think it's an excellent example of a highly random and luck-based melee combat system, though.

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Tuesday, 4th August 2015, 21:28
by Sprucery
tasonir wrote:I do think it's an excellent example of a highly random and luck-based melee combat system, though.

Sure. Crawl has that (nobody probably denies it). Still, the death wasn't caused by the randomness but rather by you not realizing the randomness (and perhaps just tabbing too fast?). Don't get me wrong, I don't want to sound condescending or anything, but not casting BA before the fight was a huge mistake.

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Tuesday, 4th August 2015, 21:32
by tasonir
No offense taken. I guess my point is just that when you have a 99% chance of an easy victory, having to pre plan for the 1% failure chance is tedious and poor design. I acknowledge that it is in fact possible to pre plan for the 1%, and that this could have been avoided.

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Tuesday, 4th August 2015, 22:32
by dynast
You play a GrTm and you manage to die to a adder... thats... shameful. RNG or not.

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Tuesday, 4th August 2015, 23:29
by Kate
Sticks to Snakes even with no training would only have been at 20% fail or so (and you don't even to spend any time to wield arrows now, wow so OP!). I mean I'm not really doubting that it's sometimes possible to die just due to overwhelming bad luck in melee combat but I really don't see how this example qualifies there.

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Tuesday, 4th August 2015, 23:35
by Berder
tasonir wrote:No offense taken. I guess my point is just that when you have a 99% chance of an easy victory, having to pre plan for the 1% failure chance is tedious and poor design. I acknowledge that it is in fact possible to pre plan for the 1%, and that this could have been avoided.

In this case, most of the time you'd be fine killing the adder. From your dump I see that shortly prior to your death you killed an adder in like 2 hits. So normally with that character it wouldn't be a big mistake to fight an adder without bothering to cast beastly appendage or throw javelins or use s2s. With a caveat.

The caveat is your complete lack of identified emergency consumables - no cures, heal wounds, blinks, fears, not even any teles. That should have made you very nervous and cautious. My point is, you don't always have to pre-plan for the 1% situation, unless you have no emergency consumables.

It was also just astoundingly bad luck, and if I were in your shoes I might have made the same mistake.

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Wednesday, 5th August 2015, 00:15
by bcadren
When it really sucks is when you're all I can kill lom lobon with 3 LCS's (fairly possible with good earth/conj and a staff of earth or conj); then you miss enough times you are low on MP and HP in near melee range with one of the deadliest creatures in the game...

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Wednesday, 5th August 2015, 03:35
by tedric
It's probably also worth remembering that adder HP can vary from 6 to 16 (according to LearnDB anyway), which is a pretty large spread in relative terms. The first adder may have been at the lower end of the spectrum, the second perhaps on the high end.

The bottom line is that a caster's level 1 spell is meant to be used in every fight, and there's hardly ever a good reason not to use it -- at least until you have a reasonable backup weapon, which I don't think 5 UC quite qualifies as in this case -- and by not using it, you're opening yourself up not just to bad damage rolls, but also to the combinatorial capriciousness of everything else the RNG is doing. I really don't think you ran into a rant-worthy "super-unlucky 1%" situation here, quite the opposite in fact: you seem to have substantially underestimated the potential for any early adder fight (even for Gr) to go wrong.

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Wednesday, 5th August 2015, 14:00
by dowan
Of course, it's silly to try to prove that a series of bad rolls can happen against an enemy faster than you. Obviously they can happen, it's a game with randomness. You have a chance to miss, you could miss 100 turns in a row. You have a chance to get hit, you could get hit 100 times in a row. If you can't disengage with an enemy, there's always a chance of a series of bad rolls. One doesn't have to come up with an example to prove this, it's the nature of random combat.

Taken to its extreme, it's possible for no escape consumables to ever generate, it's possible to have this situation happen in snake with a shock serpent. It could happen in zot with an orb guardian.

I do think adders cause this more often than any other creature, due to their high EV and fast move speed, and the fact that they can spawn on D2, where it's far more reasonably likely that the player might not have any escape consumable. Moving adder spawns to floor 3 or 4 would seem fairer to me, because I think they're one of the more common sources of unavoidable deaths.

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Wednesday, 5th August 2015, 15:19
by Sar
D:2 adders are good IMO

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Wednesday, 5th August 2015, 16:54
by Sprucery
Sar wrote:D:2 adders are good IMO

The best kind!

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Wednesday, 5th August 2015, 17:52
by tasonir
I'd agree that D:1 jackals and D:2 adders are some of the mobs most likely to kill experienced players, but that's definitely intentional, and I don't think adders need to be nerfed in any way. Didn't know wielding arrows was instant now (or that you just don't have to wield them? either case is great), so that's nice.

But the intent of the thread is more that highly unpredictable rolls is frustrating, rather than "this death was completely unavoidable". The vast difference between the two code blocks is more the point than the "I died" part. I know I made a mistake :)

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Wednesday, 5th August 2015, 18:00
by tedric
but, like, if you didn't make a mistake then the highly unpredictable rolls wouldn't be so frustrating

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Wednesday, 5th August 2015, 18:14
by tasonir
tedric wrote:but, like, if you didn't make a mistake then the highly unpredictable rolls wouldn't be so frustrating

Well this is entirely subjective, but I'd rather it have been my mistake that killed me rather than a truly impossible to win scenario. I have some streaks but I'll never be a super streaker because I have trouble being extremely consistent on things like this - I know I have a 99% chance to kill an adder easily, so I won't buff up for the 1% chance that the RNG spews bile all over my game. I think crawl would be better if it didn't sometimes do this, and I know a fair amount of players agree, but a fair amount also disagree...Such is life :)

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Wednesday, 5th August 2015, 18:37
by Sandman25
Chance to die is much higher than 1% though.

  Code:
           AvHitDam | MaxDam | Accuracy | AvDam | AvTime | AvSpeed | AvEffDam
Attacking:      3.7 |     12 |      40% |   1.5 |    91  |  1.10 |      1.6
Defending:      0.9 |      4 |      46% |   0.4 |    76  |  1.32 |      0.5

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Wednesday, 5th August 2015, 18:48
by Berder
Maybe, but you can't tell it's higher than 1% based only on that data. By way of illustration, suppose you have a bent coin that lands heads 70% of the time. In this simplified example, heads is like you dealing a certain amount damage and tails is like the adder dealing a certain amount of damage. What are the odds the coin will land heads 10x before it lands tails 10x? Answer: about 97%. The idea is, over many rounds of combat, a small difference in damage becomes amplified into a large chance of winning.

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Wednesday, 5th August 2015, 19:07
by bel
To me, that data is almost enough to determine chance of dying. Let's assume (for simplicity) for the moment that adder HP is average (6 - 16, so avg. 11).

Given avgeffdam for both adder and player, and adder and player HP, one could determine chance of dying. I am not doing the calculation here, but it seems obvious to me that it is > 1%. Roughly, not exactly, because melee damage is so weird.

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Wednesday, 5th August 2015, 20:08
by tasonir
Sandman25 wrote:Chance to die is much higher than 1% though.

  Code:
           AvHitDam | MaxDam | Accuracy | AvDam | AvTime | AvSpeed | AvEffDam
Attacking:      3.7 |     12 |      40% |   1.5 |    91  |  1.10 |      1.6
Defending:      0.9 |      4 |      46% |   0.4 |    76  |  1.32 |      0.5


I don't think that fsim supports the claim that the chance to die is higher than 1%. I wrote up a quick simulator to try it:

Spoiler: show
  Code:
        srand(arc4random())
        var adderLife: Double = 16
        var adderAccuracy: Double = 0.46
        var adderDamage: Double = 0.6

        var playerLife: Double = 25
        var playerAccuracy: Double = 0.40
        var playerDamage: Double = 1.5

        var index = 0

        var playerWon = 0
        var adderWon = 0

        for (index = 0; index < 1000000; index++)
        {
            while (playerLife > 0 && adderLife > 0)
            {
                let newRand = drand48()
                let newRand2 = drand48()

                //adder attacks
                if (newRand < adderAccuracy)
                {
                    playerLife = playerLife - adderDamage
                }

                //player attacks
                if playerLife > 0
                {
                    if (newRand2 < playerAccuracy)
                    {
                        adderLife -= playerDamage
                    }
                }
                //NSLog("random accuracy rolls: \(newRand) \(newRand2)")
            }

            if playerLife <= 0
            {
                //NSLog("player died")
                adderWon++

            }
            else if adderLife <= 0
            {
                //NSLog("adder died")
                playerWon++
            }

            playerLife = 25
            adderLife = 16
        }

        NSLog("Adder won: \(adderWon) Player won: \(playerWon)")


And after a million trials, the adder has won 0, and the player all of them. This is inaccurate, because I am not simulating the way crawl actually does damage rolls, and am simply using the fsim's average damage for each attack. This does make an interesting point though, which is if you rolled for average damage each time, an adder couldn't kill this character. I used .6 for the average adder damage because I was afraid that fsim might have rounded .55 to .5, and wanted to be charitable. Likewise I even rounded the player damage down to 1.5.

I'm relatively sure the simulator is bug free - for example increasing the adder accuracy to 99% gives the adder a 2.5% victory rate, or giving it 3.6 average damage (with the normal 46% accuracy) gives it a 96% victory rate. The main limitation of always dealing the attacker's average damage remains.

You're basically dealing three times the damage against something that has 60% the health; that's a very safe fight with any reasonable dice. Crawl doesn't believe much in reasonable dice, however.

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Wednesday, 5th August 2015, 20:11
by Siegurt
That is why averages are not an adequate substitute for probability.

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Wednesday, 5th August 2015, 20:19
by tasonir
Siegurt wrote:That is why averages are not an adequate substitute for probability.

Attempting to understand how crawl rolls dice is like peering into the mind of a madman; I'm not sure I'd survive the encounter. Maybe I can extend this to use some of code from the old anydice simulators, but that is much more complex...

While I understand the limitations, I do think it nevertheless supports the claim that the actual odds are in the ballpark of 1%, and aren't in fact something like 8% or 15%.

How bad/how much work would it be to extend fsim to simulate an actual battle against the monster you fight? So it tracks the remaining health of the player and the mob, and when one dies, restores them to full life, and at the end of the fsim prints out how many times you died vs how many times the monster died? Basically, what I wrote above, but with the accuracy of actually fully simulating crawl dice.

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Wednesday, 5th August 2015, 20:24
by bel
Thanks, it turns out that I was talking out of my ass. Shouldn't have said > 1% without at least a back of the envelope calculation. At a quick glance, the code seems bug-free.

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Wednesday, 5th August 2015, 20:27
by tedric
tasonir wrote:
tedric wrote:but, like, if you didn't make a mistake then the highly unpredictable rolls wouldn't be so frustrating

Well this is entirely subjective, but I'd rather it have been my mistake that killed me rather than a truly impossible to win scenario.

but, like, it was your mistake that killed you

i don't see how this was "a truly impossible to win scenario" when you had the option to buff yourself first, or to choose not to fight the adder in the first place

and until someone does the math to simulate actual dice rolls, i will continue to assume that an early adder is significantly more than a 1% threat

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Wednesday, 5th August 2015, 20:32
by bel
There's a crawl arena where monsters can fight each other. Not sure if this is possible with player (looks not).

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Wednesday, 5th August 2015, 20:43
by tasonir
tedric wrote:
tasonir wrote:
tedric wrote:but, like, if you didn't make a mistake then the highly unpredictable rolls wouldn't be so frustrating

Well this is entirely subjective, but I'd rather it have been my mistake that killed me rather than a truly impossible to win scenario.

but, like, it was your mistake that killed you

i don't see how this was "a truly impossible to win scenario" when you had the option to buff yourself first, or to choose not to fight the adder in the first place

and until someone does the math to simulate actual dice rolls, i will continue to assume that an early adder is significantly more than a 1% threat

Yes. Maybe it wasn't phrased clearly, but I was just saying it's my preference that it is my mistake that killed me - I wasn't claiming that didn't happen. It did.

As for adders being more than a 1% threat, generally speaking they are very deadly, yes. To this character, not so much.

1) I'm completely immune to poison.
2) I deal 3 times its average damage.
3) With Gr +3 ac and the helmet I had, I have 6 ac, with gargoyle in robe GDR (31%, equal to swamp dragon armor for other races). So my 6 ac is HIGHER than the adder's max damage roll of 5; most adder attacks will deal 0 damage.

Of course, when you get a few max adder rolls in a row against 0 or 1 armor rolls (both result in 1 due to GDR, which seems to be rounded down, as I was hit for 4 damage twice) then it's still possible to lose, which is the part that my average damage simulator can't simulate, so the adder has a 0% chance to win. If something useful comes out of this thread, it's probably going to be the above enhancement to fsim, which I may try to get working, it doesn't seem like it should be that terribly hard, but I'm probably wrong.

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Wednesday, 5th August 2015, 20:47
by Siegurt
tasonir wrote:Attempting to understand how crawl rolls dice is like peering into the mind of a madman;

Crawl rolls dice like humans do mostly, it picks a random number between 0 and N where N is the value supplied to the rand2 function.

What is occasionally hard is keeping track of which things are random which ones aren't and which commonly quoted stuff is just an average used for shorthand.

For example an often said thing is 'Holy adds 75% more damage' which isn't quite true. Holy actually adds 0-150% damage after the normal damage is rolled and monster ac is rolled and subtracted from it. If you used the shorthand of the averages, you might be surprised in all sorts of ways in how the results differ from your expectations.

In this case the overwhelming fallacy that using averages produces, is that 50% accuracy is the same as always hitting exactly half of your attacks over a series of attacks.

It is plain to see that even with a completely fair coin, you will occasionally get heads 92 times in a row. It is horribly unlikely though.

Since you are using averages, what your program actually does is show us that in the average case the adder will not win, it shows up this a lot of times, which isn't that helpful. Sort of like demonstrating that 2+2=4 over and over again.

It doesn't tell us anything about the probabilities of not average things happening.

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Wednesday, 5th August 2015, 20:52
by tasonir
It isn't entirely deterministic, as it does roll for accuracy, and you can boost the adder to 66% accuracy and start to see it getting some wins. So it's more like saying a 50% chance of 5 is bigger than a 60% chance of 2, rather than 2+2 always being 4. I will take some time later on and look at the fsim code to see how reasonable adding health tracking and reporting wins/losses would be. That would be the simplest way to get an actual estimation, I don't think I have the determination to add crawl damage dice simulation to my above simulator.

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Wednesday, 5th August 2015, 20:57
by Siegurt
tasonir wrote:It isn't entirely deterministic, as it does roll for accuracy, and you can boost the adder to 66% accuracy and start to see it getting some wins. So it's more like saying a 50% chance of 5 is bigger than a 60% chance of 2, rather than 2+2 always being 4. I will take some time later on and look at the fsim code to see how reasonable adding health tracking and reporting wins/losses would be. That would be the simplest way to get an actual estimation, I don't think I have the determination to add crawl damage dice simulation to my above simulator.

Well, yes, I did oversimplify :)

Incidentally the fsim code literally does a round of combat and then tracks the damage done/attacks done/attacks hit.

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Wednesday, 5th August 2015, 23:15
by tasonir
You ever have one of those nagging thoughts that just bugs you until you finish the task you started? So it's not entirely accurate because I just used uniform distributions, so everything rolls 1dX for damage, but it now rolls damage. This slightly overestimates player damage which is skewed towards the low end of the distribution, but I also completely left out gargoyle GDR, so let's call it even. Modeling GDR wouldn't be that hard to do, though.

Edit: See the updated code below, this version wasn't as accurate so I removed it.

Output: Adder won: 13 Player won: 999987

So claiming the adder has a 1% chance to win is being downright charitable, imho. I'm not sure if I'm accounting for speed correctly anymore; I previously just used the effective damage per 10 auts, but now that it's rolling damage it's probably screwed up a little bit. But hey. This really isn't a fight the adder should win. It also doesn't account for regeneration, but this is likely minimal for both. How fast does an adder regenerate, anyways?

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Wednesday, 5th August 2015, 23:17
by bel
Thanks for the most mathematically sophisticated rant I have ever read on this forum.

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Wednesday, 5th August 2015, 23:42
by tasonir
I posted too soon - updated version with some enhancements below:

Spoiler: show
  Code:
        srand(arc4random())

        var adderLife: Double = 16
        var adderAccuracy: Double = 0.46
        var adderAttackCount = 0

        var playerLife: Double = 25
        var playerAccuracy: Double = 0.40

        var index = 0

        var playerWon = 0
        var adderWon = 0

        for (index = 0; index < 1000000; index++)
        {
            while (playerLife > 0 && adderLife > 0)
            {
                var randomTo5 = arc4random_uniform(5)
                var randomTo6 = arc4random_uniform(6)
                var randomTo1 = arc4random_uniform(1)
                var randomTo12 = arc4random_uniform(12)

                var accuracyRoll = drand48()

                if (randomTo6 == 0)
                {
                    randomTo6 = 1
                }

                //adder attacks
                adderAttackCount++
                if (accuracyRoll < adderAccuracy)
                {
                    if (randomTo5 > randomTo6)
                    {
                        playerLife = playerLife - Double(randomTo5 - randomTo6)
                    }

                }

                //After 3 attacks, let the adder attack twice.  Approximation for adder being 13 speed.
                if (adderAttackCount == 3)
                {
                    adderAttackCount = 0
                    accuracyRoll = drand48()
                    randomTo5 = arc4random_uniform(5)
                    randomTo6 = arc4random_uniform(6)

                    if (randomTo6 == 0)
                    {
                        randomTo6 = 1
                    }

                    if (accuracyRoll < adderAccuracy)
                    {
                        if (randomTo5 > randomTo6)
                        {
                            playerLife = playerLife - Double(randomTo5 - randomTo6)
                        }
                       
                    }
                }

                //player attacks
                if playerLife > 0
                {
                    accuracyRoll = drand48()
                    if (accuracyRoll < playerAccuracy)
                    {
                        if (randomTo12 > randomTo1)
                        {
                            adderLife -= Double(randomTo12 - randomTo1)
                        }
                    }
                }
            }

            if playerLife <= 0
            {
                adderWon++
            }
            else if adderLife <= 0
            {
                playerWon++
            }

            playerLife = 25
            adderLife = 16
            adderAttackCount = 0
        }

        NSLog("Adder won: \(adderWon) Player won: \(playerWon)")


Adder won: 16 Player won: 999984

So it's not quite one in a million, but it is 16 in a million! Accounts for GDR, gives a pretty close (favorable to the adder) estimation of the speed bonus, rolls uniform damage (favorable to the player). Doesn't account for regeneration, should be pretty robust overall though. All adders are assumed to have the max of 16 health.

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Thursday, 6th August 2015, 00:04
by Siegurt
tasonir wrote:You ever have one of those nagging thoughts that just bugs you until you finish the task you started? So it's not entirely accurate because I just used uniform distributions, so everything rolls 1dX for damage, but it now rolls damage. This slightly overestimates player damage which is skewed towards the low end of the distribution, but I also completely left out gargoyle GDR, so let's call it even. Modeling GDR wouldn't be that hard to do, though.

Edit: See the updated code below, this version wasn't as accurate so I removed it.

Output: Adder won: 13 Player won: 999987

So claiming the adder has a 1% chance to win is being downright charitable, imho. I'm not sure if I'm accounting for speed correctly anymore; I previously just used the effective damage per 10 auts, but now that it's rolling damage it's probably screwed up a little bit. But hey. This really isn't a fight the adder should win. It also doesn't account for regeneration, but this is likely minimal for both. How fast does an adder regenerate, anyways?

Adders attack (and move) 130% faster than once per 10 aut, for comparison's sake you need the player's attack speed as well.

In this case you need 13 attacks for every 11 player attacks (which is 1.1818...)

It'd probably be simpler at that point to just simulate auts.

Note that the 10/13ths adder "speed" actually rounds randomly in auts (So the 7.69.. actually rounds to either 7 or 8 auts every time weighted .69../1 towards 8)

However that serves to reduce, not increase the adder's chances (since the player is faster than you gave him credit for)

Also the adder might be anywhere fairly randomly in his cycle of extra attacks, so you probably want to randomize that (so sometimes the adder gets his extra attacks right away)

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Thursday, 6th August 2015, 00:28
by tasonir
Significant fix: We can reduce the imbalance of giving the player uniform damage distribution by using one that has the same average as the average hit damage from fsim, which is a mere 3.7. A uniform distribution from 0 to 8 matches that fairly well, or 0 to 7 if we want to be conservative.

With 8 max damage:
Adder won: 10618 Player won: 989382, aka a 1% adder win rate.

With 7 max damage:
Adder won: 20618 Player won: 979382, aka a 2% adder win rate.

Yeah, the speed system here is an approximation, so I erred on the side of caution and made the adder slightly faster than it should be.

English description of the simulator: An adder and a gargoyle player are standing next to each other and repeatedly attack one another with no other tactics; the adder attacks first and double hits every third round*. The adder can hit for up to 5 damage with 46% accuracy, the player can hit for up to 8 or 7 (12 in the above overestimated versions) with 40% accuracy. The player's armor is 6 and due to GDR if it rolls a 0, it will instead block 1 damage. The adder's armor is 1, and has no GDR. The player has 25 hp, the adder 16. A real adder can have anywhere from 6 to 16 life. Tabbing into each other, the adder has roughly 1-2% chance of winning.

*This is a roughly correct approximation of the crawl speed system but different from how crawl actually works. The simulated adder is slightly faster than it would really be; the player is assumed to be attacking at 10 auts, even though it would really attack at 9.1 auts.

Other than the simulated speed system, the last inaccuracy I can spot is no regeneration, but I don't think that would matter much. Reminder that the adder is assumed to have 16 max health, the highest possible.

TL;DR: The chances of an adder killing this player character when they both blindly tab into each other are roughly 1%.

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Thursday, 6th August 2015, 01:10
by tedric
I don't really have the chops (or mental energy) to check your math, so I will gladly concede that this was a "1% contingency" scenario after all

but i still don't think it was rant-worthy

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Thursday, 6th August 2015, 01:12
by Berder
The adder can have 6-15 HP so you should randomize that as well instead of always having 16. This will make the chance of losing go down still more.

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Thursday, 6th August 2015, 01:56
by duvessa
bel wrote:Thanks for the most mathematically sophisticated rant I have ever read on this forum.
It would be considerably more sophisticated if any of the math were correct

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Thursday, 6th August 2015, 04:03
by yesno
maybe you should run from adders

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Thursday, 6th August 2015, 11:53
by bel
duvessa wrote:
bel wrote:Thanks for the most mathematically sophisticated rant I have ever read on this forum.
It would be considerably more sophisticated if any of the math were correct

The correctness of arguments is irrelevant for the mathematical sophistication. Anyway, the best comment I read about this was Deirdre McCloskey "Rhetoric of Economics". Talking about Keynes and Milton Friedman: "In practice, big books and crude experiments win the day."

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Thursday, 6th August 2015, 14:28
by dowan
yesno wrote:maybe you should run from adders

For how long? Just until they catch up to you? Or should you just keep running away from them until you're dead? Or, from D2 onward should you just never allow yourself to be more than a few steps from a staircase?
I say this because adders are faster than the player, and running from adders isn't always an option.

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Thursday, 6th August 2015, 14:47
by yesno
there are six staircases per level and a range of maybe 3 to 4 levels where adders are a threat. is it really too much to ask a weak character to be wary of the proximity of a staircase while exploring? it's a good practice to cultivate anyway since spiny frogs and black mambas occupy the same niche in lair.

besides, tasonir even documented that the adder had only a 1% chance of killing the player, but he got unlucky.

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Thursday, 6th August 2015, 15:36
by dowan
Well you're the one who said he should run from this 1% chance of death.

But keep in mind, most characters aren't immune to poison, nor do most characters have those kind of defenses on D2.

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Thursday, 6th August 2015, 15:37
by mkraemer
Ummm... guys... maybe revisit a statistics class?

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Thursday, 6th August 2015, 17:23
by dowan
Statistics are never relevant, and when they are, odds are they aren't. If one observes the Poisson function of probability curves, comparing the times statistics are relevant to the discussion at hand, and are being used correctly to describe what's actually being discussed, one can see the probability of relevance of statistics quickly approaches 0. And that's not even taking into account people just making up the statistics in the first place, or completely talking out of their ass. After all, 92.736% of the time, percentages are just made up on the spot.

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Thursday, 6th August 2015, 17:31
by tasonir
There are only three numbers in programming: 0, 1, and infinity.

Also, much to my great embarassment, when I made the most important fix - lowering my uniform distribution to 0-7 instead of 0-12 which was way too high, I didn't notice I had left in test data (adder with 22 hp, 76% accuracy). Running it again with the actual accuracy and 16 hp, it isn't even close to 1%.

Adder won: 190 Player won: 999810

That's ~.02% for the adder. There's still the distribution issue but 0-7 should be a lot more accurate than before, no regeneration, and intentionally 16 hp adders but as far as I know the remaining inconsistencies should be negligible. Apologies for all the late corrections!

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Thursday, 6th August 2015, 18:04
by Sandman25
tasonir wrote:There are only three numbers in programming: 0, 1, and infinity.


Are you sure? I use only one number - 0 and even this is not used often (for counter initialization mostly).

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Friday, 7th August 2015, 06:52
by yesno
dowan wrote:Well you're the one who said he should run from this 1% chance of death.


i just thought he should run from the thing he complained about dying to

Re: Rant:Yet again melee combat in crawl is too random and s

PostPosted: Friday, 7th August 2015, 17:37
by tasonir
It's faster than me - if I tried running from it, it would get (eventually) infinite free hits and I'd die. The correct solution is either 1) blindly tab it like I did: this will work 99.99% of the time, or 2) cast beastly appendage before being in melee range, rather than when I'm at 40% health. Sticks to snakes would also be fine here.

Running away from it wouldn't have helped.