stevenlau
Community Members-
Posts
15 -
Joined
-
Last visited
Everything posted by stevenlau
-
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.
-
Spread of common infantry - Archer:2.25 Crossbowman:3 Javelineer:4 Slinger:3 Spread means how inaccurate the shooting becomes at 100m from target. The spread is less when closer than 100m. For example, it is half at 50m. Thus, archer and crossbowman are proportionally the same: 2.25 x 60 / 100 = 3 x 45 / 100 = 1.35 A projectile (arrow / stone / javelin) is considered to hit a infantry when it arrives at radius < 1.5m from target (indeed, a circle). A projectile is considered to hit a calvary when it arrives at the 3m x 6m rectangle of the target (indeed, a rectangle), which is a little larger than the size of two infantry. Dog is smaller, elephant is larger, charriot is larger. Now, at the beginning of a shoot, after waiting a short initial prepare time (once only), the future location of the target (because it may be walking) is very often precisely predicted, and the projectile is shot there, at a speed around 70m-100m per second, depending on unit. It should mathematically hit the target at the exact position when the projectile lands. Therefore, if the target changed direction during this time, the predicted future location is no longer correct, and the projectile might miss. This behavior is the principle of dodging. Even if the target did not change direction, the projectile might also miss due to the spread. The exact spread is given by a pair of independent normal random variable at variance of 1m. It is then multiplied by the spread. The result is some sort of 2D normal distribution, but since x and y are independent random variables, the 2D CDF is not circular, but more like a square. It seems super difficult to mathematically calculate the exact probability of it hitting a target. Let's get a rough idea by assuming the 1D case. I don't know how much would it deviate from 2D case, would be great if some mathematician could help. (Edit: I solved the 2D case, see reply below) In the simplified 1D case, I just use some online normal CDF calculator, fixing lower bound at -1.5, upper bound at 1.5, mean at 0, standard deviation at 2.25 x 60 / 100 = 1.35. Archer hits an infantry at 60m with probability 73.35%. After an upgrade of spread (-20%), standard deviation = 2.25 x 0.8 x 60 / 100 = 1.08, the probability is 83.51%. Crossbowman and slinger hits infantry at 45m with probability 73.35%. At rank 2 spread -20%, the probability is 83.51%. Indeed, exactly same as archer at 60m, coincidentally. Javelineer hits infantry at 30m with probability 78.87%. At rank 2, the probability is 88.18%. The best unit would be rank 3 archer plus spread upgrade, at standard deviation = 2.25 x 0.8^3 x 60 / 100, hitting target at 60m with 97%. Last but not least, when a projectile misses a target, it is not wasted. It will hit some innocent person standing there. Reference: https://gitea.wildfiregames.com/0ad/0ad/src/branch/main/binaries/data/mods/public/simulation/components/Attack.js#L714
-
What is clearance? It is 0.8 for most units. Roughly regarded as the size of a unit. Reference: https://gitea.wildfiregames.com/0ad/0ad/src/branch/main/binaries/data/mods/mod/simulation/data/pathfinder.xml#L58 Clearance as full width In the calculation of pushing, each unit is first considered as a 0.8 × 0.8 square. Then the radius of the circumscribing circle is 0.8 × √2 ÷ 2. Reference: https://gitea.wildfiregames.com/0ad/0ad/src/branch/main/source/simulation2/components/CCmpUnitMotion_System.cpp#L78 Clearance as half width In regarding unit as obstruction, each unit is considered as an axis aligned 1.6 × 1.6 square. Reference: https://gitea.wildfiregames.com/0ad/0ad/src/branch/main/source/simulation2/components/CCmpObstructionManager.cpp#L305
-
Why don’t more players use “Call to Arms”?
stevenlau replied to AlexHerbert's topic in Gameplay Discussion
I don't find it worths a hotkey place. I just click the call to arms icon at the bottom. -
While developing stevenlauBot, I read a whole lot of 0AD source code. I got a closer look on the behaviour of attacks, which isn't available in user guides / manuals. Advanced players might find this useful. Dodge CC arrows with 5 cps Consider the simple case in which some enemy units are constantly running under a defensive building. The building is angry, and would shoot all arrows evenly in the first quarter of repeat time, i.e. 4s ÷ 4 = 1s for CC. During that 1s, the arrows are shot evenly in 5 batches. As a result, to dodge under CC, you do 5 clicks per second, then you have 3s of free time. For stone tower the repeat time is shorter, so you have to click a little bit faster. In addition, the arrows are shot to the same target until it dies, so you only need to dodge one unit, which is by default the closest one. Reference: https://gitea.wildfiregames.com/0ad/0ad/src/branch/main/binaries/data/mods/public/simulation/components/BuildingAI.js#L292 Snipe a formation by enclosing them When attacking an enemy formation, you can't choose to snipe an arbitrary formation member. The member closest to your unit will always be attacked. You could theoretically surround the enemy formation with snipers, so each sniper will see different "closest member", and achieve certain extent of sniping. To attack you just have to right-click the whole formation and the closest member will be chosen automatically. Reference: https://gitea.wildfiregames.com/0ad/0ad/src/branch/main/binaries/data/mods/public/simulation/components/UnitAI.js#L5407 Shoot farther on turret or mountain Suppose the maximum attack range of a unit (CC, archer, jav etc) is said to be 60m. The actual maximum distance is different when the unit is on mountain or turret. It is calculated using the formula: actual_max_distance = √(max_distance² + height × max_distance × 2) While this formula produces plausible numbers, I don't think it is physically realistic. It is parabolic but it doesn't represent an actual projectile curve. Anyway, what it means is, if you stand higher, you shoot farther (with larger spread though; and spread considers horizontal distance only). If you stand so low, like 30m below enemy, then you can't shoot them at all. The max height (30m) is half the max distance (60m), which is arbitrarily fixed by the 0AD team. All units and buildings are considered equally on ground level (0m) except that outpost is 8m, sentry tower 9m, stone tower 15m, and Han great tower 20m. So stone tower actually shoots as far as √(60² + 15 × 60 × 2) = 73.48m. An archer turreted on wall (roughly 10m tall, different with civs) will shoot at √(60² + 10 × 60 × 2) = 69.28m. What about fortress? Although we see fortress shoots arrows at a height, it is still considered to be on ground level (0m), so the max distance is still 60m. This might have to be fixed. Reference: https://gitea.wildfiregames.com/0ad/0ad/src/branch/main/source/simulation2/components/CCmpRangeManager.cpp#L1387
-
petrabot Hidden map and "fog of war" for Petra AI
stevenlau replied to CheckTester's topic in Applications and Contributions
Seems to be a big thing to implement in 0AD. I am making a new AI, and by using the default mechanics in the code, my AI knows everything on the map. It is theoretically possible to let my AI to restrict himself from seeing the entire world, but that would not be a nice solution because when you watch replay you still don't see the fog of war. Somehow the game engine on the AI part has to be rewrote for that. -
Advanced tips: I am also playing on macOS without a mouse. To play decently you must map some hotkey to function as trackpad click and secondary click, by software such as Karabiner-Elements.
-
I am developing an AI called stevenlauBot. I have only made the game start move. All units go to the tree nearest to CC, cav goes to chicken, either by walking or teleportation, whichever faster. It looks cool! My plan is to make the AI to play standard tactics like how I usually play (only Han). It will be useful to practice 1v1.
-
1250: sword and spear are similar melee units that is useful to make meat shield. 1300: swordmen is good to crack rams. 1350: if you want to go full pop attack with rams at min 13-14, an enemy with swordmen is harder to crush. In this strategy it is common to postpone hack resistance upgrade in favor to earlier attack, but swordmen in enemy is strong in hack attack. 1400: when rushing with melee cav, run if you see spearmen, fight if you see swordmen. I think Iberian having swormen is important to balance out the initial wall defence. If iberian has spearmen, it becomes almost impossible to rush them. 1500+: thoughts?
-
After Han captures a Persian CC, a hidden unit becomes available in that CC: Han Cavalry Crossbowman. This unit is never mentioned in Structure Trees.
-
I have been playing hundreds of games of 1 vs 5 very hard aggressive AI. I think I have reached a bottleneck. I am sharing my findings and see if other players have played similarly with different strategies. Game setting: My civ: Han AI civ: Mauryas (for their archers and champs) AI mode: Very hard, aggressive Map: Mainland normal 1 vs 3 is quite practical. If played well, one can use sword cav to run around the map and kill all units quite quickly. 1 vs 4 is still practical. Use sword cav to kill two of them, use spearman to defend the other two. Boom up and attack with full upgrades + heroes + champ cav. For 1 vs 5, if played really well, one may use sword cav to kill one neighbour. The other four AI will send reinforcements there, and your sword cav can kill them conveniently as well. Use spearmen (with sword cav) to defend the CC. Slowly boom up equally with spearmen and sword cav, and attack with full upgrades + heroes + champ cav. Then I tried the same strategy to play 1 vs 5 Macedonian and I found that sword cav is super weak towards pikemen. When against < 5 spearmen, I can often use 20 sword cav to attack head on. However, when fighting with pikemen, they are like invincible meat shield. What's worse, Macedonian AI seems to attack very early at minute 6 when I have only very few infantry, while Mauryas usually attack after minute 8. On the other hand, playing 1 vs 5 with defensive strategy is super difficult. While you are booming with infantry, 5 armies will attack you. It takes so long to kill the pikemen. They ruin both your army and economy, and you just couldn't recover quick enough. It appears that Han vs 5 Macedonian very hard aggressive AI is impossible. The bottleneck is pikemen. Any good strategies to fight pikemen?
- 1 reply
-
- 1
-
-
A27 Disadvantageous farming tech upgrade time cost for Han
stevenlau replied to stevenlau's topic in Help & Feedback
Side tracking a bit. The two replies above mentioned "diminishing returns" and "farm faster". These are based on the rule saying "assigning multiple farmers on a field would make them farm less efficiently". While I do see this description in the in game Structure Tree, in theory all farmers should farm at a rate of 0.5 grain per second. Is the "diminishing return" an actual rule in the game? If so, to be precise how is the diminishing calculated? -
Problem: I installed A27 on 2nd Feb using homebrew on macOS M1 and played for 2 days. I didn't install any mod. On 4th Feb, when I launch 0ad it suddenly says "The application is broken. Please move it to Trashbin". Fix: I then downloaded the official A27 .dmg and installed that way. Now it works again.
-
Problem: As in the new release of A27, the farmstead farming tech upgrade time costs are 40s, 50s and 60s respectively. However, for Han they become 50s, 60s and 70s respectively. This is a disadvantage for Han. Cause: In early revisions of A26, the bonuses for farming tech in Han was +25% (in contrast with +20% for other civs), justifying the extra time cost. However, the bonuses were later standardized to +20%. Consequently, the extra time cost becomes redundant. Relevant commit: https://gitea.wildfiregames.com/0ad/0ad/commit/b4155900d3356bd62af7061b0890e7744332ba5e
