Difference between revisions of "AI War:Do Shots Miss"

From Arcen Wiki
Jump to navigation Jump to search
Line 40: Line 40:
  
 
A few notes about the above:
 
A few notes about the above:
 +
* IMPORTANT:  For purposes of the above, the attack range of ships is reduced by 1000 from what is shown in the interface stats for ships.
 
* PenetrateHighShields is a reference to a special ability that some ships have, which lets them go through shields that are incredibly high (over 100000) that cause a miss for all other ships.  This is how shield bearers used to work, but no ships currently use that logic.
 
* PenetrateHighShields is a reference to a special ability that some ships have, which lets them go through shields that are incredibly high (over 100000) that cause a miss for all other ships.  This is how shield bearers used to work, but no ships currently use that logic.
 
* MinHitPercent is a modifier that some ships have, and it basically just means that if it has any chance at all of hitting the target, it will have at least that minimum chance.  So if, for instance, a cruiser would normally have a 5% chance of hitting a target, it will instead have a 50% chance of hitting its target because of its MinHitPercent value.  This is useful for ships with long ranges or slow reload times (or both), and is pretty much unused except in those cases.  Otherwise the relevant ships just miss far too much to be effective at any reasonable range, which is after all the point of giving them a higher range in the fist place.
 
* MinHitPercent is a modifier that some ships have, and it basically just means that if it has any chance at all of hitting the target, it will have at least that minimum chance.  So if, for instance, a cruiser would normally have a 5% chance of hitting a target, it will instead have a 50% chance of hitting its target because of its MinHitPercent value.  This is useful for ships with long ranges or slow reload times (or both), and is pretty much unused except in those cases.  Otherwise the relevant ships just miss far too much to be effective at any reasonable range, which is after all the point of giving them a higher range in the fist place.

Revision as of 13:34, 8 November 2009

Do Shots Miss Sometimes?

Q: I notice that a lot of the time, a shot will hit a ship, but no damage will be dealt. This seems to happen a significant amount of the time, and is frustrating because I can see the shot hit the ship, it makes the little green wave animation.

A: Yes, shots can miss -- the sign of a shot missing is that little green wave animation, which is the target's shields absorbing the shot. Even ships with zero shields have a minor chance of this occurring, depending on the attack range of the ship that fired the shot and the distance between the shooter and the target. Depending on these factors and how high the shields of the target are, ships can miss a LOT. When you have ships selected and you hover over an enemy ship, it shows you the percent chance likelihood of your hitting that enemy, along with how much damage will be dealt. If you have multiple ships selected it shows you the range of damage, and the worst hit percent chance.

Here's the basics of how all this is calculated. All shots have a certain amount of energy, which is dependent on the attack range of the ship firing them. So, sniper shots have practically unlimited energy, while tank shots have almost none. Depending on the distance between the shooter and the target at the time the shot is fired, the shot will have a certain amount of energy remaining when it reaches the target (regardless of whether the target moves). If that remaining energy is higher than the shield level of the target, then the shot will hit. If it is lower, then it will miss. There is also a random component to whether shots hit or not -- you can think of this as shield "frequencies" as in popular sci-fi shows. If the frequency happens to match just right, then even low powered-shots can penetrate high shields.

Shots don't actually do their damage until they hit the target, and if the target moves faster than the shot (or teleports, or changes planets), it is possible that the shot may wind up out of range of its target. When that happens, the shot will simply disappear.

Lastly, if the range between the shooter and the target is very low, there is a minimum of a 5% chance of the shot hitting its target (this doesn't apply for shots which are countered by the target, or which the target is immune to -- there is always a 0% chance of those hitting). So, if your shots are being blocked too much by an enemy's shields, the solution is simple: move closer. Note that if you manually tell ships to attack a target, they will automatically close distance to the target until they have a good shot at it.

IMPORTANT: Based on the above, note that this means that shields on ships can drastically reduce the effective range of ships. So when you are looking at the range of ships such as turrets (by holding Z), you should note that is the maximum effective range assuming the target has no shields. The hit chance at the edge of that range may be quite low, and it might actually have a 0% chance of hitting some ships at the outer ranges, depending on their shield levels. The ranges are not shown differently because their effectiveness varies by target. If you want to see what their chance of hitting a given target is, just select the attacker and then hover over the target -- the hover tooltip will show not only how much damage will be dealt, but what the percent chance of a hit is.


For Those Interested In The Actual Math

This is the general algorithm that the game runs through to determine a hit chance for any given shot against any given target. This is run at the time the shot is fired. The result is an integer between 0 and 100, with 100 being a definite-hit, and zero being a definite-miss, and anything in between being subject to a random check (Rand(0,100) < hitchance). So here's the pseudo code logic (with "firing" referring to the attacking ship that is firing the shot, and "target" referring to the ship being hit or missed):

  • If firing has attack power zero, return 0.
  • If target is immune to firing shot type, return 0.
  • Declare baseRange = dist between center of target and firing.
  • If attack range of firing <= 0 (melee ship), then return the following:
    • If firing and target overlap their positions return 100, otherwise 0.
  • If baseRange > attack range of firing, return 0.
  • Declare adjustedRange = baseRange + ( firing.FiresThroughShields ? 0 : target.ShieldRating ) - firing.AttackRange
  • If adjustedRange <= 0, return 100
  • Declare percent = 100 - ( adjustedRange / 10 )
  • If percent < 0, do the following:
    • Declare radii = size radius of firing + size radius of target
    • If baseRange < 500 + radii, do the following:
      • if target.ShieldRating > 100000 && !firing.PenetrateHighShields, return 0 (shields are too high, cannot hit)
      • else return 5 (if are very close, then always a 5% chance to hit if shields are not too high)
    • Else If baseRange < radii + attacking.AttackRange, then:
      • percent = ( attacking.PenetrateHighShields ? 5 : 0 )
    • Else percent = 0
  • If firing.MinHitPercent > 0 && percent >= 5 && percent < firing.MinHitPercent, percent = firing.MinHitPercent
  • return percent


A few notes about the above:

  • IMPORTANT: For purposes of the above, the attack range of ships is reduced by 1000 from what is shown in the interface stats for ships.
  • PenetrateHighShields is a reference to a special ability that some ships have, which lets them go through shields that are incredibly high (over 100000) that cause a miss for all other ships. This is how shield bearers used to work, but no ships currently use that logic.
  • MinHitPercent is a modifier that some ships have, and it basically just means that if it has any chance at all of hitting the target, it will have at least that minimum chance. So if, for instance, a cruiser would normally have a 5% chance of hitting a target, it will instead have a 50% chance of hitting its target because of its MinHitPercent value. This is useful for ships with long ranges or slow reload times (or both), and is pretty much unused except in those cases. Otherwise the relevant ships just miss far too much to be effective at any reasonable range, which is after all the point of giving them a higher range in the fist place.


AI_War:Fleet_Command