Jump to content
  • Sign Up

Ranged Attack

Recommended Posts

Hey there,

I'm curious on how ranged attacks work and want to ask if there's any insight on that.

There is some old explanation from a developer I link here, but it doesn't get too much into the variables.


It's really complicated and it was complicated in AOK too, but in a different way. These models were both implemented just because they look cooler when arrows sometimes miss.

In AOM, the first shot usually has bad accuracy (say 50%). The accuracy is also worse at range. This was not done to encourage you to move your units closer, but because it looks dumb when units miss each other at point blank. Each shot after the first shot on the same target also gets a huge bonus, so that by the second or third shot you have a 100% chance to hit. This means you are often better off letting your archers pick their targets than trying to pick targets for them, because you may force them to waste their more accurate shots. Also, because the bonus is so high for secondary and subsequent shots, you are better off fighting at range and not wasting time to move your units up close.

Missed shots have a chance to strike another target, but they do less damage to unintentional targets. (This was not the case in AOK, which let Trebs be much better against massed archers than we intended.)

There is also a concept of what we call tracking, or whether or not you can anticipate a moving target and fire a little ahead of him in order to hit. Generally cavalry and some fast infantry are too fast to be hit by most ranged units. Siege weapons will miss almost any moving target. Heroes tend to have very good tracking. There is also an improvement to make your buildings track better, which is key to stopping raiding cav (who are already pretty pierce resistant).

Finally, the determination of whether a shot will hit or miss is made when the shot is fired. This means that you can't just dance a unit out of the way of an incoming missile. Micromanagement has its place in our games, but it should be secondary to strategy.

BTW, there is no friendly fire for any unit in AOM (even siege), though some GPs will damage friendly units, but cause less damage than they do to enemies.

By ES_DeathShrimp posted here: http://aom.heavengames.com/cgi-bin/forums/display.cgi?action=st&fn=1&tn=7524&st=1#post2


So here we got the values from the Centaurs normal attack in the protox:

		<action name="RangedAttack">
			<param name="MaximumRange" value1="12.0"></param>
			<param name="Damage" type="Pierce" value1="12"></param>
			<param name="Rate" type="All" value1="5.0"></param>
			<param name="DamageBonus" type="MythUnit" value1="2"></param>
			<param name="Accuracy" value1="0.80"></param>
			<param name="MaxSpread" value1="5.0"></param>
			<param name="SpreadFactor" value1="0.25"></param>
			<param name="TrackRating" value1="5.0"></param>
			<param name="UnintentionalDamageMultiplier" value1="0.3"></param>
			<param name="AttackAction"></param>
			<param name="AimBonus" value1="15"></param>
			<param name="DamageBonus" type="Hero" value1="0.25"></param>
			<param name="HeightBonusMultiplier" value1="1.25"></param>

A lot of values are pretty self-explanatory. So I'll add some questions:

- What is "Rate"? Attack speed is defined by the anim, so I don't get what that does. :/

- "Accuracy" is probably the first shot accuracy. What is the increment for accumulative shots?

- "MaxSpread" and "SpreadFactor" are probably for the missing shots/unintentional damage. Also I guess it uses the tiles like "MaximumRange" does. (confirm?) But this one seems not too important. However if put it on 500, is the chance to hit someone else really small or is there some fix percentage? What's the "SpreadFactor" for?

- "TrackRating" has to do with the target speed I guess. How does it work? Like if the Centaur tries to hit something at 5.1 speed, does he get worse initial accuracy?

-  "AimBonus" - What is that? By chance the accuracy increment for accumulating shots?

- "HeightBonusMultiplier". I believe that was a 25% bonus if you have high ground. However someone said that it isn't important, because it needs to be like real high ground. When does this kick in?

Link to comment
Share on other sites

I just saw that the Mummy had this as ranged attack:


        <action name="RangedAttack">
            <param name="MaximumRange" value1="12.0"></param>
            <param name="AttackAction"></param>
            <param name="Rate" type="All" value1="1.0"></param>
            <param name="Damage" type="Pierce" value1="12.0"></param>
            <param name="DamageBonus" type="Hero" value1="0.25"></param>
            <param name="DamageBonus" type="MythUnit" value1="3"></param>

What's with all the missing values? Does it just have perfect accuracy and doesn't need spreadfactors and such?

Medusa has another value:


            <param name="AccuracyReductionFactor" value1="1.5"></param>


Link to comment
Share on other sites

I used to think "Rate" was a damage multiplier but that is obviously not the case. At some point, someone told me it had to do with attacks against frozen units but I've never tested this.

