Anuken / Mindustry

The automation tower defense RTS
https://mindustrygame.github.io
GNU General Public License v3.0
22.59k stars 2.95k forks source link

Buggy enemy unit pathfinding/behaviour in Erekir #10046

Closed rowandwhelan closed 2 months ago

rowandwhelan commented 3 months ago

Platforms

Windows

Build

Release Build 146

Issue

This appears to be unintended behavior and it affects all sectors. For example, on origin when the last base left is the one with powerful air units (i think its the one on the left side upper-middle, though this is just an example and still happens when there is more than one base, though more rarely) there are periods where there are no enemies attacking but I still hear the "new wave" sound which implies there are still units being created. When I built outside of my base or attack them, that seemed to cause them to realize they should attack me and because their forces have amassed to ludicrous numbers I nearly always die. Otherwise if I build inside of my base and don't provoke them then they don't attack which is actually bad since its easier to deal with a constant stream of enemies than a whole horde. I've also seen times where after defeating most of the horde there would be a couple stragglers in and around my base and sometimes they would attack and other times they would just idle there and do nothing. I don't have the technical savvy to diagnose the cause of this behavior but I'll do my best to help.

Possible copy of https://github.com/Anuken/Mindustry/issues/9871

Steps to reproduce

Play through the campaign as normal. For no apparent reason enemies cease attacking and build up inside enemy base instead (happens with air units and likely also tank and mechs), once I build outside of my base or attack their base (moving units close to their base doesn't trigger an attack as long as im not in range of turrets or units), they attack in one massive horde which results in the destruction of my base.

Mods used

No response

Save file

MindustrySave.zip

(Crash) logs

No response

Submission

Matita008 commented 3 months ago

I think it's a known issue in the enemy AI

Anuken commented 3 months ago

Does your game save contain maps where the AI is currently exhibiting the massing behavior?

rowandwhelan commented 2 months ago

No, however I can try to replicate it and post one where the issue appears to be happening

rowandwhelan commented 2 months ago

MindustryExport2.zip

@Anuken I've just been developing my base in origin for around a half hour, no attacks. This is likely a good example of the enemy behavior (I haven't provoked them yet).

Anuken commented 2 months ago

A couple notes:

  1. This isn't entirely a bug. The enemy won't attack unless it thinks it percieves an advantage in certain areas. If you build turrets faster than they build units, they will never attack and mass units forever.
  2. The algorithm for checking advantage was flawed, and this has been fixed, but you'll still see them massing units quite often. In your save, they do end up attacking after the fix, but don't expect this to always be the case.

there would be a couple stragglers in and around my base and sometimes they would attack and other times they would just idle there and do nothing.

This is expected behavior, there is no AI for them to lead an attack individually if they have lost their group.

rowandwhelan commented 2 months ago

Thanks Anuke!