Dismiss Notice
Wynncraft, the Minecraft MMORPG. Play it now on your Minecraft client at (IP): play.wynncraft.com. No mods required! Click here for more info...

Guide Forgery Probabilities & Expectations

Discussion in 'Wynncraft' started by Glitched Pixels, Oct 14, 2023.

Thread Status:
Not open for further replies.
  1. Glitched Pixels

    Glitched Pixels Silent Constructor VIP+ GM CHAMPION

    Messages:
    21
    Likes Received:
    70
    Trophy Points:
    50
    Creator Karma:
    Guild:
    Minecraft:
    O | Preface
    The probabilities and expected values for forgery running have been subject of a few threads with quite a few different approaches. Most of these give decently accurate results but lack a little rigor, so this should serve as an assembly of the most accurate values for forgery I could calculate and what they mean.


    O | The Premise
    This thread is going to concern itself with chance to get a mythic from running the dungeons at the forgery, for that I am going to use the following terms:
    • One Run will be opening the forgery chest at the current maximum of 8/8 dungeons completed.
    • A Streak is a series of consecutive Runs that starts with a forgery value of "0 Runs without a Mythic" and ends on a run that finds a mythic item.
    • The Length of a Streak is the amount of Runs within that streak.
      This means that the shortest possible Length of a Streak is 1.
    The random variable the forgery revolves around is going to be called L, representing the Length of a Streak.
    Due to the definition of a Streak used here, the Length of a Streak is independant of any Runs before it, which is what makes this handleable.

    As confirmed by the content team, the chance of finding a mythic item on th nth Run after the end of the last Streak is
    eq1.png

    This means that probability distribution of L can be characterised the follwing ways:
    eq2.png

    O | Worst Case Probability
    A few results from the probability formulas can give a rough feeling for how this distribution will playsout.
    • Less than 50% of Streaks are longer than Length 37
    • Less than 5% of Streaks are longer than Length 109.
    • Less than 1% of Streaks are longer than Length 139.
    • Less than 0.1% of Streaks are longer than Length 171.

    • Less than 50% of Streaks are shorter than Length 38.
    • Less than 10% of Streaks are shorter than Length 6.
    The probably of getting at least a single mythic item can be seen in the following graph.
    fig1.png

    It seems visually very close to an upside-down exponential, which is what would be expected for a constant chance to find a mythic item. Yet trying to fit an exponential over it actually reveals that its beginning is indeed very close to an exponential. However with greater values it grows closer to 100% faster than an exponential, reflecting the ever-greater pity factor when you fail to find a mythic item for a long time.

    O | Expected Value
    This is likely the value with the greatest implications for running the forgery. The Expected Value E(L) is the value the average Length of your Streaks will approach as you keep doing the forgery and its value is
    E(L) = 45.176

    Here is an example to clarify:
    Imagine you started running the forgery for the very first time and found a mythic after 12 runs, then another after 40 runs, another after 35 further runs and then did 13 more runs without finding a mythic.

    In total you completed 100 Runs and found 3 mythics. Your average Length of your Streaks is (12 + 40 + 35) / 3 = 29.
    The expected value now tells you that this was rather lucky; If you keep going, over time you will see this average go up and approach the expected value of 45.176. So in the long run, you will expect to need about 45 Runs for every mythic item from the forgery.


    This result comes from the standard formula for the Expected Value of a positive whole-numbered Random Variable.
    eq3.png
    The upper limit here comes from the fact that after a certain point the previously said formulas stop being applicable because they leave the range from 0 to 1 and would have to be clamped.
    This upper limit is the maximum Length of a Streak, which can be found the following way:
    eq4.png

    This is now ready to be implemented in code! Here it does not actually matter whether you identify the upper bound by its number of 423 Runs or the formula going above 1. The following code then gives the 45.176 figure!
    cd1.png


    O | Constrained Expected Value
    The result from the previous section is very abstract in the sense that it applies to what happens in the very long run, when everything averages out and the difference between Streaks and Runs becomes a mere factor. So it does not really give a good indication of what to expect in the much smaller realms of practical forgery running.

    A more intuitive and applicable function is the average amount of mythic items found in a series of consecutive Runs. This one will be called Ex(n) and give you the amount of mythic items you can expect to find when doing n Runs starting from no previous failed ones.

    Here is the graph of this function:
    fig2.png

    After 100 runs, the function becomes almost indistinguishably linear, so the sample has been limited to make the interesting nonlinearity in the beginning more visible. A perhaps interesting note is that 55 is first series of Runs that expects to get one mythic item. This quite hightlights that different values which should seem to indicate when you should get one mythic item can mean very different things and have to be treated very carefully!

    To try and calculate Ex(n) it will prove very useful to consider the Length of the very first Streak in a set of n Runs.

    It is known with what probability it will be of any given Length i and if it is Length i then the amount of mythic items you expect after those i Runs is Ex(n-i) while you have gotten 1 mythic item from your first Streak already. If you sum up the possibilites for Ex(n-i)+1 mythic items according to their probabilities (stopping when a first Streak of Length i is nonsensical), you will have gone through all possibilites for n Runs and get Ex(n).

    This can be implemented with a simple array holding the values of the function for previous numbers of Runs. A naive implementation looks like this.
    cd2.png

    This has both a time and space complexity of O(n), which is more than enough to compute the function for any practical value on most modern hardware. Interestingly, the space complexity can be cut down to a constant, namely Lmax, as the value for n only depends on the Lmax preceding it, so the rest may be discarded.

    Taking this even further, by the formula described above, this function is entirely given by a linear recursive relation! This means it can be expressed directly as a sum of exponentials (with the help of polynomial to take care for repeat bases). Depending on the implementation of exponentiation, this can theoretically cut down time complexity below linear!

    Unfortunately... the characteristic polynomial of this relation will be of degree Lmax = 423, which means at least 423 potentially complex roots, which can only be numerically approximated. This together with the resulting volatility of summing 423 exponentials would require unreasonably precise number types, which would certainly take up enough space to be rendered entirely unusable.




    O | Conclusion
    This was quite an enjoyable exercise in stochastics, but it also showed me a few things about the way the forgery pity system works:

    Looking at the graphs and considering the aspects relevant to gameplay, you can see that the pity system actually behaves very similiarly as if it was just a constant, allthough higher than the 1.5% base probability. Often Streaks end long before the pity factor has an obvious contribution, mainly massaging the base probability slightly higher in most cases and taking care of the absolute worst case.

    So while the pity system does not change the distribution of Lengths of Streaks much beyond making them shorter, I still think it is quite interesting mathematically and analysing it does reveal some interesting ideas from many different fields that one might not expect to need here.

    I do hope that this quenches the thirst for any that have been as curious about the underlying math behind the forgery and that everyone else can find their use in the numbers provided.

    Thank you for reading!
    - @Glitched Pixels
     
    Last edited: Oct 15, 2023
    FAZu, underlein, Iced0ut and 7 others like this.
  2. MlecznyHuxel99

    MlecznyHuxel99 Fruman walls guy VIP+

    Messages:
    1,235
    Likes Received:
    2,999
    Trophy Points:
    164
    Guild:
    Minecraft:
    Actually a good thread, too bad nobody runs forgery for mythics since lr update (if someone does they are insane)
     
    Xellulor and ineedhelp like this.
  3. TwageTomato

    TwageTomato Coder | Like-Giver | Tomato | Musician CHAMPION

    Messages:
    1,018
    Likes Received:
    881
    Trophy Points:
    130
    Minecraft:
    Looking at that first graph, it would appear that there is a 5% chance that even after 110 runs, no mythic. Imagine that pain. Now go do a lootrun.
     
Thread Status:
Not open for further replies.