General Discussion

General DiscussionDeveloping a test for Pseudo-Random Distribution Uphill Miss Chance

Developing a test for Pseudo-Random Distribution Uphill Miss Chance in General Discussion
stripey

    Hello,

    I am doing a math project on Dota 2 regarding Pseudo-Random Distribution (PRD). On the gampedia dota wiki (https://dota2.gamepedia.com/Random_distribution), there is a section which mentions evasion having PRD. However, it states that tests have not been made regarding Blind and uphill miss chance to determine if it uses PRD or random distribution (in this case, PRNG).

    My question is this: How can i develop a program for monitoring miss rate? My plan at the moment is to:
    1. Spawn a Timbersaw and give him 6 hearts with max "Reactive Armor".
    2. Spawn a Sniper with max "Take Aim" and 6 Moonshards for fast attack rate and long range.
    3. Set sniper to attack the Timber from low ground at maximum possible range; Timber has enough armor that he will not die from Sniper.
    4. Set to run overnight.

    The only issue with this plan is that I cannot figure out a way to quickly monitor if the attacks miss or not. The combat log shows every time Timber gets hit, but not when an attack misses.

    If I zoom into Timber, then I will only be able to hear the shots hitting him. Any missesmake no sound. However, using a sound threshold recording program would only display successful attacks. I would like to be able to record both misses and hits.

    If anyone had any tips on how to record misses and hits, I would appreciate it very much. I have zero coding experience, but I would be willing to learn.

    stripey

      For further research, if interested:

      The OG pseudo-random distribution thread, back from DotA: https://web.archive.org/web/20120707165205/http://www.playdota.com/forums/showthread.php?t=7993

      An interesting test for PRD, also from beta days
      https://dev.dota2.com/showthread.php?t=24618

      Wiki article on Dota 2 PRD
      http://wiki.teamliquid.net/dota2/Pseudo_Random_Distribution
      https://dota2.gamepedia.com/Random_distribution (Already posted in OP)

      Thank you for your help.

      Този коментар е бил редактиран
      Cheap Laugh Guy

        1. Put dummy target in demo mode
        2. Make max level ranged hero(preferably with small range of base attack damage)
        3. Record average damage
        4. Consider BAT, Attack Speed into calculation.
        5. Start timer when start shooting.
        6. At the end of timer, stop shooting. Record total damage taken by donkey.
        7. Number of Hits landed = Total damage taken/Avg atk damage
        8. Number of Hits attempted(aka missed + landed) = Timer duration/attack time

        stripey

          Hey @Into the Window of Soul,

          Thanks for the input into a method for calculating hits and misses. Unfortunately calculating PRD will not only require the overall hits but the hits made between misses. As the % of proc'ing increases with each missed hit, it would be necessary to look at each string of successful hits to see the probability of a miss potentially increase as more hits occur.

          I appreciate your advice though!

          arin
            Този коментар е изтрит
            arin

              nevermind, one more time. forgot how prd works.

              first of all, take wr, not sniper with moonshards roFL

              you need to make some sort of text detection program. or not even text, you can just write down which pixels light up (= choose one from each line) when you fill the combat log and how many pixels is between lines and check these positions on your screen. this shouldn't be very problematic since you'll be filling the combat log with nearly identical messages.
              every tick (1 tick = bat of your hero), your program needs to check if a new line was added or not. i suggest saving ur shit in some array with 1s and 0s whether you hit or missed.
              after the combat log shows a last line on the very bottom, you need to somehow clean the log after filling it, either there's a button for it or you just set a shortest interval possible where you dont do anything with ur hero and refresh the log after this time.
              rinse and repeat

              this fill up your array with 1s and 0s.
              then just use math, profit.

              e: i might edit this like 20 more times if i notice something wrong or realise something but i guess that this gives you the idea

              Този коментар е бил редактиран
              Cheap Laugh Guy

                Or u could just manually record the hits by staring at the screen for IDK how long and ruin your eyes
                SeemsGood

                Krenka

                  Well you know how many attacks will be made per minute, why not just calculate how many attacks are missing from the log, per let's say, minute? And if you include a timestamp between each attack made, it'll be easy to see how many attacks are missing inbetween the hits.

                  [MAGA]

                    "The combat log shows every time Timber gets hit, but not when an attack misses."

                    So calculate Sniper's attack speed, then you'll know how many attacks sniper dished out over X time.

                    Този коментар е бил редактиран
                    Story Time

                      isnt PRD going to produce more misses than normal random? then you can just reject the null hypothesis when number of hits is bigger than in control sample and you do not need even regression analysis, just compare the means

                      Future AS2 Mono Billionaire

                        I think attack speed is fixed, so you can use to determine how many shots were fired in a given time; you can then count hits using the combat log.

                        Totentanz to The King: M ...

                          If you do so many tests, true random and pseudo-random distribution will show similar results. You wont prove if it is PRD by hitting a guy 1000 times and calculating how many times you missed. PRD is more recognizable when you do fewer hits.

                          🍩🍪Cookie🍪🍩

                            this^

                            Jacked

                              i think u can still see it. in long run RD will avg out to the same number. and if u analyze say every 10 hits of the 1000 you will not necessarily see a very clear pattern whereas PRD should show u a clearer pattern.

                              Този коментар е бил редактиран
                              lowercasenospace

                                Basicly if you Do this, you already know its not PRD if you get like 10 misses in a row. This test is ultra simple and Takes like 10 min time.

                                miturian

                                  presumably you have time a stamp for each hit? you know the shots will be equispaced - just look for gaps in the hits, and then you'll have your miss-times.

                                  arin

                                    well yea but with that array u can still check how many 1s appeared before a 0 and then see the probability after n hits

                                    twitch.tv/agilnation

                                      It's easier doing a PHD than having to play dota.

                                      Exponent-

                                        However, using a sound threshold recording program would only display successful attacks. I would like to be able to record both misses and hits.

                                        You can calculate the time interval between 2 hits, and since you are able to capture the 'peaks' i.e. the hits, you can always find the missing peaks to identify the misses. You can then tabulate the sequence and bucket them to identify patterns.

                                        If you do so many tests, true random and pseudo-random distribution will show similar results. You wont prove if it is PRD by hitting a guy 1000 times and calculating how many times you missed. PRD is more recognizable when you do fewer hits.

                                        This is true. So to identify a PRD, you should do this for a set number of times for a certain number of reps to identify the pattern.

                                        It's easier doing a PHD than having to play dota.

                                        What a shit-post on a serious thread.

                                        Този коментар е бил редактиран
                                        Cireo

                                          To make what others said above explicit, you need to record the stream, not the average. Any approach that ends up with 1 value (e.g.: mean percent chance to hit) is not going to be super interesting. What you probably want to do is take the values: {H, M, M, H, M, H, H, H, M, ..} , and record the number of hits/misses grouped by the how many attacks since the last hit. For example:

                                          $ python pseudo.py 
                                          
                                          Results:
                                          0: 5533/7444 (74.33%)
                                          1: 1431/1911 (74.88%)
                                          2: 352/480 (73.33%)
                                          3: 96/128 (75.00%)
                                          4: 27/32 (84.38%)
                                          5: 5/5 (100.00%)

                                          Note that the highest values will usually "look" like they have a higher chance to hit, and the ones just below the highest can "look" like they have a lower chance to hit, because we 'reset' on the hit, and don't see all the possible values above. Increasing the sample size shows this is an illusion (look at the 5-prior-miss row above and below):

                                          Results:
                                          
                                          0: 562290/749917 (74.98%)
                                          1: 140707/187626 (74.99%)
                                          2: 35253/46919 (75.14%)
                                          3: 8739/11666 (74.91%)
                                          4: 2202/2927 (75.23%)
                                          5: 554/725 (76.41%)
                                          6: 136/171 (79.53%)
                                          7: 22/35 (62.86%)
                                          8: 12/13 (92.31%)
                                          9: 1/1 (100.00%)

                                          from random import random
                                          
                                          from collections import defaultdict

                                          HIT, MISS = 'HIT', 'MISS'
                                          MISS_CHANCE = .25
                                          SAMPLES = 10000
                                          attacks = [HIT if random() > MISS_CHANCE else MISS for _ in xrange(SAMPLES)]
                                          grouped = defaultdict(lambda: defaultdict(int))
                                          prior_misses = 0
                                          for result in attacks:
                                          grouped[prior_misses][result] += 1
                                          prior_misses = 0 if (result == HIT) else prior_misses + 1

                                          # Probably would want to use something from
                                          # https://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval
                                          # to actually estimate the confidence intervals to help explain why the
                                          # later values are not as close to 75%.
                                          print 'Results:'
                                          for prior_misses, counts in sorted(grouped.iteritems()):
                                          hits = counts[HIT]
                                          total = hits + counts[MISS]
                                          perc = (100. * hits) / total
                                          print ' %d: %5d/%-5d (%5.2f%%)' % (prior_misses, hits, total, perc)

                                          stripey

                                            Hey, the weekend finally came so I could figure stuff out.

                                            From your guys super insightful advice (holy crap why is everyone so smart in Dota), I've figured out how to monitor this. Shouotuts to https://www.dotabuff.com/players/92536008 for the process.

                                            My process is going to be to monitor the combat log at the same attack speed as the attacker to see if a new line was added. It seems codeable, but because I have absolutely no experience in coding, does anyone have any idea how I could go about creating an app that monitors pixel changes at a constant rate and gives a 1 if it changes and a 0 if it doesn't?
                                            I should also ask what language/program I should use to make this application.

                                            Thank you guys so much for helping me out.

                                            EDIT: I just installed Visual Studio. Because it was the first thing that popped up on Google. Good idea?

                                            Този коментар е бил редактиран