[please help] MD negative value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tangar
    Veteran
    • Mar 2015
    • 1004

    [please help] MD negative value

    In V variants (PWMA and Tangaria) we wanna add possibility to give certain races/classes negative MD, so stupid races and non-magical classes will have less chances of using MDs. Something like make it ~30% chance of success on using Staves of Speed instead of 90% which we got atm (38 lvl archer with 64 MD).

    But it seems that MD formula is pretty complex, so it's hard to understand how negative MD could be implemented. Please help us to solve this puzze

    Thanks in advance!
    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
  • Nick
    Vanilla maintainer
    • Apr 2007
    • 9634

    #2
    There's a line for skill-device in each of p_race.txt and class.txt, and negative values are fine - half-trolls have a device skill of -8 in V, for example.
    One for the Dark Lord on his dark throne
    In the Land of Mordor where the Shadows lie.

    Comment

    • tangar
      Veteran
      • Mar 2015
      • 1004

      #3
      yep.. but eg Hydra race (in T) with skill-device:-50 have 83% chance for success with cure light wounds staff.. as in character sheet (shift+C) hydra got 0 at MD. So it seems we need to change formula somehow
      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

      • PowerWyrm
        Prophet
        • Apr 2008
        • 2986

        #4
        Originally posted by Nick
        There's a line for skill-device in each of p_race.txt and class.txt, and negative values are fine - half-trolls have a device skill of -8 in V, for example.
        Doesn't work. The calculated skill is rounded up to 0, which translates to a formula in get_use_device_chance() of fail = 100 * (- lvl - 140) / (lvl - 90).

        A level 0 device would have fail = 15% and a level 40 device (like staff of speed) would have fail = 36%. There aren't many devices with higher level

        This formula always uses negative values for whatever reason and is outright bugged (rod of speed is level 95 and gives negative value of fail chance, which is translated to 1% fail chance). I think this needs to be simplified.
        PWMAngband variant maintainer - check https://github.com/draconisPW/PWMAngband (or http://www.mangband.org/forum/viewforum.php?f=9) to learn more about this new variant!

        Comment

        • Nick
          Vanilla maintainer
          • Apr 2007
          • 9634

          #5
          Ah, I thought you were talking about input values.

          Agreed, that formula is obscure and outdated (looks like there weren't any level 95 devices when it was written). Also there's the
          Code:
          /* TODO: maybe use something a little less convoluted? */
          comment, which is itself very old...

          I'll mark this as to fix for 4.2, but it probably won't make 4.2.2.
          One for the Dark Lord on his dark throne
          In the Land of Mordor where the Shadows lie.

          Comment

          • backwardsEric
            Knight
            • Aug 2019
            • 527

            #6
            First, the buffs/debuffs to the device skill are applied as scale factors so some rethinking of those would be required if negative device skill was possible (i.e. does Tangaria's level 1 hydra warrior really have better chance of using a device if confused or hungry? Does it get worse at devices when under the effect of heroism?).

            As for brainstorming possible forms for the formula, here are some options, in all cases d is the device level (i.e. difficulty) and s is the device skill:

            1) Use a linear relation between the failure rate, f, and d - s: f = m * (d - s) + b. The right hand side could be bounded above and below to enforce maximum and minimum failure rates. There's two tunable parameters m and b; to reduce that consider what's a target failure rate for a mediocre skill (say 30) and a nearly must-have device (staff of teleportation, level 20, or wand of teleport other, also level 20). If the target failure rate for that combination is say 20%, then m and b are related by b = 20 + 10 * m. Now only have to tune m. Plotting the failure rates as a function of m for different combinations of device skill and device level gives this (failure rates were limited to the 1% to 75% range as in Vanilla):



            To get high failure rates for the low skill user require large values of m, those also drive down the failure rates for the high skill case. I don't think that model is going to match what we want. One could apply a nonlinear mapping to (d - s) before feeding it in to the same formula, so that may be one thing to try.

            2) Use an expression that is similar to what's currently used f = (m * (d - s) + o) / (s - d + p). To avoid division by zero, p has to be more than maximum device level - minimum skill and, using the smallest possible value, maximum device level - minimum skill + 1, gives the greatest sensitivity of the failure rate to d - s. The leaves m and o as tunable parameters. As with the linear model, o could be related to m by choosing an anchor point that'll always be satisfied. Using the same anchor point as in the linear model (d = 20, s = 30, f = 20%) gives o = 20 * (p + 10) + 10 * m. Plotting the failure rates as a function of m for different combinations of device skill and device level gives this (failure rates were limited to the 1% to 75% range as in Vanilla; used p = 96):



            As with the linear model, large values of m are needed to get high failure rates. Those failure rates are easier to attain than in the linear model. A value of m around 20 to 40 could be reasonable.

            3) Use functional form that gives a sigmoidal shape, https://en.wikipedia.org/wiki/Sigmoid_function , and scale and offset it so the output range is 0 to 100 (with the option to apply the failure rate bounds as is currently done). I tried f = 50 * (1 + (m * (d - s) + b)^p / (1 + abs(m * (d - s) + b)^p)) with p = 1. I didn't work out the tuning formula to relate b to m given an anchor point and a choice of p. With these combinations of b and m (corresponding to the same d = 20, s = 30, f = 20% anchor point as in the other two models), (0.00025, -1.4975), (0.0005, -1.495), (.001, -1.49), (0.0025, -1.475), (0.005, -1.45) , (.01, -1.4), (.025, -1.25), (.05, -1.0), (.1, -0.5), (.2, 0.5)), the plot of the failure rate for the same combinations of device level and device skill as in the previous plots looks like this:



            Here the high failure rates are more easily attained, though it's become hard to hit the minimum failure rate for the high skill case. How sensitive that behavior is to the choice of the anchor point is something that would need to be explored. Exploring the other sigmoidal curves to see if there's something that would be easily tuned for this case is something else that could be done.

            Comment

            • Julian
              Adept
              • Apr 2021
              • 122

              #7
              I'€™ve spreadsheeted the current formula, and, while it's hard to understand, it's pretty well behaved -- until the character's skill gets below 10 (which is the constant defined as skill_min), at which point it starts going negative on high-level devices.

              If you lower skill_min (which is set at 10 in the code), it goes back to being well-behaved, though things get somewhat easier to use. If you raise skill_max by a corresponding amount, the difficulties go back to similar to where they were to start with.

              Adjusting skill_min and skill_max independently will make things easier and harder, respectively. As far as I’ve tested, it doesn't have a problem with skill_min being negative.

              In the standard game, this isn'€™t a problem, because even a 1st level half-troll warrior with 3 int still has a skill of 10. The -50 skill race above hits the problem hard, because its skill is a lot below the minimum.

              While I'm not going to say we should keep this formula, since it's hard to understand, I'm not sure we'd get much more clarity with any formula that produces an interesting curve, and a lot can be done to adjust activation difficulty as is.

              (The spreadsheet is the one linked to in my melee combat spreadsheet thread; it's growing beyond its initial description.)

              Edit: AFAICT, getting the character’s skill above skill_max doesn'€™t cause any misbehavior)
              Last edited by Julian; May 27, 2021, 03:37.

              Comment

              • wobbly
                Prophet
                • May 2012
                • 2629

                #8
                Originally posted by backwardsEric
                stuff
                I think your graphs might need a key to the key

                Comment

                • Nick
                  Vanilla maintainer
                  • Apr 2007
                  • 9634

                  #9
                  Originally posted by wobbly
                  I think your graphs might need a key to the key
                  Skill is the player device skill, level is character level.
                  One for the Dark Lord on his dark throne
                  In the Land of Mordor where the Shadows lie.

                  Comment

                  • wobbly
                    Prophet
                    • May 2012
                    • 2629

                    #10
                    Originally posted by Nick
                    Skill is the player device skill, level is character level.
                    yeah I worked out that bit. mostly (level could of been device level). The axis-es are trickier. What is slope in the 1st one? m in the next? (I can probably guess what fail rate is) I mean I can probably look through the code, just you know... asking for people more lazy then me... On the one hand I understand maths. On the other I'm not a mathematician by profession or study, I don't spend every other day looking at graphs.

                    Comment

                    • backwardsEric
                      Knight
                      • Aug 2019
                      • 527

                      #11
                      The x axis in all the plots is the value of the one parameter that's available to be adjusted - all the other parameters are either tied to that one by forcing the results to pass through a given point (device_level = 20, device_skill = 30, failure_rate = 20% for all the plots), have natural choices for the value (the additive term in the denominator of the second to avoid division by zero), or I didn't bother to experiment with different values (the exponent in the third model). In all, that tunable parameter is a scale factor for (difficulty - device_skill). Because of the denominators in the second and third expressions, the units and useful range for that parameter are different in the second and third graphs than in the first.

                      Comment

                      • Julian
                        Adept
                        • Apr 2021
                        • 122

                        #12
                        So, the question is: what do we want the curve of device activation failure to look like?

                        Assume for a moment that the relevant variable is the difference between item difficulty and character skill, and that we want failure chances to decrease as the difference gets smaller. (It’s not the only way to set things up, but it’s a useful simplifying assumption.)

                        The current one seems to be approximately logarithmic: difficulty increases gradually at first, with the curve gradually getting steeper as the difference increases.

                        Some other options:

                        Linear: for every point the difference increases, difficulty increases a fixed amount. This is the easiest to reason about, but doesn’t have a lot of interesting characteristics

                        Polynomial: The difficulty increases based on the square (or some other exponent) of the difference. Things get hard fast as the difference increases. It’s very easy for this to rapidly hit the difficulty cap.

                        Exponential: The difficulty is a constant raised to the power of the difference. Can grow slower than polynomial for a small difference, but gets bigger faster as the difference increases.

                        Sigmoid: as suggested by Eric. Difficulty grows slowly for a small difference, faster for medium, and slower again as it gets larger.

                        Tangent: Don’t know what this type of curve is actually called, but it’s like a rotated sigmoid. Fast difficulty growth early and late, slower in between. Looks like the trigonometric tangent function graph.

                        Similarly, if you rotate exponential or polynomial curves, you get something with a fast initial growth in difficulty that slows down later.

                        There are vast quantities of other potential curves, especially if we use skill and item power as separate variables, but I think this lot summarize the basic patterns we're likely to want.

                        Honestly, a logarithmic curve like we have now isn’t a bad choice. The current formula is hard to understand and even harder to tweak, but from a gameplay perspective, it’s a good behavior. Most characters can use most devices reasonably reliably, but heavily out of depth ones can be quite hard.
                        Last edited by Julian; May 27, 2021, 16:57.

                        Comment

                        • Julian
                          Adept
                          • Apr 2021
                          • 122

                          #13
                          Once we have the basic pattern chosen, we have to figure out the details. How hard should an average-power device be for an average-level, average-skill character to use? What about a low-power one? A high-power one?

                          Repeat the exercise for with the same average-skill, but low and high levels. Then repeat everything with low and high skills.

                          (Arguably, if you do this before choosing the curve properties, the points you graph will show you what the curve should look like.)

                          Then you get to tweak All The Numbers! until things are behaving how you want.

                          Extra thought: while it’s a bad idea to have more than one formula, for non-linear curves, you can arrange for different classes to live on different parts of the curve.

                          For instance, with a sigmoid, small differences between skill and object power cause only small increases in difficulty. If warriors have a bad enough base skill, they won’t get to enjoy that until higher levels bring their skill up enough.

                          Comment

                          • Julian
                            Adept
                            • Apr 2021
                            • 122

                            #14
                            Originally posted by tangar
                            In V variants (PWMA and Tangaria) we wanna add possibility to give certain races/classes negative MD, so stupid races and non-magical classes will have less chances of using MDs. Something like make it ~30% chance of success on using Staves of Speed instead of 90% which we got atm (38 lvl archer with 64 MD).

                            But it seems that MD formula is pretty complex, so it's hard to understand how negative MD could be implemented. Please help us to solve this puzze

                            Thanks in advance!
                            So, to actually answer this question:

                            The system in use, with the current set of constants, needs a difference between skill and object level of about 60 to get a 70% failure rate. That’s a lot, and getting it to happen for a class with that high a device skill requires pushing things outside the bounds in which the system behaves well for classes with lower device skills. You can adjust the constants to make it work, but that makes devices bad for everyone.

                            The easiest way to make it so that specific races are functionally incapable of using devices is to add a special flag to that race that’s used to heavily increase their failure chance, or even outright forbid device use. A replacement system might make it possible, but unless it’s just linear, it’s pretty likely you’d be pushing it outside its bounds in order to make such a relatively low-level device so hard to use.

                            Comment

                            • Julian
                              Adept
                              • Apr 2021
                              • 122

                              #15
                              Originally posted by Julian
                              The easiest way to make it so that specific races are functionally incapable of using devices is to add a special flag to that race that’s used to heavily increase their failure chance, or even outright forbid device use. A replacement system might make it possible, but unless it’s just linear, it’s pretty likely you’d be pushing it outside its bounds in order to make such a relatively low-level device so hard to use.
                              Actually, there’s at least one approach where this isn’t a problem, and it may be a good approach in general.

                              Pick a curve. Ideally pick one that’s asymptotic at both ends. A sigmoid would likely be good for this.

                              Skill sets the zero point on the curve — the failure rate for objects of level zero. Any higher-level objects, you just get the curve’s value for x further along.

                              Comment

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