1. Thanks for visiting! These forums are for the original Risk of Rain, if you're interested in discussing the newly released Risk of Rain 2 head over to that game's steam discussion forum
    Dismiss Notice

Game Data - Please help Collect

Discussion in 'General Discussion' started by Shrooblord, Jul 15, 2013.

  1. Shrooblord

    Shrooblord Void-Bound Voyager

    As far as I can tell, critical hits deal double the damage a normal one would (which makes sense, because Lensmaker's Glasses' description, an item that raises crit chance, is 'Chance to do double damage.').
     
    • Draken09

      Draken09 Black Hole Surfer

      Then I have two possibilities to bring up. When collecting that last data set, I noticed that one of the crits I got dealt 9 damage. Either the initial damage value (before crit and rounding) was >4.5 and <4.75, or the double damage theory is incorrect. (Probably the first, but I technically don't know.)
       
      • needsomemiracle

        needsomemiracle Scruffy Nerf-Herder

        It could be the former. It could be that the RNG rolls for 4.5, then for critical. When there is a crit, we see 4.5*2, which is 9. When there isn't, we see 4.5 rounded to nearest integer, which is 5.

        At least that makes more sense than "normal crit is *X, but lensmaker crit is *Y".
         
          Draken09 likes this.
        • Draken09

          Draken09 Black Hole Surfer

          I'll let you go ahead and crunch the new numbers, and see if it matches my previous work.
           
          • needsomemiracle

            needsomemiracle Scruffy Nerf-Herder

            Actually, scratch that.
            Very good, altough next time don't leave out crits - this way we can measure base crit chance along too.

            I'll try to explain my thoughts in a way that doesn't make anyone recall their math class :p

            I. Inner workings.

            Based solely on hopoo's post and my assumptions, basic mechanic in damage calculation seems to be this:
            1) Read current base damage B.
            2) Multiply base damage by skill percent S (the % listed in the skill description). This is your maximum damage (D1).
            3) Take 4/5 of that number (0.8, see hopoo's post quoted on the previous page). This is your minimum damage (D0).
            4) Roll anywhere between min and max.
            5) Roll for each effect (crit, shock, freeze, etc).
            6/7) Round the number to an integer (down, up, to nearest - we don't know yet).
            6/7) Apply damage and effects to target.

            Now, unless the developers invoked some sort of eldritch RNG from the depths of the Abyss, it produces unskewed normal distribution with median being equal to mean value. And that means that the most often encountered number would be the average of D0 and D1, (D0 + D1)/2 = (0.8*D1 + D1)/2 = (1.8*D1)/2 = 0.9*D1 = 0.9*S*B.

            In other words, if you rolled for damage an infinite amount of times, the average of all those rolls would be exactly 0.9*D1. If you roll for damage a finite but very large amount of times, the average will be very close to 0.9*D1.

            The average of those 43 rolls is 6.325.

            Still going with the null-hypothesis that base damage is 12 and DT deals 2 x 60% base damage.

            1) Base damage: 12
            2) 12 * 0.6 = 7.2
            3) 7.2 * 0.8 = 5.76

            Now, the average damage per shot should be 7.2 * 0.9, which is 6.48.
            Is 6.325 close? Pretty much. The only way to confirm this is to take even more data points. I just ran a few sets of 43 rolls of RAND(5.76;7.20) in MS Excel and got the following averages: 6.49, 6.31, 6.39, 6.44, 6.48. So far so good, right?

            II. Bouncing numbers.

            But we ain't get no 6.13 or 7.02 on the screen. We see integers. I can only assume that somewhere along the way those fractions get rounded up and then shown on-screen.
            In the Draken's set, we have eight "5", sixteen "6", sixteen "7" and three "8". All looks like the peak of that distribution graph would fall between 6 and 7 (around 6.48).

            But numbers can be rounder either up, or down, or to nearest integer. And that's where my hypothesis falls apart.

            If damage rolls are rounded up, we shouldn't be seeing any "5", because the minimum of 5.76 rounded up is 6.
            If damage rolls are rounded down, we shouldn't be seeing any "8", because the maximum of 7.2 rounded down is 7.
            If damage rolls are rounded to nearest, we shouldn't be seeing any "5" or "8".

            Yet we have both.

            Well, color me confused. Either there're some underpinnings I overlooked, or some of the basic assumptions are wrong.
             
              Rawrquaza, Draken09 and Shrooblord like this.
            • Zare

              Zare Void-Bound Voyager

              Could it be possible it just shaves off the decimal on screen? A game wouldn't look nearly as crisp with all theses extra digits on the end.
               
              • Shrooblord

                Shrooblord Void-Bound Voyager

                I must say I'm very impressed with the way you're cracking this case wide-open. I'd love to read more of your theory; I simply can't come up with anything better! ;)
                 
                  Draken09 likes this.
                • Draken09

                  Draken09 Black Hole Surfer

                  That would be rounding down.
                  I believe that the problem is not with your assumptions, but with one of your sources. You continue to refer to a post made on May 8th for the system by which damage is calculated. However, that is fairly old for a game constantly in development, and I can prove that at least part of the info found there is bunk. The more recent update post found here was released on may 26th, and gives character stats (which may be out of date themselves now) which do not match up with the "gains 3 damage each level."

                  As such, the very basis of your math has a strong chance of being based off of outdated information. :confused:
                   
                  • Rawrquaza

                    Rawrquaza Existential Complex

                    Well not necessarily, it could be truncating.
                    This is likely the case, and will probably continue to be the case until the final build is released.
                     
                      Draken09 likes this.
                    • needsomemiracle

                      needsomemiracle Scruffy Nerf-Herder

                      No escaping that, now isn't it.

                      Moving on to the next iteration of our hypothesis:

                      1) Read current base damage B.
                      2) Multiply base damage by skill percent S (the % listed in the skill description). Let's call it 'skill damage' D.
                      3) Feed it to a function F(D) that produces minimum and maximum values for a roll.
                      4) Roll for damage.
                      5) Roll for each effect (crit, shock, freeze, etc).
                      6/7) Round the number to an integer (down, up, to nearest - we don't know yet).
                      6/7) Apply damage and effects to target.

                      Does that look a bit vague to you? Well, it's going to get even more vague below. With only this sample pool to rely on, we'll have to fall back to statistical characteristics. Only two of them matter here.

                      First and most important is our good old friend - mean value, or average damage per shot (6.325).
                      Second is standard deviation (0.865), which is a square root of sample variation. Variation, in layman's terms, is how random the RNG is. Large variation means we'll often see very low and very high damage results.

                      Standard deviation is a bit trickier. Chebyshev's inequality can guarantee this:
                      • 68% of all damage roll results will fall within 6.325 +/- 0.865 (one standard deviation), or 5.46 -- 7.19
                      • 95% of all damage roll results will fall within 6.325 +/- 1.730 (two standard deviations), or 4.59 -- 8.06
                      • 99.7% of all damage roll results will fall within 6.325 +/- 2.596 (three standard deviations), or 3.73 -- 8.92
                      Mind you, that doesn't mean that 0.3% of shots will yield 3 or 9 damage. It means they can, in theory, go that low/high. In reality there's most definitely a hard cap of min/max damage programmed in, statistical functions just don't know that.
                      One skill isn't enough to do any reverse-engineering, though. Ideally we'd want 100-point or larger pool for each of Double Tap, FMJ and Suppressive Fire.
                      I know SF is a pain to track, and you'll probably need to record it first and pause/play a lot, but FMJ samples are absolutely necessary if we are to progress.

                      Another potential source would be samples taken at level 2 in the first 90 seconds. If damage works how I think it works, the distribution curve should retain its shape, with only the mean value shifting along the X axis (damage) by 3 per level.
                       
                        Rawrquaza likes this.
                      • Draken09

                        Draken09 Black Hole Surfer

                        I'm off on vacation as of right now, but here's a tip to other (data) miners; use a voice recording (like notes on iPhone 4S) tool to record numbers quickly.
                         
                        • Shrooblord

                          Shrooblord Void-Bound Voyager

                          OK then I've taken a few Double Tap (basic attack; ability 1) samples; all were shot against Lemurians, all before 90 seconds and at the respective levels:

                          7 5 6 6 6 7 8 7 5 7 5 7 7 7 8 7 7 5 5 6 5 5 7 6 8 7 6 6 6 6 6 6 7 8 7 7 5 6 12! 7 6 8 7 6 6 6 7 5 7 5 6 5 7 7 7 7 7 6 8 6 8 6 7 6 7 8 6 7 7 5 6 13! 7 7 6 7 5 8 5 7 7 5 6 6 8 7 6 7 5 7 5 6 5 6 5 5 6 6 8 5 7 7 6 6 6 5 6 6 7 6 7 5 5 8 7 7 7 8 8 8 7 7 6 5 6 8 5 5 6 5 6 5 7 7 7 5 5 7 7 6 6 6 7 6 6 7 6 7 6 7 6 6 6 5 8 7 7 7 5 5 7 7 6 6 6 5 7 7 7 5 6 6 5 5 5
                          Total: 175 samples


                          7 9 9 6 9 8 9 6 9 8 6 6 6 9 6 8 9 9 9 6 6 8 8 7 9 7 8 7 9 8 7 8 6 8 8 7 9 6 7 6 9 6 8 7 9 9 8 8 7 9 8 6 6 7 7 7 6 7 9 8 8 7 9 7 6 9 9 9 9 8 7 9 9 9 9 9 6 7 9 9 8 9 7 9 7 6 7 7 9 9 8 9 9 7 8 9 9 6 7 7 7 8 7 8 9 9 9 8 6 6 6 6 6 7 6 7 7 8 7 7 8 7 8 8 7 9 8 9 6 9 9 8 8 9 6 7 8 17! 7 7 6 8 9 7 8 8 8 7 9 9 8 9 9 7 9 7 8 9
                          Total: 158 samples

                          (crit hits are marked red and with an exclamation mark)
                           
                            needsomemiracle and Rawrquaza like this.
                          • needsomemiracle

                            needsomemiracle Scruffy Nerf-Herder

                            Splendid.

                            https://docs.google.com/spreadsheet/ccc?key=0AiGjom2Gz4kGdEFSOFVMbGMzd0JIM3AyYVI1U3BLX0E&usp=sharing
                            There. I'll keep all my calculations in this file. Feel free to comment, if need be.

                            Thanks to Shroob's data we've improved from 40+ samples to 200+ samples. It's interesting how variance jumped from 0.74 to 0.84 with this new data. It means that Draken's actually got lucky in the sense that his shots were less spread out and more "reliable" than they are. Alternatively, it could mean that Shrooblord got unlucky 175 times in a row, and his results are more swingy than they should be :p

                            Anyway, what's more fascinating is analysis of lv 2 DT. Not only it looks only vaguely normal-distribution'y (yet, I hope), it differs from lv 1 DT by 1.4, whereas there should be a +3 increment in damage. Why?

                            I think I know why. Double Tap is called "double" because the game apparently rolls for damage once, and then splits the damage in two roughly equal parts. You see both halves by tapping the fire key once.
                            To see the +3 difference, we shouldn't be looking at bare numbers, but at adjacent pairs of numbers. 1.4*2 is 2.8, almost 3.

                            But this doesn't affect how we gather data for now, don't sum anything up. We just need more points.
                             
                              Draken09 and Rawrquaza like this.
                            • Draken09

                              Draken09 Black Hole Surfer

                              But how would the damage be split? Assuming that Shrooblord recorded every hit, and that he didn't scramble them, it's obvious that the game doesn't just roll for damage, divide by two, and apply that twice. This is probably useless information for us, but it's relevant nonetheless.

                              On another note, I believe I know why the damage has a normal distribution (that's evenly distributed, right?) code wise. It simply figures out the range of possible damage results (5 through 8 = 3), takes a random decimal between 0 and 1 (java has a built in command for this, idk about others), multiplies the two, and add whatever it takes to reach the desired possibilities (in this example, 4, because 1 + 4 = 5, and 3 + 4 = 8).
                               
                              • needsomemiracle

                                needsomemiracle Scruffy Nerf-Herder

                                The algorithm is entirely up to the devs, I'm not going to attempt to second-guess it at this moment. It might as well be the way you described it. If I had to, I'd make it something like "roll, divide by two, add anything from -1 to 1, (shot 1), subtract this from roll result (shot 2), round one up and the other one down". Personal preference, really.


                                dt1joint.gif
                                And scrambling is nothing to worry about. Spoilered above are two diagrams of Shroob's DT lv 1 set: on the left numbers are paired up as #1 + #2, #3 + #4, #5 + #6, etc. On the right is the same but #2 + #3, #4 + #5, #6 + #7, etc. You can see that the difference is already minor (overall shape is the same), and once we rack up enough samples it simply won't matter.

                                I believe Game Maker must have a function to produce random numbers. I'm not sure I follow what you're getting to, but normal distribution looks like a bell curve. When you roll a die once, it's distributed evenly (uniform). When you add up results from multiple rolls, it turns into a bell curve.

                                You know, I just re-read some stuff and realized I might've worded some of my previous conclusions poorly.
                                "68,3% of roll results fall within 5,4 -- 7,2" is really misleading. I should've said "in 68,3% of your games average damage from DT at level 1 is going to be somewhere within 5,4 -- 7,2".
                                 
                                • Draken09

                                  Draken09 Black Hole Surfer

                                  Sorry, I'm in vacation, my brain decided to forget what normal distribution is. So... What is there left to do now?
                                   
                                  • needsomemiracle

                                    needsomemiracle Scruffy Nerf-Herder

                                    1. The same for Full Metal Jacket. The more of it, the merrier.
                                    2. A bit more testing of DT at level 2. And since you can't get to lv 2 without being lv 1, I'll gladly receive any data points for DT lv 1 too.
                                     
                                    • Shrooblord

                                      Shrooblord Void-Bound Voyager

                                      Let me just note that's exactly what I did and, no, I did no scrambling. These were damage values, not eggs!
                                       
                                        Draken09 likes this.
                                      • needsomemiracle

                                        needsomemiracle Scruffy Nerf-Herder

                                        Bump from oblivion.
                                         
                                        • Shrooblord

                                          Shrooblord Void-Bound Voyager

                                          I've been on holiday last week and will be on holiday again this week. I'll post some more when I get back. In the meantime, keep theorising - I love it!
                                           

                                          Share This Page