Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WoF: In S09 Ancestor, Yetis Stop Pursuing When Their Target (Player's Leader) is on Unwalkable Terrain #8757

Open
IskarJarak01 opened this issue Apr 14, 2024 · 11 comments
Labels
AI Issues with the AI engine, including micro AIs. Bug Issues involving unexpected behavior. Campaign WoF The mainline Winds of Fate campaign

Comments

@IskarJarak01
Copy link

Game and System Information

  • **Version:**1.18
  • **OS:**ChromeOS/Debian

Description of the bug

In WoF S09 Ancestor, the main threats are multiple Yetis which spawn randomly on the map and pursue the player's leader, Gorlack.

They have simple modified AI:

  1. Attack anything hostile in range
  2. Move towards Gorlack

When Gorlack is standing on unwalkable terrain, the Yetis stop moving towards Gorlack.

Steps to reproduce the behavior

  1. Disable shroud
  2. Move Gorlack to any unwalkable terrain
  3. If a Yeti cannot attack something, it doesn't move

Expected behavior

The Yetis should continue to path towards Gorlack, even if Gorlack is on unwalkable terrain.

Additional context

This is significant outside of exploits because of a vertical chasm in the middle of the map which Gorlack might fly through.

@IskarJarak01 IskarJarak01 added the Bug Issues involving unexpected behavior. label Apr 14, 2024
@Wedge009 Wedge009 added Campaign WoF The mainline Winds of Fate campaign AI Issues with the AI engine, including micro AIs. labels Apr 14, 2024
@Wedge009
Copy link
Member

It sounds like when the AI can't find a path to Gorlack, it doesn't know where the yetis should move and thus gives up.

CC: @Jonathan-Kelly

@Wedge009
Copy link
Member

They have simple modified AI:
1. Attack anything hostile in range
2. Move towards Gorlack

I'm not sure where that is located. I only note that specific terrain is avoided in the general spawner macro. I'm not even sure what that terrain represents.

[ai]
village_value=0
[avoid]
terrain=*^V*
[/avoid]
[/ai]

@soliton-
Copy link
Member

That should match only village terrain. Probably better done as formula=village

@IskarJarak01
Copy link
Author

The bats on the map - which can move on unwalkable terrain - do follow Gorlack.

I assumed the Yetis have modified AI because they don't move on villages at all and their behaviour in this issue (I might doublecheck, but I don't think the AI in Dead Water just stops moving landbound units because the player's leader is in deep water).

When the Yetis are Poisoned, they stop attacking even when flanked. AI leaders share this behaviour but regular recruits don't. In this scenario, a Poisoned AI unit just moves adjacent to Gorlack and hangs around. This might be a byproduct of avoiding villages, but it definitely isn't typical AI behaviour.

@Jonathan-Kelly
Copy link
Contributor

When the Yetis are Poisoned, they stop attacking even when flanked. AI leaders share this behaviour but regular recruits don't. In this scenario, a Poisoned AI unit just moves adjacent to Gorlack and hangs around. This might be a byproduct of avoiding villages, but it definitely isn't typical AI behaviour.

Hmm, did you notice anything like this happening with the wildlife during scenarios 1 or 5? Those scenarios use the same village avoidance AI modification but their maps have healing oases which the creatures can retreat to.

It is possible there are some bugs with the default AI when no healing tiles are available to it.

@IskarJarak01
Copy link
Author

I went back and checked. In S1 and S5, Poisoned units behave properly - they attempt to move towards an oasis and are still willing to attack.

I tested S02 in WoF. As it turns out, the AI does actually does do nothing when the player's leader is on unwalkable terrain. The AI moves to capture villages, but then stops moving. Single units still move to attack, but once all villages are captured, anything that can't attack remains stationary.

@Jonathan-Kelly
Copy link
Contributor

I went back and checked. In S1 and S5, Poisoned units behave properly - they attempt to move towards an oasis and are still willing to attack.

Alright, so then I guess either the Wyrms could lose their poison bite or the map could get a few healing oases to work around that limitation. Really wish we had more than one type of non-village healing terrain besides oases, but oases may not look too far out of place on this map given its volcanic microclimate...

Single units still move to attack, but once all villages are captured, anything that can't attack remains stationary.

Do you mean they will not pursue your units while your leader stays out over deep water? In my tests (of S02) enemy land units moved across the map to attack any player unit which moved onto land, regardless of whether the player's leader stayed out over the deep sea tiles. The enemy land units only stayed still if presented with zero reachable targets. Which seems like reasonable behavior (for scenario 2)?

@IskarJarak01
Copy link
Author

I've attached two replays of S2 (to be clear, the AI behaviour in this scenario isn't a real problem, it's just for demonstration). I debug killed the boats because they attack normally.
In replay 1:
I move my leader forward, adjacent to shallow water (can be attacked) -> no response
I move a burner forwards -> response from closest AI
I move leader onto land -> all AI troops head towards leader

In replay 2, I reduce the burner's max moves so it can't attack the AI leader. This leads to no response from that AI.

The AI occupies villages and castles, but I believe only because those are where the unit stopped / was recruited. I think the issues with AI behaviour here are from the default AI, it's just that they are masked by other behaviours (village capture / defend leader).

I don't think the Wyrm's Poison matters enough to modify the unit as the scenario is effectively won at that point. The player's only access to Poison is Water Serpents, which the Yetis can kill in one attack. Is it possible to "puppet" the Yetis and instruct them to attack adjacent units?

In a similar vein, can the default AI be overidden and instructed to always move towards the closest hostile unit or a different hero? There's an Eastern Invasion scenario (13_Spoils_of_War) which implements custom AI like this.

WoF-Reclamation replay 20240417-131112.gz
WoF-Reclamation replay 20240417-131313.gz

@Jonathan-Kelly
Copy link
Contributor

Okay, after looking at your replays and digging further into how the AI works, it sounds like ordinary units are not considered move-to targets by default. Which means an AI controlled unit will only attack a regular enemy unit if it is one move away. It will not pursue anything more than one move away unless that thing is an enemy leader, an enemy unit adjacent to its own leader (an assassin threat) or a village to be captured (as these three types of things are considered move-to targets automatically).

I believe you can add all hostile units (or just the player's heroes) as move-to targets using a [goal] tag. But that presumably has the consequence of letting the AI "know" where all your units are at all times and relentlessly pursuing them if no other targets are close or more valuable.

Why the wildlife in S1 and S5 seem more dynamic is because they tend to have more enemies spawn or move inside their "hunting radius" of one move away (and to a lesser extent because they have healing oases to retreat to when injured.)

@IskarJarak01
Copy link
Author

I believe the AI can have fog enabled independently of the player, but it'll probably just make the AI stop moving until one of their units spots the player's leader, at which point they'll all start moving towards the player.

The addon campaign Return From the Abyss (trial_of_arms) has a couple of Giant Spiders (controlled by an otherwise normal AI side) which randomly walk in a small area near where they start. I think this behaviour is set by a unit variable:

[variables]
    [micro_ai_mai_hunter]
    [/micro_ai_mai_hunter]
[/variables]

However, if the AI doesn't have a goal it proabably won't travel very far or be relatively easy to bypass or otherwise lure away. If the Yetis all spawn in the mountains and just roam around, the player might not even see them until the end.

@Jonathan-Kelly
Copy link
Contributor

Yeah a lot of the Micro AIs have a random walk function. Among these the Big Animals Micro AI seems the most promising. In the past these AIs were buggy and limited but they have improved in recent years. At least the Goto Micro AI works fairly well in the new King of the Hill multiplayer scenario. So I have it on my todo list to test out how well Big Animals performs on this and the other two "wildlife" scenarios.

Optimally, it would be the same as the default AI except that the usual move-to-targets behavior focused on capturing villages and assassinating/protecting leaders would be replaced with the simple random wandering behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AI Issues with the AI engine, including micro AIs. Bug Issues involving unexpected behavior. Campaign WoF The mainline Winds of Fate campaign
Projects
None yet
Development

No branches or pull requests

4 participants