"Accuracy" has something to do with the number of misses before a hit. As DeathShrimp writes, ranged shots are precalculated in AoM so you can't dodge projectiles Matrix-style like in aoe2 (you can actually turn precalced hits off in game2.0.cfg if you are so inclined). Apparently, the accuracy param gives a range for how many misses before you start hitting every shot. Odysseus has low accuracy, so he can't hit the side of a barn door from 1 meter away for the first ~3 shots.

At one point, I had a much better understanding of spreadfactor and maxspread. I feel like one of them is actually similar to the accuracy param and the other handles the dispersion of the shots. What I do know is that these params are important for every shot the unit takes, whereas accuracy only applies for the first few. I have a Fire Catapult unit that uses this mechanic and is have Accuracy=0.7, MaxSpread=24, SpreadFactor=0.2. I remember only that it took a long time to get these numbers exactly right.

TrackRating somehow relates to hitting moving targets but mathematically it's a mystery to me. No idea about AimBonus or AccuracyReductionFactor. I would also be interested in knowing the math behind heightbonusmultiplier.

Link to comment
Share on other sites

I can a bit help with your very last question, the math behind the HeightBonusMultiplier. It works just like another DamageBonus Multiplier.

It's actually part of the standard aom attack formula, the k-elev entry: http://ageofempires.wikia.com/wiki/Attack#Age_of_Mythology

Basically even in close combat you'd get +25% on your attack if you have the height advantage, and -25% on your attack if you have the height disadvantage. So I'm not sure if the entry on the centaur actually does anything or is just overwriting the standard value for every unit with the same value.

This however still doesn't answer when it applies. (And maybe that's what you asked about to begin with xD) But measuring height in aom is a bit weird to accomplish anyways.

Link to comment
Share on other sites

That formula is missing the effects of animation length. I have included these in the one I posted on AoMH:

DPH = DPS * (1 - armor) * (animation length) * (anim length multiplier)

where I've condensed all bonus multipliers of any sort (proto or techtree based) into DPS.

I have tested the HeightBonusMultiplier and found that it is indeed all or nothing. But not in the way we thought. There seems to be an arbitrary elevation difference at which it kicks in. I have attached a picture of the approximate elevation at which it kicks in.

The test involves two unupgraded Toxotes. Under similar elevation, they do 5 or 6 DPH (rounded from 5.525 = (1-0.18)*(6.5), interestingly, it seems to alternate between 5 and 6 on each shot but I'm not sure if this is accidental or by design). At or above the elevation difference shown in the picture, the higher one does 7 DPH (rounded from 6.90625 which is +25%, there may have been some 6's in there as well but almost all the shots do 7) and the higher one wins every time. Increasing the elevation beyond this does not change anything.

The next step is to measure elevation in units of editor tiles using a custom ruler model, then check this against the elevations specified in cliffheights, etc. and see if that is also the unit the game uses. If not, I can adjust the scale on the ruler. Then, with a number in hand for the critical elevation, we can run a search for it and see if it's modifiable in the configs or elsewhere (although I suspect it's hard coded). As it stands, the HeightBonus is barely noticeable in game. I may be wrong, but I don't think competitive players even consider it. It is certainly considered in aoe2 so perhaps the multiplier should be increased on a per-unit basis even if we can't decrease the cutoff elevation. I suspect aoe2 has a more sophisticated system where the multiplier is based on the relative elevation (which is what I was hoping for AoM).

HeightBonusMultiplier Test Setup.jpg

Edited by Callistonian
Link to comment
Share on other sites

  • Age of Mythology Staff

From what i remember, the height dmg multiplier kicks in when a unit is 5 height above the target.

im not sure how much 1 height in reality is(1 tile?), but i made the craters in for example the arctic craters map -5 depth, which could be a good visual point to get a feel for what the appropriate height is.

Link to comment
Share on other sites

@Callistonian Was there a height penalty for the other guy?

@Hagrit Right, there is actually some height measurement. Also in scenarios the world height can be set to the minimum and put up by 5 then, and lowered to minimum on an area to test for heights.

However I hoped you could tell us more on the workings of "TrackRating" and "Accuracy" and so on. :D

Link to comment
Share on other sites

  • Age of Mythology Staff

TrackRating defines up to x speed the target can be hit normally, if the track rating is lower than the units movement speed, it will be a 100% miss.

Accuracy is abit shady of a topic, i think its got something to do with the first initial (highest chances to miss) shots. something like priests with max accuracy will never miss (aside from track rating).

Maybe calli knows more? who knows eh


what im most curious about is aim bonus, truely have no idea what that really does.

Link to comment
Share on other sites

I can answer a few things alluded to above, and offer a few more musings on the subject.

The height bonus is definitely pretty impractical, unlike AoE2's. The threshold to get the bonus means you have to be roughly the height of a sentry tower above your opponent, which makes it fairly unusuable in most standard RM settings. I don't know of a way to measure real height units except maybe via RM script: kbUnitGetPosition seems to always consider the Y coord of any unit to be 0, even for flying units. The only case I haven't tested is ground units sent flying by throw/buck/gore/shockwave, but that wouldn't be terribly practical as a height ruler even if it worked.

