[please help] MD negative value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Pete Mack
    Prophet
    • Apr 2007
    • 6883

    #16
    Julian--
    The easiest way is to come up with a better function. Hacking in race flags just doesn't make much sense. At what difference should the fall-off begin? Then figure out a function with a pole not far from that difference with the right behavior.

    Presumably the goal should be
    Let x = (a * skill - difficulty) for some a
    lim x -> -Inf: P ~ -1/x
    lim x-> +Inf: P~ 1 - c/x , for some c

    Piece of cake:
    P = arccot(-c*x)/pi
    c determines how sharp the sigmoid change is.

    Trivial or some easier to compute sigmoid with ~1/x asymptotic behavior. Obviously if you want a hard minimimum fail rate, you need to put it in--or change the lower asymptote.

    Comment

    • backwardsEric
      Knight
      • Aug 2019
      • 527

      #17
      If we're willing to accept some extra complexity, there could be two inputs to the device failure calculation. One, like the device_skill - device_level currently used, sets the position along the curve. The other would select the curve form. As an example of the latter, there could be a family of sigmoids which vary (for instance by a coarse-grained selection of an exponent) in the sharpness of the transition from high failure rates to low failures rates. Then use the device_level (coarsely binned) to select from those shapes with the low device levels getting the sharper transitions (i.e. easy mastery once one has enough skill) and the high device levels getting the less sharp transitions. Then, if there was a desire to have some races flagged with a POOR_DEVICE_MASTERY flag, the selection of the curve shape based on that second input could be biased towards the less sharp transitions for them (i.e. no easy mastery for them); a GOOD_DEVICE_MASTERY flag would bias that choice the other way - towards sharper transitions.

      Comment

      • Nick
        Vanilla maintainer
        • Apr 2007
        • 9637

        #18
        This sounds like a good plan - I guess have about four or five bins? Do you have a good class of functions in mind?
        One for the Dark Lord on his dark throne
        In the Land of Mordor where the Shadows lie.

        Comment

        • Pete Mack
          Prophet
          • Apr 2007
          • 6883

          #19
          Nick--
          It's unnecessary. Bad device skill can perfectly well lead to terrible percentage, with a single curve. (For starters, get rid of the zero lower bound, and possibly put a new upper limit on device level.)
          Let x = skill - device level.
          Formula 1:

          Let P = 1 /(2 - x) for x < 0.
          Let P = 1 - 1/(2+x) for x >= 0
          P @ x=0 = 1/2
          P falls off very fast for skill below device level, rapidly approaching zero. This looks fair, but isn't. Success rates below 50 percent rapidly become useless. But for most devices (teleport, TO excepted) any fail rate below 1/3 is adequate, and there are diminishing returns above 90% success.

          Formula 2: soft degradation for bad skill
          Let P = 1 /(2 +lg(-x)) for x <= -1
          Let P = 1 - 1/(2+x) for x >= 0
          P @ x=0 = 1/2

          This actually feels natural: the difference between a skill deficit of 10 and 20 is as big as that between 20 and 40.--success rate declines logarithmically. It's symmetric: in the other direction, it's fail rate that goes down logarithmically.

          For a HT paladin with skill zero, there's a 1/10 chance of activating a rod of speed. (Former formula has a 1/98 chance.)
          Last edited by Pete Mack; May 29, 2021, 23:26.

          Comment

          • backwardsEric
            Knight
            • Aug 2019
            • 527

            #20
            Pete - I largely agree with your points. What I was trying to say was that, besides the absolute failure rate, there's also the sense of progression: how long is that interval, in terms of levels gained or items acquired, between when a device is marginally useful because of the failure rate to when it's good enough for what the device does. If all devices use the same curve, then that sense of progression could be much the same: a gain of x in device skill will be enough to span that interval. My idea was to make that interval longer for harder devices and shorter for easy ones. I don't know whether or not trying to vary that interval is worth it, especially since how hard it is to gain that x in device skill can vary widely as the character moves through the dungeon.

            As for Nick's question, I'd follow Pete's suggestion: find a single curve and tune it to broadly meet what we want. If at that point we want another knob to distinguish different devices or classes/races than we could look at what I proposed or some other ideas that would provide that other knob. All of these curves will allow for adding an exponent to control the sharpness of the transition so that'll be one way to add a knob (probably coarse-grained). All will allow a scale factor, and if that value hasn't already been largely fixed by tuning, then that could be a finer-grained knob.

            Comment

            • backwardsEric
              Knight
              • Aug 2019
              • 527

              #21
              To proceed with Pete Mack's proposal to choose a sigmoid function and see what tuning it gets us, look at x/(1+abs(x)) which has the slight advantage that it'll be easier to implement in integer arithmetic (for those who are interested, some results from looking at arctan(x) and 1/(1+e^-x) are here https://github.com/angband/angband/i...ment-857241950 . Use x = p * (device_skill - device_level) + q where p and q are the parameters available for tuning. Also scale and offset the formula so it matches up with 4.2.2's choice for the minimum and maximum failure rates, 0.01 and 0.75, so the resulting equation for the failure rate, f, is f = -.37 * x / (1 + abs(x)) + .38.

              If a requirement is made that the formula reproduce a specified failure rate for a given combination of device_skill and device_level, then the two tunable parameters are reduced to one (here I'll use the combination of device_skill=31 and device_level=20 giving a failure rate of .127; that's 4.2.2's result and basically corresponds to a level 30 half-troll warrior using a wand of teleport other or staff of teleportation). Using the scale factor as the tuning parameter and seeing what happens to the failure rates for a half-troll warrior or gnome mage using a wand of teleport other gives this:




              (Implicit in those graphs is an assumption about how intelligence gains from stat potions and gear accrue as the character gains levels; since the device skill isn't particularly sensitive to intelligence, I think those assumptions don't really change the result and the simplification of looking at this solely as a function of character level is useful).

              For all of the scale factors looked at, the low-level half-trolls get a higher failure rate than in 4.2.2 while the high-level half-trolls see a bit of improvement. For the gnome mages, the failure rate varies less between level 1 and 50 than it does in 4.2.2 and overall the gnome mages are nerfed by getting higher failure rate at high levels. Proceeding with the scale factor (i.e. p) of .2 gives these results for failure rates with some selected devices; for each set of graphs, the first uses the modified damage formula and the second uses 4.2.2's formula:

              staff of light



              wand of teleport other



              staff of speed



              rod of magic mapping

              Comment

              • backwardsEric
                Knight
                • Aug 2019
                • 527

                #22
                For a rod of speed, the failure rates with the x/(1+abs(x)) form and a scale factor of .2 are (second graph is 4.2.2's results):




                For Tangaria's hydra (-50 device skill, -20 intelligence modifier, assuming 3 as the starting intelligence) as a warrior, the x/(1+abs(x)) calculation with a scale factor of .2 gives:


                That seems close to what PowerWyrm and hangar want. Are the effects on vanilla's races and classes acceptable?

                Comment

                • Pete Mack
                  Prophet
                  • Apr 2007
                  • 6883

                  #23
                  I actually proposed a different tunable parameter, more powerful than your p. I proposed to make

                  Code:
                  x = c * skill - level
                  For some c

                  In this case, you can more easily tune where the fall off in device failure rate happens. I also proposed using
                  Code:
                   1/lg(-x + 1)
                  as the failure rate for x < 0.
                  At x = -200 (cl 1 hydra, rod of speed, c= 1), the success rate is 1/8.

                  Note that 1/(-x) and 1/lg(-×+1) behaviors are not the only choices. So for that matter is 1/sqrt(-x), etc.

                  Comment

                  • backwardsEric
                    Knight
                    • Aug 2019
                    • 527

                    #24
                    Originally posted by Pete Mack
                    I actually proposed a different tunable parameter, more powerful than your p. I proposed to make

                    Code:
                    x = c * skill - level
                    For some c

                    In this case, you can more easily tune where the fall off in device failure rate happens.
                    The transition will happen at x = 0; so skill = level / c in that formulation and skill = level + second_tunable_parameter / c in what I used (where second_tunable_parameter was set to get the failure rate for a wand of teleport other to pass through a particular point). There's value in decoupling the range of the skill from the range of device levels, but for what's of immediate concern here, those ranges still coincide, and the form scaling (device - skill) let's us select the sharpness of the transition with much less impact on where the transition occurs. If someone later wants to rescale the skill range (to get smoother rounding or finer granularity), he or she can choose a scale factor, cg, to get the desired granularity, apply that before comparing with the device level, and then know that scaling that difference by the c (tuned here) divided by cg will get the sharpness of the transition that had been previously tuned.

                    I also proposed using
                    Code:
                     1/lg(-x + 1)
                    as the failure rate for x < 0.
                    At x = -200 (cl 1 hydra, rod of speed, c= 1), the success rate is 1/8.

                    Note that 1/(-x) and 1/lg(-Ă—+1) behaviors are not the only choices. So for that matter is 1/sqrt(-x), etc.
                    Using .75 - .74 / (2 + log(1 - x)) for x < 0 (I use log(1 - x) rather log(-x) to simplify handling -1 < x < 0; the change in the other constants is to bake in 4.2.2's cap of the failure rate at 75%) and .01 + .74 / (2 + x) for x >= 0 gives the results below. Results with .75 - .37 / (1 + sqrt(-x)) for x < 0 can be found here, https://github.com/angband/angband/i...ment-858119110 .

                    I think the asymmetric form you proposed is interesting. However, if devices aren't used much when the failure rate is greater than transition point (50% in what you had; 38% in my formulation), then the behavior for x < 0 won't particularly matter. Setting the transition to occur at a lower failure rate (maybe 15 to 20%, so the x < 0 case covers more of the vertical range than the x >= 0 does), would be one way to make it more relevant.

                    Tuning the scaling parameter for the asymmetric form:



                    Failure rates for some devices using a scale factor of 0.5:






                    Tangaria's hydra:

                    Comment

                    • Nick
                      Vanilla maintainer
                      • Apr 2007
                      • 9637

                      #25
                      I actually quite like the x/(1+abs(x)) form - does anyone have violent objections to that?
                      One for the Dark Lord on his dark throne
                      In the Land of Mordor where the Shadows lie.

                      Comment

                      • Nick
                        Vanilla maintainer
                        • Apr 2007
                        • 9637

                        #26
                        Latest release on the releases page has the x/(1+abs(x)) form with scale .2 implemented.
                        One for the Dark Lord on his dark throne
                        In the Land of Mordor where the Shadows lie.

                        Comment

                        • tangar
                          Veteran
                          • Mar 2015
                          • 1004

                          #27
                          Awesome modelling! Thank you, friends!
                          https://tangaria.com - Angband multiplayer variant
                          tangaria.com/variants - Angband variants table
                          tangar.info - my website ⍽⍽⍽⍽⍽⍽⍽⍽⍽⍽⍽⍽
                          youtube.com/GameGlaz — streams in English ⍽ youtube.com/StreamGuild — streams in Russian

                          Comment

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