To-hit and Criticals in new combat

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fizzix
    Prophet
    • Aug 2009
    • 3025

    To-hit and Criticals in new combat

    With the new combat revamp, I've been thinking about how to-hit and criticals will be calculated. For to-hit there are two approaches.

    Approach 1) gives a flat to-hit value (say around 75%, maybe 80 for warriors) and adjusts that based on monster AC (or evasion) and possibly other rare items, or small bonuses at very high DEX.

    Approach 2) calculates a to-hit roll based on current stats, probably some combination of the finesse-prowess score and compares to monster AC. This is very similar to the current approach. It has the advantage that you get better at hitting monsters as you get stronger, but may not be able to touch difficult monsters at low levels.

    I'm going to describe a simple vision of how the first approach would look, as it's much easier to make reasonable on a first pass. I'm also going to use evasion instead of AC for all these calculations.

    ----Calculating to hit----
    Your to-hit roll is a roll of d100. Standard monster evasion is 25, a roll above 25 is a hit, below 25 is a miss. All stationary monsters have an evasion of 1. The most evasive monster is probably the will o' the wisp with an evasion of 60 or so. Next closest would probably be harowen and the cat lord around 40. The vast majority of normal monsters will be around 25.

    Blindness, or attempting to hit an unseen monster gives a penalty to hit (including monsters only known by telepathy). This could either be a variable roll (d40) or a straight penalty (20 points). Every square of distance gives a one point penalty to the to-hit dice roll. (rangers could get a lower combat to-hit in exchange for a better ranged to-hit)

    ---- Critical hits -----
    A goal with critical hits is that they become more common as you get stronger. This means tying them to finesse/prowess. I would recommend using MAX(finesse, prowess) to give a benefit for finesse characters to use finesse multipliers, and prowess characters to use prowess multipliers. (right now the advantage is to be balanced).

    Let's say finesse and prowess each range from 100-600. We'll call the MAX of these two values the crit-val A simple calculation could be to take (100-combat roll) and multiply it by a critical scale. If the result is less than the crit-val then you get a good hit. At low levels you will have something like a 10% chance of getting a critical hit, and at higher levels this goes up to about 50%. You could have additional scale factors for good hits/great hits/amazing hits. And tailor them to have reasonable chances.

    One downside of this approach is that monster evasion does not affect the critical hit chance. However it is possible to take this into account if desired. You can get a critical_adjustment score which is MAX(0, Evasion - 25). The crit roll is now (100 - combat roll + critical_adjustment). This means that evasive monsters can rarely have a critical hit on them, but less evasive monsters aren't penalized.

    Ok that's enough for now.
  • Magnate
    Angband Devteam member
    • May 2007
    • 5110

    #2
    Originally posted by fizzix
    With the new combat revamp, I've been thinking about how to-hit and criticals will be calculated. For to-hit there are two approaches.

    Approach 1) gives a flat to-hit value (say around 75%, maybe 80 for warriors) and adjusts that based on monster AC (or evasion) and possibly other rare items, or small bonuses at very high DEX.

    Approach 2) calculates a to-hit roll based on current stats, probably some combination of the finesse-prowess score and compares to monster AC. This is very similar to the current approach. It has the advantage that you get better at hitting monsters as you get stronger, but may not be able to touch difficult monsters at low levels.

    I'm going to describe a simple vision of how the first approach would look, as it's much easier to make reasonable on a first pass. I'm also going to use evasion instead of AC for all these calculations.

    ----Calculating to hit----
    Your to-hit roll is a roll of d100. Standard monster evasion is 25, a roll above 25 is a hit, below 25 is a miss. All stationary monsters have an evasion of 1. The most evasive monster is probably the will o' the wisp with an evasion of 60 or so. Next closest would probably be harowen and the cat lord around 40. The vast majority of normal monsters will be around 25.

    Blindness, or attempting to hit an unseen monster gives a penalty to hit (including monsters only known by telepathy). This could either be a variable roll (d40) or a straight penalty (20 points). Every square of distance gives a one point penalty to the to-hit dice roll. (rangers could get a lower combat to-hit in exchange for a better ranged to-hit)
    Hmmm. I'm not sure if you saw my last post in Derakon's thread, but I think it would disappoint a lot of people to think that a cl50 character has the same to-hit chance as a cl1 character, and that a dextrous Dunadan warrior wielding a rapier has the same chance as a clumsy half-troll mage wielding a whip.

    My view is that all of those variable factors (class, race, stats, clev, weapon balance) can be incorporated into the calculation of @'s finesse score, which means that to-hit boils down to

    X% + finesse - evasion

    So if standard evasion is 25, and you want 75% chance to-hit as the average, then we want X to be 75 and the finesse component to range from about 10 for cl1 magi to about 40 for cl50 warriors. (Note to Derakon: this would be easier if finesse increased linearly with both stats and clev - we can then just divide @'s total finesse score by a scalar (10?) rather than messing with sqrts.)

    This would give a cl1 mage about 60% chance to hit the average monster, and about 85% chance to hit stationary monsters. It would give cl50 warriors about 90% chance to hit average monsters (though the average evasion might be higher than 25 in the depths), and about 75% chance of hitting Harowen or the Cat Lord.

    EDIT: of course, we should use more granularity: a d1000 hit roll instead of d100, with X as 750. Then we can use unmodified finesse, and either multiply Ev by 10 or just increase its granularity too (I prefer the latter).
    ---- Critical hits -----
    A goal with critical hits is that they become more common as you get stronger. This means tying them to finesse/prowess. I would recommend using MAX(finesse, prowess) to give a benefit for finesse characters to use finesse multipliers, and prowess characters to use prowess multipliers. (right now the advantage is to be balanced).

    Let's say finesse and prowess each range from 100-600. We'll call the MAX of these two values the crit-val A simple calculation could be to take (100-combat roll) and multiply it by a critical scale. If the result is less than the crit-val then you get a good hit. At low levels you will have something like a 10% chance of getting a critical hit, and at higher levels this goes up to about 50%. You could have additional scale factors for good hits/great hits/amazing hits. And tailor them to have reasonable chances.

    One downside of this approach is that monster evasion does not affect the critical hit chance. However it is possible to take this into account if desired. You can get a critical_adjustment score which is MAX(0, Evasion - 25). The crit roll is now (100 - combat roll + critical_adjustment). This means that evasive monsters can rarely have a critical hit on them, but less evasive monsters aren't penalized.

    Ok that's enough for now.
    I have no problem with this proposal - it's clean and simple and the added damage from crits can be balanced accordingly. My one reservation is that I think finesse crits should be different from prowess crits. The latter should add more damage (and perhaps therefore be less common), while the former should add less damage but with a higher chance of disabling effects. But I'm now straying into procs, which means I ought to shut up and get on with the effects stuff.
    Last edited by Magnate; December 22, 2011, 15:11.
    "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

    Comment

    • fizzix
      Prophet
      • Aug 2009
      • 3025

      #3
      Originally posted by Magnate
      Hmmm. I'm not sure if you saw my last post in Derakon's thread, but I think it would disappoint a lot of people to think that a cl50 character has the same to-hit chance as a cl1 character, and that a dextrous Dunadan warrior wielding a rapier has the same chance as a clumsy half-troll mage wielding a whip.

      My view is that all of those variable factors (class, race, stats, clev, weapon balance) can be incorporated into the calculation of @'s finesse score, which means that to-hit boils down to

      X% + finesse - evasion
      Why just finesse? Maybe some kind of sum or euclidean sum of finesse and prowess. Imagine prowess controlling how fast you can physically swing the clumsy hammer. It would certainly improve your to-hit chance to have higher skill in this area.

      Originally posted by magnate
      EDIT: of course, we should use more granularity: a d1000 hit roll instead of d100, with X as 750. Then we can use unmodified finesse, and either multiply Ev by 10 or just increase its granularity too (I prefer the latter).
      I have no problem with this proposal - it's clean and simple and the added damage from crits can be balanced accordingly. My one reservation is that I think finesse crits should be different from prowess crits. The latter should add more damage (and perhaps therefore be less common), while the former should add less damage but with a higher chance of disabling effects. But I'm now straying into procs, which means I ought to shut up and get on with the effects stuff.
      The way I envisioned it is that both would cause increased damage. Finesse crits would cause cuts and prowess crits would cause stunning. Of course some monsters would be immune to these effects (elementals can't be cut, jellies can't be stunned). These can come later though.

      Comment

      • Mikko Lehtinen
        Veteran
        • Sep 2010
        • 1246

        #4
        Originally posted by fizzix
        Why just finesse? Maybe some kind of sum or euclidean sum of finesse and prowess. Imagine prowess controlling how fast you can physically swing the clumsy hammer. It would certainly improve your to-hit chance to have higher skill in this area.
        Prowess increases the damage of each blow, and therefore helps penetrating armour (if I've understood the plan right). That's why only Finesse should help hitting good evaders.

        Comment

        • fizzix
          Prophet
          • Aug 2009
          • 3025

          #5
          Originally posted by Mikko Lehtinen
          Prowess increases the damage of each blow, and therefore helps penetrating armour (if I've understood the plan right). That's why only Finesse should help hitting good evaders.
          Ah ok, I remember. Prowess helps reduce absorption. We can do evasion first and then absorption second. I will have to put off writing this until after I get settled in my new home. Hopefully, I'll refine the plan some more before then.

          Comment

          • ekolis
            Knight
            • Apr 2007
            • 921

            #6
            Why should strength affect chance to hit? Disregarding the case of "too weak to wield weapon effectively", the only way I can see strength affecting chance to hit is that you can swing faster... but I'd think that that effect would be negligible compared to that of dexterity (being able to actually hit what you're aiming for)!
            You read the scroll labeled NOBIMUS UPSCOTI...
            You are surrounded by a stasis field!
            The tengu tries to teleport, but fails!

            Comment

            • Derakon
              Prophet
              • Dec 2009
              • 9022

              #7
              Strength affects to-hit so that prowess-biased characters (c.f. paladins) aren't completely unable to hit things. That's the theory, anyway. Otherwise, you have them doing very spiky damage -- they miss a lot, but when they do hit, they pancake their target. Of course you can ensure they do the same damage over time by making prowess weapons have great dice, but I'm not so certain that players would appreciate playing such a style.

              (Incidentally, currently the holy casters are both prowess classes, and their primary combat buff, Bless, improves finesse. Meanwhile the arcane casters are finesse classes, and Berserker, which they get, improves prowess...Heroism improves both a small amount though)

              Regarding crits: I think this might be a good area to use a supercharge mechanic. You get a basic crit if your to-hit roll is high enough (or whatever), and from there, as long as dY < X your crit gets upgraded, with X getting bigger as your character gets burlier. This has the nice effect of theoretically allowing any critical hit at any level, while still making them more common as you go along.

              Comment

              • fizzix
                Prophet
                • Aug 2009
                • 3025

                #8
                Originally posted by Derakon

                Regarding crits: I think this might be a good area to use a supercharge mechanic. You get a basic crit if your to-hit roll is high enough (or whatever), and from there, as long as dY < X your crit gets upgraded, with X getting bigger as your character gets burlier. This has the nice effect of theoretically allowing any critical hit at any level, while still making them more common as you go along.
                This seems fine to me.

                Comment

                • Magnate
                  Angband Devteam member
                  • May 2007
                  • 5110

                  #9
                  Originally posted by Derakon
                  Strength affects to-hit so that prowess-biased characters (c.f. paladins) aren't completely unable to hit things. That's the theory, anyway. Otherwise, you have them doing very spiky damage -- they miss a lot, but when they do hit, they pancake their target. Of course you can ensure they do the same damage over time by making prowess weapons have great dice, but I'm not so certain that players would appreciate playing such a style.
                  This is a tricky one. I guess my X% + finesse - evasion actually needs to be X% + f(finesse, prowess) - evasion, where f() takes @'s two scores, the weapon balance and a healthy bias in favour of finesse. We want paladins to hit occasionally, but they should always hit less often than a rogue - because their weapons will always be doing more damage. It wouldn't be fair to allow prowess to have much impact on to-hit (except for very prowess-favouring weapons) because finesse is going to make no difference at all to absorption ...
                  (Incidentally, currently the holy casters are both prowess classes, and their primary combat buff, Bless, improves finesse. Meanwhile the arcane casters are finesse classes, and Berserker, which they get, improves prowess...Heroism improves both a small amount though)
                  Well, that's easy to change by redefining the spells, if we feel it's necessary.
                  Regarding crits: I think this might be a good area to use a supercharge mechanic. You get a basic crit if your to-hit roll is high enough (or whatever), and from there, as long as dY < X your crit gets upgraded, with X getting bigger as your character gets burlier. This has the nice effect of theoretically allowing any critical hit at any level, while still making them more common as you go along.
                  Yes, I quite like this mechanic, and I'm sure it could be combined well with fizzix's, say for adding dice to the crit. This way X is bigger for finesse-preferring weapons, since they have smaller dice.

                  One warning though ... since you have vetoed diminishing returns ;-) ... we can't leave this open-ended - it'll need a hard cap.
                  "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

                  Comment

                  • Mikko Lehtinen
                    Veteran
                    • Sep 2010
                    • 1246

                    #10
                    Originally posted by Magnate
                    This is a tricky one. I guess my X% + finesse - evasion actually needs to be X% + f(finesse, prowess) - evasion, where f() takes @'s two scores, the weapon balance and a healthy bias in favour of finesse.
                    I've a clear idea how I would do this. It's probably not at all what you're planning, but here it is anyway, just to distract you guys.

                    30% of monsters have neither evasion or absorption (but may have lots of hitpoints)
                    30% have an absorption score
                    30% have an evasion score
                    10% have both absorption and evasion

                    Normally to-hit would be 70%-95%, depending on both finesse and prowess. It would not depend on the monster at all.

                    If the monster had an evasion score, (evasion - finesse) would be reduced from to-hit. (No effect if finesse > evasion.)

                    If the monster has an absorption score, it would be reduced from damage.

                    Numbers would be easy to tweak to make Prowess and Finesse equal.

                    Comment

                    • Magnate
                      Angband Devteam member
                      • May 2007
                      • 5110

                      #11
                      Originally posted by Mikko Lehtinen
                      Normally to-hit would be 70%-95%, depending on both finesse and prowess. It would not depend on the monster at all.

                      If the monster had an evasion score, (evasion - finesse) would be reduced from to-hit. (No effect if finesse > evasion.)

                      If the monster has an absorption score, it would be reduced from damage.
                      This is pretty much what I said. Your "70-95%" covers roughly the range I gave for cl1 magi up to cl50 warriors (my proposed range is a little longer but not much, 60-90%). Evasion does indeed reduce to-hit, though I don't see why any significant number of monsters should have zero evasion. I'm with fizzix - let the average be nonzero, say 25, and allow rare low values for immotiles etc.

                      Anyway, that all sounds fine.
                      "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

                      Comment

                      • Derakon
                        Prophet
                        • Dec 2009
                        • 9022

                        #12
                        I think the main thing is that characters with effectively zero finesse should still be able to hit (most) monsters reliably (more than 50% of the time); it's just that characters with high finesse can hit monsters almost all the time and/or reliably hit monsters that have high evasion.

                        So how's this for a proposed starting point on actual equations? Assume finesse ranges from 100 to 800 for finesse-oriented characters, 25 to 300 for prowess-oriented characters, and less for mages and priests.
                        Code:
                        static int get_hit_chance(player_state state, monster_type* m_ptr)
                        {
                            base_chance = 75 - m_ptr->evasion + (state.dis_to_finesse / 25);
                            if (base_chance < 50) {
                                base_chance = 50;
                            }
                            if (base_chance > 100) {
                                base_chance = 100;
                            }
                            return base_chance;
                        }
                        (We enforce the minimum 5% hit/miss chances elsewhere anyway)

                        Functionally this means that every 25 points of finesse increases to-hit chance by 1%, or counters 1 point of monster evasion. By midgame (assuming linear gains in finesse) a finesse character will have about 400 points, or +16% to-hit; a prowess character will have only +4%.

                        Of course, we can scale the divisor if we want to have more freedom to play with monster evasion values. If the divisor were 10 then those midgame characters would have +40% and +10% respectively.

                        On an unrelated note, stylistically I much prefer to do "int* foo" than "int *foo" since the * is part of the type. It's a bit late to go about changing the entire codebase, though. And of course if you want to do something like this:
                        Code:
                        int* foo, bar, baz
                        you'll end up with one pointer to an int, and two ints. Silly C spec...

                        Comment

                        • Magnate
                          Angband Devteam member
                          • May 2007
                          • 5110

                          #13
                          That's fine with me. But I think you meant state.to_finesse rather than state.dis_to_finesse. If the displayed value is different from the real value (because of unIDd kit, for example), the combat algorithm should still use the real value.
                          "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

                          Comment

                          • fizzix
                            Prophet
                            • Aug 2009
                            • 3025

                            #14
                            Making some small adjustments to Derakon's code

                            Originally posted by Derakon
                            Code:
                            static int get_hit_chance(player_state state, monster_type* m_ptr)
                            {
                                base_chance = 75 - m_ptr->evasion + (state.to_finesse / 25);
                                if (base_chance < 40) {
                                    base_chance = 40;
                                }
                                if (base_chance > 100) {
                                    base_chance = 100;
                                }
                            
                                return base_chance;
                            }

                            In either the above function or elsewhere we need (in pseudo-code)
                            Code:
                              if (player is stunned)
                               base_chance -= 10
                            
                              if (player is not adjacent to monster)
                               base_chance -= distance/2 
                            
                              if (player can't see monster){
                                base_chance /= 2
                            Since to hit is based on finesse will be scaled by monster level as well. This gives monster evasion range between -25 (immobile) and 28 (harowen). I can work on putting this into monsters.txt relatively soon, and gives me something to work on in parallel to Derakon's combat.

                            Comment

                            • andrewdoull
                              Unangband maintainer
                              • Apr 2007
                              • 872

                              #15
                              Originally posted by Derakon
                              I think the main thing is that characters with effectively zero finesse should still be able to hit (most) monsters reliably (more than 50% of the time);
                              Why? What's wrong with a trade off where you have a weapon where you frequently miss, but when you connect it does a lot of damage?
                              The Roflwtfzomgbbq Quylthulg summons L33t Paladins -more-
                              In UnAngband, the level dives you.
                              ASCII Dreams: http://roguelikedeveloper.blogspot.com
                              Unangband: http://unangband.blogspot.com

                              Comment

                              Working...
                              😀
                              😂
                              🥰
                              😘
                              🤢
                              😎
                              😞
                              😡
                              👍
                              👎