The game internally tracks health to greater than integer precision: XS scripts can return and output this in more accurate form (kbUnitGetCurrentHitpoints returns a float), but the UI rounds it. I'm not sure exactly what rounding method is used by the interface, but for this reason I've always used custom AI in my investigations into damage and DPS, simply because it can measure damage and time intervals far more accurately and easily than doing it by hand.

On a related note, a few years ago I tried to make a script to assess the accuracy increase conferred by the number of consecutive shots by determining hit/miss by calculating the intervals between inflicting damage. I seem to remember having some success, but due to the massive amount of variables at play it's hard to fit it to anything particularly mathematical. Oh, and another obvious factor involved in accuracy is the size of the target: certainly there aren't cases where the humble chariots outrageously miss something as big as a TC, and it's not clear what it is about various buildings which make missing impossible. It's possible this is related somehow to the collision size, or simply that ranged attacks vs buildings never miss. The obvious starting point is probably comparing accuracy of catapults against towers/wall chips and catapults, as the collision size of them is probably fairly similar.

For what it's worth, AoE2's system is very simple: if you're any higher than your target, you do more damage (and I think maybe take less?) - but it also affects melee units fighting up hills. I'm fairly sure the amount of height increase doesn't matter either. In any case, it's pretty evident that ES went down a different route for height wars in AoM.

Variables that might affect accuracy:

Something to explain why archers can't miss large buildings:
- Target identity (IE: Unit/Building - which proto tags cause this? Could be anything from Building, BuildingClass, LogicalTypeUnitsNotBuildings, or others...)
- Potentially collision area
Distance to target
- Is this % of max range, or real distance?
Target's movement rate vs attacker's track rating
Track Rating (does this do anything to attacks vs stationary units?)
VolleyMode (units with multiple projectiles seem to have this tag)
What determines the unintentional target that is hit when an attack misses?
How is the accuracy of additional projectiles determined? It's clearly a lot lower than the primary ones... It's unclear exactly how dangerous towers/TCs/fortresses are, and how much empowering does to them.
What actions reset the consecutive shot bonus?

All in all, a lot of questions. Certainly if there's interest I could pull together AI scripts for investigating this stuff as I have done with other things, but I'm unsure exactly what to do, and how relevant it might be to play. My grasp of statistics isn't good enough to understand how you might try to fit multivariate data to some kind of equation, or I would have done this already, as well as address questions like "how much does handaxe REALLY benefit woodcutting due to carry capacity increase" and "when should you build a new storehouse closer to your wood". Accuracy in particular really is a mess due to the masses of variables involved, but I can probably try to see to some basic empirical questions or provide experimental data with the help of a few scripts if it'd help someone.

I'm not currently convinced there's a huge amount to gain with regard to actual play from better understanding accuracy. Knowledge is all well and good, but if it's not going to answer real questions that impact play then I'm not sure it's worth the effort to unravel any interactions between all these variables. The kind of questions I see are:

How much does pharaoh empowerment/the blessed construction oversight affect building damage against various units?
Does forcing a ranged unit to move, or moving out of building range reset the consecutive attack count? This could have micro implications.
Is it worth moving certain ranged units closer to their targets in the name of accuracy? Classical Greek heroes and gastraphetes come to mind here.
Just how much damage do towers/TCs/fortresses put out at various distances?
How much of gain in efficiency is it to task lots of <insert various archer units here> to on one tanky unit like a Greek hero to minimise wasted shots/overkill?

Edited by Loggy
Link to comment
Share on other sites

15 hours ago, Loggy said:

How is the accuracy of additional projectiles determined? It's clearly a lot lower than the primary ones...

There is a "VolleyMode" tag on the RangedAttack of Chieroballistas and Towers. (Whatever that does)

Link to comment
Share on other sites

  • Age of Mythology Staff

i think volleymode is just so that the arrows shot at the same time, dont follow the same trajectory than the first.

also secondary shots (or more) do not follow track rating, and as such much more often just miss. (a tc with 10/10 tracking always misses 1 of the arrows on a moving target)

Link to comment
Share on other sites

  • 2 months later...

Yesterday we found out a bit about some of the values:

  • Accuracy 0.8 means the first shot has a chance to hit of 80%
  • AimBonus of 15 means every shot afterwards on the same target gets +15%. So with Odysseus it's a 80% hit chance for the first shot, 95% for the second and 100% for the third and every shot after that
  • MaxSpread (I think it was this one) tells you that missed shots can spread everywhere around the target in a distance of 5 tiles. So with a low MaxSpread you're more likely to still hit the target on accident when missing
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...