1. Hello and welcome to the brand new home for PlayDota!
    Please read through our Welcome thread to see what's new!
    Dismiss Notice

So invoker Cataclysm have 33% chance to hit a stunned target?

Discussion in 'Dota Chat' started by mapdesigner, Jan 11, 2018 at 6:40 AM.

  1. mapdesigner

    mapdesigner Member

    2,451
    111
    63
    Aug 11, 2011
    Hello,

    I just checked the discreption. it says range is 175 - 250 away from target, so the range is 75 units, while the radius of sun strike has 175 radius of effect. and since most heroes have 24 collision size, sun strike will also hit if it was 175-199 units away.

    so 25 units out of the 75 range is affected, meaning chance to hit is only 33%?

    when I tried though it seemed a little higher chance (44%) why?
     
  2. Black_Ice

    Black_Ice Member

    978
    7
    18
    Jul 14, 2009
    Did you make around 1000-10000 tries so it's statistically accurate?
     
  3. mapdesigner

    mapdesigner Member

    2,451
    111
    63
    Aug 11, 2011
    no

    about 150
     
  4. HHHNNNGGG

    HHHNNNGGG Member

    17,682
    401
    83
    Sep 21, 2010
    Because units at the center have higher chance to get hit by both?

    It is similar to Freezing Field, units at the center have more risk than at the edge.
     
  5. Blarrg

    Blarrg Member

    10,540
    404
    83
    Jun 12, 2009
    You're just calculating areas and dividing them then finding the probability that two of them won't hit.

    A unit with 24 collision size is able to get hit by any Sunstrike from a point between 175 and 199.

    Area where Sunstrike hits an immobile hero = A = (pi*199^2)-(pi*175^2) = 8976pi

    Divide this by the total area possible that a Sunstrike can appear. The wiki says it is two random locations with no limitations, so there is no extra math we have to do with excluding overlapping sunstrikes.

    Percent Chance Sunstrike to hit an immobile hero = A/((pi*250^2)-(pi*175^2)) = 8976pi/31875pi = 28.16%

    You have two Sunstrikes, so the chances of two Sunstrikes NOT hitting are:

    P = (1-.2816)^2 = 51.6%

    So the chances of Cataclysm hitting an immobile target are 48.4%.
    You also have about an 8% chance of BOTH sunstrikes hitting the immobile target.
     
    Last edited: Jan 11, 2018 at 7:51 PM
    BlizziC and mapdesigner like this.
  6. mapdesigner

    mapdesigner Member

    2,451
    111
    63
    Aug 11, 2011
    ehmmmm doesnt that depend on the randomness. I treated the problem as 1 dimensional becuz I thought it chooses a random distance and a random angle. on the other hand if it was random point in the circle it would be as you say. (but I think it is easier to code the distance-angle variables that to make a random point in the circle)
     
  7. FreeBorN

    FreeBorN Member

    1,953
    7
    38
    Jun 10, 2009
    A formula involving areas here is irrelevant or wrong, may only accidentally be correct, or close to the actual model, but as we see it is not.

    The model:
    Lets assume SunSrike hits if
    enemy hero collision circle and SunStrike AoE circle overlap.

    Let's ignore the representation of numbers in the source engine.
    Let's ssume 2 circles overlap even in the edge-case if they have 1 common point.
    This translates to the following overlap definition:
    Circles overlap if the distance of their centers is equal to or less than the sum of the their respective radiuses.

    If the distance of an AoE Spell from a Hero is a random variable with normal uniform distribution on the range of min to max and
    the hero has a non zero size collision circle, then I propose the following AoE hit condition:

    Hero will be hit if:

    SpellDistance <= AoESize + CollisionCircle

    And since we assume that the SpellDistance random variable is of Normal uniform distribution we can state the following
    P_hero_hit_by_spell = size of interval for hit / full size of interval


    Lets substitute the values for Dota2 heroes and Cataclysm
    Cata_Dist <= SunStrike_range + Hero_Collision_Size
    175 - 250 <= 175 + 24
    175 - 250 <= 199

    The condition is true For values 175-199 inclusive -> legth of range = 199-175 = 24;
    True range size = 24;
    Whole range size = 250-175 = 75;

    Chance for a single cataclysm event to hit a hero: 24/75 0.32 -> 32%
    (this single event never happens in the game when using cataclysm, always 2)

    Since cataclysm triggers multiple (2) such events, therefore a binomial distribution must be considered:
    Chance of exactly 0 hit(s): 1 * (1-0.32)^2 = 0.68^2 = 0.4624 = 46.24%
    Chance of exactly 1 hit(s): 2 * (0.32) * (1-0.32) = 0.4352 = 43.52%
    Chance of exactly 2 hit(s): 1 * 0.32^2 = 0.1024 = 10.24%

    As we can see the forumla is self consisent and the sum of the probability of the 3 disjunct outcomes nicely sums up to 1.

    Chance of at least 1 hit (1 or 2 hits either): 0.5376 = 53.76%

    The expected DMG output of a full LvL Catacysm on a stunned hero is:
    0.4624 * 0 * SS_DMG + 0.4352 * SS_DMG + 0.1024 * 2 *SS_DMG = 0.64 SS_DMG
    304 without Aghs
    344 with Aghs
     
    Last edited: Jan 12, 2018 at 4:30 PM
    mapdesigner likes this.
  8. Blarrg

    Blarrg Member

    10,540
    404
    83
    Jun 12, 2009
    Why would you assume it follows a normal distribution? A normal distribution is something that explains things like human behavior, where most humans will fall into the average. This does not work for a random number generator, it doesn't weight its results toward the middle to form a bell curve of results. A random number generator will follow a uniform distribution.

    Second, what you are describing isn't even a normal distribution. You are making the same mistake that mapdesigner made and looking at the problem in one dimension (the radius of the circle). You have to look at the problem as a whole.

    In the most simplistic sense, take a circle of radius 10. The inner 5 units of radius of that circle will represent an area of 25pi. The outer 5 units will represent 75pi. Three times more area, and in this problem three times the number of possibilities for a sunstrike.

    This is why you're getting numbers around 33% for your calculations. You're assuming that the area on the inside will be the same as the area on the outside, when it isn't.

    You wouldn't know unless you looked at the code. I highly doubt they are using polar coordinates because you will always lose out on the probability of the outside of the circle being higher. I would illustrate why this is but I can't right now.

    In fact, its a fun problem and a good lesson learned. To programmatically generate random points in a circle, you would not want to use polar coordinates because of the distribution incorrectly weighting towards the center. You would have to use a Poisson distribution of some sort if you want to use polar. However, the "correct" way to do it would to just generate cartesian coordinates within a square and check if they are within the circle, then regenerate if it isn't. Its much more likely they are just using cartesian coordinates for this reason.
     
    Last edited: Jan 12, 2018 at 3:52 PM
  9. FreeBorN

    FreeBorN Member

    1,953
    7
    38
    Jun 10, 2009
    I stand corrected about the name of the distribution. I meant uniform, you are totally right about that, and as you see all my calulations were originally done based on the trivial uniform distribution!

    For the rest you dont understand the problem well, and the 1 dimensional approach is correct here.
    It is in my first post why, I clearly describe the logical connection between when sunstrike hits and when not, and that is in connection with a uniformly distributed random number in a range, it has NOTHING to do with areas.

    Your problem comes from assuming the source2 engine somehow randomly select an area inside a larger area, however it is not. It is simply randomizing a number and yeah, a completely irrelevant angle which is also another number. These 2 numbers will determine the final location of the Sunstrike in question.
    However the only meaningful randomness is the distance of the sunstrike not its direction since it has no effect on whetever it will hit, or not, which is one variable, one single dimension, nothing about areas.
     
    Last edited: Jan 12, 2018 at 4:38 PM
  10. Blarrg

    Blarrg Member

    10,540
    404
    83
    Jun 12, 2009
    The one dimensional approach is definitely incorrect. I've already explained why it is wrong in the post above pretty clearly without giving actual illustrations. Choosing a random point within a circle is a completely different problem than choosing a random point on a radial line from the circles center.

    Once again, you don't have the code, and any programmer worth their shit would know how to program this correctly. If they program it to choose a random angle with no distribution weighted toward the outside of the circle then it is programmed incorrectly. It doesn't reflect the reality that the properties of a circle result in a larger chance of a random point in the circle being on the outside radius due to its r^2 relationship.

    You can continue put it to the test in a demo lobby and start tallying up if you'd like. mapdesigner already did 150 runs and got 44%, showing that it is more likely that it works exactly how I described, considering your theoretical 2.5 times as far off as mine. I suspect if you did more trials it would continue converging toward 48%.

    Also this has nothing to do with the "source 2 engine." Please refrain from talking about something you don't know.
     
    Last edited: Jan 12, 2018 at 5:32 PM
  11. mapdesigner

    mapdesigner Member

    2,451
    111
    63
    Aug 11, 2011
    ummm,

    when you say incorrect do you mean it favors some points more than others? becuz I see both are just way of thinking of the problem and way of distributing randomness, but (to me) none can be incorrect.

    but as e know, the outer part of a circle has more area and therefore "more points" so if we consider the area instead of the

    oh wait I think im restating you here. I hope im correct.

    anyway im gunna sleep now and will look into it once again tmrw.

    thx all

    goodnight
     
  12. Blarrg

    Blarrg Member

    10,540
    404
    83
    Jun 12, 2009
    When I say incorrect I mean it is literally incorrect to approach the problem from a one dimensional perspective of only taking into account the radius. You are literally getting an incorrect answer and there is no "looking at it from a different perspective." Your perspective (and Freeborn's) of looking at it is a misunderstanding of the problem as a whole.

    EDIT:

    [​IMG]

    Look at this picture. Obviously its not to scale its a paint picture but it gets the point across. I drew lines from the center to the edge of the circle. Notice how the closer to the middle of the circle you are, the "darker" it becomes. A larger percentage of that inner radius is being represented because you're limiting yourself to choosing points on these lines. No matter how small of a fraction of a degree you use for your angles, you will run into this problem. You will always be over representing the center of the circle unless you weight the distribution to the outside of the circle (which you aren't doing in your calculations).
     
    Last edited: Jan 12, 2018 at 7:21 PM
    HHHNNNGGG and mapdesigner like this.
  13. FreeBorN

    FreeBorN Member

    1,953
    7
    38
    Jun 10, 2009
    Current calculations are done in the source 2 engine, since the game uses that. I never stated I know my shit about source 2 I simply stated that lets ignore how it represents numbers. Bro you need to chill out I am really not fighting here to feel proud or anything, sorry but I kinda understand why you have 10k+ posts you always need to reinterpret words of others? :D I did not say it is beacuse of the source 2 engine, I repeat I stated to ignore its irrelevant implementation details, such as rounding numbers, since we dont know it anyway, and we try to guess a model behind a mechanic not inaccuarcies based on implementation details.

    What you state with the areas clearly assumes a non uniform distribution of selection of distance from the target as you also explained. If the mechanic is indeed needlessly so complicated to take a random point from an area, than yes you would be right, but hell then the spell explanation should be like this: Cataclysm will select a random point for its epicenter from a certain target circle and not a random range.

    If the explanation says a random distance, then its a one dimensional model with my probability,
    if the explanation says a random point from all potential points (lot more convoluted and counterintuitive) then indeed you are rgiht.

    As for who is actually right I dont give a flying duck, but I totally insist on my 1 dimensional approach being more intutive and logically coherent with the description of the spell, therefore for me based on the spells description it is totally a one dimensional model.

    My version is stronger, and yours is a weaker cataclysm. It would be nice to see the code cuz the actually interesting question is what was balance-wise the intention of this spell.
     
    Last edited: Jan 13, 2018 at 11:53 AM
  14. mapdesigner

    mapdesigner Member

    2,451
    111
    63
    Aug 11, 2011

    Thanks,

    I am actually convinced.

    @FreeBorN yes if the spell is to be buffed then it might be switched to the first aproach, or better yet change the distances (from 150-225 or something). it would be better than the first aproach.
     
  15. HHHNNNGGG

    HHHNNNGGG Member

    17,682
    401
    83
    Sep 21, 2010
    The biggest portrayal of polar distribution is, as I said before, Freezing Field. It is not fully polar distribution, but it does come close. Units have higher chance to get hit when they are near the center than at the edge.
     
  16. Blarrg

    Blarrg Member

    10,540
    404
    83
    Jun 12, 2009
    A game engine does not determine how you're allowed to represent coordinates.

    It is a uniform distribution. Every point inside the circle has an equal chance of being chosen. The mechanic isn't complicated and only becomes complicated when you try to represent your random choices with polar coordinates as opposed to cartesian coordinates. Since every point inside the circle has an equal chance of being chosen, then it is more likely to choose the outside "half" of the circle because that outer half represents a higher percentage of the circle's area.

    It chooses a random point within the "donut" shape created by a 250 radius and a 175 radius circle.

    The spell description says nothing about it being one dimensional. A circle is a two dimensional object that can be represented with a single value, its radius. Just because one value is used doesn't mean the problem is one dimensional.

    Also, if there is anything I've learned from college, its that you shouldn't trust your intuition.

    Test it yourself in demo mode and tell us what percentage of sunstrikes hit after 500 attempts on an immobile target. Considering that after 150 attempts the result was 44%, I'm going to assume that my math was correct with how it works in game. And if it isn't correct, then I will say that the programmers incorrectly implemented the spell.