Page 1 of 1

[2.0.14] Artillery overkills biter nests

Posted: Sun Nov 03, 2024 1:50 am
by Nova
My artillery turrets shoot two times at biter nests despite one shot already killing them.
Current evolution is around 0.7 on Nauvis, shells do 1000 explosion and 1000 physical damage, nests have around 1780 health, 5 explosion resistance and 2/15% physical resistance - therefore should (and do) die in one shell, but my artillery turrets fire two times at the target.

Expected result should be one normal shell shot fired until nests reach 1843 health (as the damage calculation should be 1000-5 + (1000-2)-15% = 1843.3 damage for normal quality artillery shells) and two shots after that until the next threshold.
What I have tested:
  • reduce the evolution to 0.69, biter nests' have 1714 health - artillery only fires once on nests.
  • reduce the evolution to 0.695, biter nests' have 1734 health - artillery only fires once on nests.
  • reduce the evolution to 0.7, biter nests' have 1754 health - artillery fires twice on nests, but one shot already kills.
  • raise the evolution to 0.74, biter nests' have 1923 health - artillery fires twice on nests, and the second shot kills.
... not sure what bug is at hand here. My first idea was that the damage prediction wasn't properly calculating the different damage types and therefore applying the 15% reduction to physical and explosion damage, but then the artillery should fire twice at 1734 health already, so that's not the cause.
I have not tested this behavior for other attacks like rocket turrets or railguns.

I play with mods, but did deactivate all of them except Space Age for this test.
Log should not be needed, but here it is:
factorio-current.log
(15.75 KiB) Downloaded 12 times

Re: [2.0.14] Artillery overkills biter nests

Posted: Sun Nov 03, 2024 1:57 am
by boskid
Thanks for the report. There if usually a 5% overkill fraction to account for entities healing and health increases due to pollution. It looks like your (or enemy) spawners are in exactly that spot where one shoot is enough but a second projectile is fired to make sure.

Re: [2.0.14] Artillery overkills biter nests

Posted: Sun Nov 03, 2024 2:22 am
by Nova
Thanks for the info. Did already think about some kind of "prediction tolerance", but couldn't find anything about that.
The overkill fractorio fraction would explain that: 5% less of the assumed damage of the shell is 1843.3 -5% = 1751, which is slightly less than my tested threshold of 1754.

Now you guys have to decide if that overkill fraction of nearly 100 health is okay or too high. :mrgreen:

Re: [2.0.14] Artillery overkills biter nests

Posted: Sun Nov 03, 2024 2:35 am
by boskid
I am going to say its a not a bug.

In 1.1 this fraction was hardcoded 10%. In 2.0 it is exposed on the prototype as EntityPrototype::overkill_fraction (i tried my best to come up with obvious name) with a default of 0.05. Some entities have it increased (demolishers to 20% due to extreme regen [116045], asteroids reduced to 1% due to lack of regen). This fraction also works as a safety margin for numeric reasons.

All of this is because of simplified nature of the damageToBeTaken predictor, regen being present, health increasing due to pollution (for enemy spawners at least) and the fact that projectiles take time between being shot and hitting the target. If entity has overkill_fraction of 5%, then if it has 10 health points remaining out of 2000, then margin is 2000*5%=100, if projectile deals 109 damage or less then a second projectile will be fired. If it deals 110 or more then only one will be shot.

Re: [2.0.14] Artillery overkills biter nests

Posted: Sun Dec 08, 2024 2:45 pm
by Hares
boskid wrote: Sun Nov 03, 2024 2:35 am I am going to say its a not a bug.

In 1.1 this fraction was hardcoded 10%. In 2.0 it is exposed on the prototype as EntityPrototype::overkill_fraction (i tried my best to come up with obvious name) with a default of 0.05. Some entities have it increased (demolishers to 20% due to extreme regen [116045], asteroids reduced to 1% due to lack of regen). This fraction also works as a safety margin for numeric reasons.

All of this is because of simplified nature of the damageToBeTaken predictor, regen being present, health increasing due to pollution (for enemy spawners at least) and the fact that projectiles take time between being shot and hitting the target. If entity has overkill_fraction of 5%, then if it has 10 health points remaining out of 2000, then margin is 2000*5%=100, if projectile deals 109 damage or less then a second projectile will be fired. If it deals 110 or more then only one will be shot.
I would suggest adding a special check if the damageToBeTaken exceeds entity max health +1%, this would handle the artillery case pretty well.