Results 1 to 30 of 33

Thread: Missile Accuracy: A Mystery

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Missile Accuracy: A Mystery

    So I was curious how missile weapon accuracy worked, so I started messing around in the descr_projectile.txt file.

    It quickly becomes obvious that the "accuracy_vs_units" stat is what controls accuracy, with lower numbers being better, and 1.0 being the worst. (The only thing funnier than setting a bunch of longbowmen to perfect accuracy, is setting them all to 1.0 and watching them shoot at the moon. ^_^)

    The thing that totally dumbfounds me is that many of the basic projectiles have the "accuracy_vs_units" line commented out, and some lack it entirely. These are common projectiles such as bodkin_arrow (English longbowmen), and pistol_bullet (Reiters).

    Adding the accuracy line to these weapons obviously works, but how on earth is their accuracy being determined without this line? In my testing, they seem to perform close to as if they had a 0.5 accuracy, but I've hardly done exhaustive testing.

    Anyone have a clue how this is working?

  2. #2

    Default Re: Missile Accuracy: A Mystery

    I'm sorry not to answer directly to your question, but i must point out that only Scot Guards have bodkin_arrow as projectile and french mounted archers have bodkin_horse or something.
    Changing projectile type changes a lot for a unit.
    On a side note, i realised that giving to mounted xbows the same type of projectiles as naffatun will allow them to throw bombs with their xbows. But it seems their range is capped by something other than their range stat in the EDU.
    Is there anything in the descr_projectile.txt file ?

  3. #3
    Member Member Philbert's Avatar
    Join Date
    Jan 2007
    Location
    The Netherlands
    Posts
    144

    Default Re: Missile Accuracy: A Mystery

    Well I work in software myself, and it is quite usual, and good practice even, that for every setting possible in the config files you create a hardcoded default value for when the setting is absent from the config file.
    It makes your software more robust to dislexic users.

    Also good practice is then to include the item commented out in the config file depicting that default value.
    Hebban olla uogala nestas bigunnan hinase hic enda thu

  4. #4
    blaaaaaaaaaarg! Senior Member Lusted's Avatar
    Join Date
    Feb 2005
    Posts
    1,773

    Default Re: Missile Accuracy: A Mystery

    My guess as well is that there is a default accuracy value for missiles if there is no accuracy_vs_units line in the projectile file.

  5. #5

    Default Re: Missile Accuracy: A Mystery

    Makes sense; this is how Windows itself works. Ever notice then when you want to change a Windows setting, you usually ADD a value to a registry key rather than MODIFY an existing one? It's because in absence of it the application default comes into play.

    I see no reason for MTW2 to work differently.

  6. #6

    Default Re: Missile Accuracy: A Mystery

    Quote Originally Posted by zerathule
    I'm sorry not to answer directly to your question, but i must point out that only Scot Guards have bodkin_arrow as projectile and french mounted archers have bodkin_horse or something.
    Changing projectile type changes a lot for a unit.
    On a side note, i realised that giving to mounted xbows the same type of projectiles as naffatun will allow them to throw bombs with their xbows. But it seems their range is capped by something other than their range stat in the EDU.
    Is there anything in the descr_projectile.txt file ?
    Actually, according to the export_descr_unit.txt file (which would be where to look), Longbowmen, Yeoman Archers, Sherwood Archers, Scots Guard, Retinue Longbowmen, Dismounted French Archers, Welsh Longbowmen, and Free Company Longbowmen all use "bodkin_arrow"s.

    French mounted archers use "cav_bodkin_arrow".

    I think, and I haven't messed with this at all, that the velocity of the projectile directly effects its maximum range. Try changing these in descr_projectile.txt and see if it helps.

    On topic, a default accuracy value was what I figured, too. Now I just have to test, test, test, to see if the default is better or worse than the 0.05 that basic arrows are assigned.

    Thanks for everyone's input.

  7. #7
    Masticator of Oreos Member Foz's Avatar
    Join Date
    Dec 2006
    Posts
    968

    Default Re: Missile Accuracy: A Mystery

    Quote Originally Posted by zerathule
    On a side note, i realised that giving to mounted xbows the same type of projectiles as naffatun will allow them to throw bombs with their xbows. But it seems their range is capped by something other than their range stat in the EDU.
    Is there anything in the descr_projectile.txt file ?
    Yes, there is. In the descr_projectile file, for every missile type, there are entries that describe its flight. A limit for upward firing angle, downward firing angle, and a velocity amount or range. In this case, the nahptha_bomb projectile has min -60 degrees, max 70, and velocity 30 (which means it always is launched at 30 m/s). Using typical range equations from physics, you can then determine that its maximum range (always when fired at 45 degrees) is ~90 meters. That means that no matter what you change in the EDU, you'll never get the unit to fire farther than that on flat ground, because the physics of the projectile do not allow it. The easiest way to fix this would be to up the velocity in descr_projectile, which then increases the missile's maximum possible range.

    So the long and short of this is that if you're messing with projectiles, you have to make sure both the EDU and the appropriate descr_projectiles.txt entry allow for the projectile to fire the maximum distance you want. Ideally the two ranges are nearly identical, however the EDU entry could be shorter to account for a limit imposed by the user of the weapon. For instance a cannon crew might be trained to know they can't hit anything outside 300 meters even though their cannon can fire 600, in which case it makes sense to have the EDU at 300 so they simply won't fire past that distance, even though they technically could do so with the weapon.


    See my Sig+ below! (Don't see it? Get info here)

  8. #8

    Default Re: Missile Accuracy: A Mystery

    Quote Originally Posted by Foz
    In this case, the nahptha_bomb projectile has min -60 degrees, max 70, and velocity 30 (which means it always is launched at 30 m/s).
    So if Naffatun were limited to a 40 m range on flat ground (the default), does that mean it can't fire at an angle higher than ~13 degrees (assuming no obstructions and stationary target)?

    If so, does that mean a Naffatun's range on high ground equals how far he can throw at ~13 degrees and 30 m/s?

    Also, how does the game take into account various other factors like rain, the slope of the ground and the height of the soldier's weapon?
    Last edited by Miracle; 06-14-2007 at 04:38.

  9. #9
    Masticator of Oreos Member Foz's Avatar
    Join Date
    Dec 2006
    Posts
    968

    Default Re: Missile Accuracy: A Mystery

    Quote Originally Posted by Miracle
    So if Naffatun were limited to a 40 m range on flat ground (the default), does that mean it can't fire at an angle higher than ~13 degrees (assuming no obstructions and stationary target)?
    Looks like it. If you assume obstruction, then it actually couldn't fire at all. See, if an angle similarly close to 90 degrees were also available (i.e. 77 in this case) then it would have the option of using <=13 and >=77 which would allow high arching shots to go over obstructions if needed, but as nothing in the second range is a legal value, only 13 degrees or less can be used. Anything else in the valid range (13, 70] causes a 30 m/s shot to go further than 40 m, and therefore is not ever able to be used due to the EDU limitation.

    If so, does that mean a Naffatun's range on high ground equals how far he can throw at ~13 degrees and 30 m/s?
    This opens a can of worms. The problem is, I am uncertain as to the exact meaning and implications of the EDU's range setting. It could be a horizontal bound for targeting purposes. OTOH it could be an exact distance measurement between firing point and target. In the first case, the projectile can make a longer flight, but its actual horizontal range is no longer since it will be bounded in the target's horizontal direction at 40 meters of motion regardless of vertical travel. In the second case, height would actually be a disadvantage, as any vertical displacement would mean a longer hypotenuse on the distance triangle, actually taking away range the higher the firing unit was. I rather doubt that's how they've implemented it though. I'm sure there are other possibilities too, but as far as I can tell no possibility produces the correct range increase from an elevated firing position, because the EDU range values are generally arbitrarily shorter than the physical limitations on the projectiles. The result is that no matter how it is implemented, height-advantaged units gain no extra range because the physics advantage is simply cut off by the EDU's lower range requirement.

    So in-game the Naffatun's range on high ground is probably identical to its range on flat ground, or could actually be lower. From what I can piece together about the EDU's range stat, they'd actually have to fire at a lower angle than 13 degrees if elevated above the target, because a similar range limitation will still exist from the EDU.

    I suppose one of the other possibilities for the EDU range listing is that it could be the limitation assuming flat ground, in which case you would be correct that a shot at ~13 degrees would give their best range shot then. It should be noted that that's likely the most positive outlook, and several less favorable possibilities (some above) exist.

    Also, how does the game take into account various other factors like rain, the slope of the ground and the height of the soldier's weapon?
    Rain I believe simply has a given negative impact on projectile effectiveness. There's a toggle that controls whether or not a projectile is affected by rain, and since it doesn't list degrees, I'm inclined to think that any that are affected are modified by a given constant amount. This is further reinforced by noticing that projectiles in rain do not appear to lose accuracy, but certainly seem to kill far less men when they hit them.

    Slope as far as I'm aware is not considered, unless it is possibly taken into account w/ respect to weapon orientation. That really depends on whether or not the projectiles are taken w/ respect to the firing weapon, or w/ respect to the coordinate system. In the former obviously slope would directly shift the projectile's range of possible motion and flight path, while in the latter it would have no effect and every shot would be essentially the same as one from a flat level piece of ground. It's sort of an interesting question, since men generally remain directly upright w/ respect to gravity, where a cannon would actually lay along the terrain... so in reality men should use the second method and always act like they are level, while equipment would use the first that accounts for the facing the terrain would cause.

    Lastly the physics engine in the game seems very well done, so I will say with 95% certainty that the projectile is tracked from the height the soldier is supposedly firing it from. In the case of many of them, that would mean you have projectile motion beginning from about the height of a man, not ground level, and from observing the game engine it sure looks like the height of the weapon is entirely accounted for in the motion of projectiles.


    See my Sig+ below! (Don't see it? Get info here)

  10. #10

    Default Re: Missile Accuracy: A Mystery

    Thanks for the detailed response.

    The EDU's range setting is most likely the first case in that it restricts the range at which a unit can begin their firing animation. I've seen Naffatun throw at angles higher than 13 degrees, but only when their target is moving away from them and the Naffatun had already begun their throwing animation. In this situation their range is bounded only by the game physics; if a heavy cavalry unit traveling away at a speed of 7 m/s were targeted at exactly 40 m away by a Naffatun unit, the Naffatun could theoretically reach their maximum physical range of ~90 m if their firing animation took about 3 seconds:

    firing_animation_time = 50/(415/60) - 90/30/sin(45) = 3

    That means crossbowmen, who by default have a low firing angle and a long reload time, could reach artillery-like ranges if they targeted a routing fast mover.

    Quote Originally Posted by Foz
    The result is that no matter how it is implemented, height-advantaged units gain no extra range because the physics advantage is simply cut off by the EDU's lower range requirement.
    I'm fairly sure the game modifies it in real-time based on some formula that involves Δy (height above datum plane). It would probably look like this:

    Range = DefaultRange + (1/g)*(v*cos(θ)*sqrt((v*sin(θ))^2 + 2*g*Δy) - 0.5*sin(2*θ)*v^2)

    Where θ = default firing angle at max range on flat ground against stationary target

    This is assuming the soldier is firing upright.

    Since soldiers on a hill will fire at a clearly positive angle when a unit reaches its range, I do not believe the EDU range is a hard-set limit. Otherwise, they would have to fire at a lower angle as you suggested.

    If the game portrayed physics as well as you say, then "slope-hugging" missile units like artillery and missile cavalry could theoretically reach very long ranges. They would have to be just before the crest of a hill such that they are facing up at an angle equal to 45 - θ. The height advantage of the hill combined with a starting firing angle of 45 degrees to the horizontal should increase their range dramatically beyond the default EDU value. When you consider that the projectile comes down at an angle near or close to the vertical slope angle of the hill, this becomes a very good battlefield tactic.
    Last edited by Miracle; 06-14-2007 at 08:15.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Single Sign On provided by vBSSO