Jump to content
  1. Welcome

    1. Announcements / News

      The latest. What is happening with 0 A.D. Stay tuned...

      5,3k
      posts
    2. Introductions & Off-Topic Discussion

      Want to discuss something that isn't related to 0 A.D. or Wildfire Games? This is the place. Come on in and introduce yourself. Get to know others who are using 0 A.D.

      38,5k
      posts
    3. Help & Feedback

      Here is where you can get help with your questions. Also be sure to tell us how we are doing. What can we improve? What do you wish we could do better? Your opinion matters to us!

      16,7k
      posts
  2. 0 A.D.

    1. General Discussion

      This is the place to post general stuff concerning the game. Want to express your love for hoplites or find people to play the game with? Want to share your stories about matches you have played or discuss historical connections to the game? These and any other topics which are related to the game, but don't have their own forums belong in this forum.

      51,1k
      posts
    2. Gameplay Discussion

      Discuss the game play of 0 A.D. Want to know why the game plays the way it does or offer suggestions for how to improve the game play experience? Then this is the forum.

      28,1k
      posts
    3. Game Development & Technical Discussion

      A forum for technical discussion about the development of 0 A.D. Feel free to ask questions of the developers and among yourselves.

      47,9k
      posts
    4. Art Development

      Open development for the game's art. Submissions, comments, and suggestions now open.

      30k
      posts
    5. Game Modification

      Do you have any questions about modifying the game? What will you need to do what you want to? What are the best techniques? Discuss Modifications, Map Making, AI scripting and Random Map Scripting here.

      44,3k
      posts
    6. Project Governance

      Forums for decision-making on issues where a consensus can't be reached or isn't sufficient. The committees are chosen from among the official team members, but to ensure an open and transparent decision process it's publically viewable.

      148
      posts
    7. 600
      posts
  • Topics

  • Posts

    • Careful. It's not the distribution that you are multiplying, it's each value. Otherwise, you would be changing the amplitude (height), not the standard deviation (width). And this works only because you are applying it to a normal distribution of mean 0 and standard deviation 1. On a side note, there are many "bell shapes": Cauchy, hyperbolic secant, etc, the normal distribution is a Gaussian, and before you mentioned "variance", keep in mind that's the square of the standard deviation.   I counted 3 given the phrase I quoted. But now I went to the code and I understand what's going on. You calculate first values for normal distributions for x and y (mean 0, standard deviation 1), and then you multiplied them by the distance spread (which changes the standard deviation of the resulting Gaussian, as explained before). Well, this shouldn't give you a square (I thought you were integrating with wrong limits to get the probabilities, but I think that's the part you are doing with a CDF calculator). This is the relevant part of the code: const distanceModifiedSpread = ApplyValueModificationsToEntity("Attack/" + type + "/Projectile/Spread", +this.template[type].Projectile.Spread, this.entity) * predictedPosition.horizDistanceTo(selfPosition) / 100; const randNorm = randomNormal2D(); const offsetX = randNorm[0] * distanceModifiedSpread; const offsetZ = randNorm[1] * distanceModifiedSpread; data.position = new Vector3D(predictedPosition.x + offsetX, predictedHeight, predictedPosition.z + offsetZ);   Which I'm going to simplify, in python, and fix distanceModifiedSpread = 60, for 100000 points: N = 100000 predictedPosition = {'x':10,'z':10} distanceModifiedSpread = 60 for _ in range(N): randNorm = (random.gauss(0,1), random.gauss(0,1)) offsetX = randNorm[0]*distanceModifiedSpread offsetZ = randNorm[1]*distanceModifiedSpread data_position = (predictedPosition['x'] + offsetX, predictedPosition['z'] + offsetZ) I get this density plot: So, not a square.   That's acceptable enough, but bear in mind that your calculations are approximations. When you used the CDF calculator to integrate a Gaussian with mean 0, standard deviation 1.35, between -1.5 and 1.5, and got 73.35%, and multiplied by itself, you are indeed calculating the probability of hitting a square. Then you multiply that by a factor telling you how much smaller is the circle respect to the square, but that multiplication is having the hidden assumption that the probability distribution is the same in all points of that square (that's what multiplication really means, weighing all elements the same way, and that's why integrals and convolutions are more powerful). If you want to get the exact result, you have to multiply first and integrate later (or use the CDF calculator, but that's for the weak :P). The actual CDF can be found for example in https://en.wikipedia.org/wiki/Rayleigh_distribution, since it's related to the problem of having a "two-dimensional vector Y=(U,V) which has components that are bivariate normally distributed, centered at zero, with equal variances , and independent".
    • Concerning the size of the ships and now the water depth.  1. I've had a number of situations where my "fleet" got tied up in knocks and I could not move them until I untangled them. "Smaller" ships may resolve this type of concern. 2. I've also built a dock where the water depth was too shallow for the larger boats, so I ended up with ships that could not go anywhere and had to be destroyed.  
    • Further thinking about my 1D simplication case, I find that we can obtain the actual probability quite easily.  Since x and y are independent, we can just take the square of the probability, which means probability of x being within +-1.5m of target times the probability of y being within +-1.5m of target.  Next, since infantry is considered as a circle, we further multiply it with the area of circle divided by area of square. So, the exact probability of archer hitting target at 60m is 73.35% x 73.35% x pi x 1.5 x 1.5 / (3 x 3) = 42.26%.  A spread upgrade would make it 54.77%.  Pretty low!  Would anyone perform experiment to prove it correct or prove it wrong?
    • Thanks for trying to understand my imprecise description.  Random normal distribution is a bell shape of standard deviation of 1.  If we multiply it by a spread of 2, it becomes a fatter bell shape, with standard deviation of 2. Spread is calculated like 2.25 x 60 / 100.  It doesn't change like the way you relate with area.  Consider it like a radius of a circle, centered on the landing point of projectile   At 100m the circle is large, so shooting is inaccurate, at 50m the cirlce is smaller, more accurate.  You are right that the area changes by 4 times, but spread is more like a radius, not area.  This is a 1D value, not 2D.  The random distribution is 2D.  Multiply the 2D distribution with the 1D spread factor to make the distribution fatter, larger, more spread out. x y are not position of the landing point of projectile, but the random values to be added to the position of the landing point to make it spread out randomly.  With spread, the landing position is no longer a point, but a 2D normal distribution centered on that landing point. You are right to point out that they "shouldn't" be independent.  But as fact, the source code calculated them independently, probably to speed up computation.  So the condition x^2 + y^2 = R^2 did not hold.  x is just a random value with normal distribution, and y is just another random value with normal distribution.  Together, x and y has no relationship.  That's why the CDF is not circular.  It is weird, but it is the current fact. Also seems you tried to understand "independent" as separate, and counted 3 spreads.  When I mentioned independent, it is in the sense of random variables.  Since it is 2D, there are only two independent random variables.  Spread is a constant factor, like 2.25 for archer.  At distance of 60m it is adjusted to 2.25 x 60 / 100.  Multiplying the spread would make the random normal distribution larger, fatter, more spread out. And I guess your final intuitive interpretation is correct.
×
×
  • Create New...