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

AI misuses wirlpools #8105

Open
2 tasks done
kitovyj opened this issue Dec 4, 2023 · 17 comments
Open
2 tasks done

AI misuses wirlpools #8105

kitovyj opened this issue Dec 4, 2023 · 17 comments
Labels
AI Artificial intelligence behaviour improvement New feature, request or improvement

Comments

@kitovyj
Copy link

kitovyj commented Dec 4, 2023

Preliminary checks

Platform

Windows

Describe the bug

Myra wants to attack Gem being just a few tiles away from her and uses a wirlpool instead of going around it. That is very suboptimal in this case.

Save file

uses wirlpool wrong way.zip

Additional info

No response

@kitovyj kitovyj added the bug Something doesn't work label Dec 4, 2023
@oleg-derevenetz
Copy link
Collaborator

oleg-derevenetz commented Dec 4, 2023

Technically the way through the Whirlpool is shorter - path through the Whirlpool takes ~700 movement points while path around the Whirlpool takes ~850 movement points, so, strictly speaking, this is not a bug. AI (in terms of pathfinding) always thinks that it will be lucky and it will always get into the right whirlpool, but this, of course, does not always happen. There are multiple ways to fix this, for example:

  1. Let AI "cheat" with Whirlpools, just like it now "cheating" with Summon Boat spell, but with the Summon Boat it's "microcheat", while here it would be "real cheat";
  2. Impose some AI-only penalties for Whirlpools.

Each of these have its own "pros" and "cons". For now, I will reclassify this issue as a request for improvement.

@oleg-derevenetz oleg-derevenetz added improvement New feature, request or improvement AI Artificial intelligence behaviour and removed bug Something doesn't work labels Dec 4, 2023
@oleg-derevenetz oleg-derevenetz added this to the Beyond OG scope milestone Dec 4, 2023
@kitovyj
Copy link
Author

kitovyj commented Dec 4, 2023

Technically the way through the Whirlpool is shorter - path through the Whirlpool takes ~700 movement points while path around the Whirlpool takes ~850 movement points, so, strictly speaking, this is not a bug. AI (in terms of pathfinding) always thinks that it will be lucky and it will always get into the right whirlpool, but this, of course, does not always happen. There are multiple ways to fix this, for example:

  1. Let AI "cheat" with Whirlpools, just like it now "cheating" with Summon Boat spell, but with the Summon Boat it's "microcheat", while here it would be "real cheat";
  2. Impose some AI-only penalties for Whirlpools.

Each of these have its own "pros" and "cons". For now, I will reclassify this issue as a request for improvement.

I think natural solution here would be a small penalty. This map contains 4 wirlpools and very often AI gets trapped trying to get correct exit, loosing time and army. At least definitely wirlpool should not be used if AI expects to get out of the same wirlpool - that will almost never work in terms of spending less movement points, even if there are only 2 wirlpools in the map.

@oleg-derevenetz
Copy link
Collaborator

oleg-derevenetz commented Dec 4, 2023

Hi @kitovyj

At least definitely wirlpool should not be used if AI expects to get out of the same wirlpool - that will almost never work in terms of spending less movement points, even if there are only 2 wirlpools in the map.

On the contrary, it will always work when there are only 2 whirlpools on the map :) That's one of the reasons why the question with penalty is not so obvious.

@kitovyj
Copy link
Author

kitovyj commented Dec 4, 2023

Hi @kitovyj

At least definitely wirlpool should not be used if AI expects to get out of the same wirlpool - that will almost never work in terms of spending less movement points, even if there are only 2 wirlpools in the map.

On the contrary, it will always work when there are only 2 whirlpools on the map :)
Really? But hero can get out at the same tile of the original wirlpool again? The tile he surfaces is random, right?

@oleg-derevenetz
Copy link
Collaborator

@kitovyj

Really? But hero can get out at the same tile of the original wirlpool again? The tile he surfaces is random, right?

No, it's not random. You can test this yourself :)

@kitovyj
Copy link
Author

kitovyj commented Dec 4, 2023

@kitovyj

Really? But hero can get out at the same tile of the original wirlpool again? The tile he surfaces is random, right?

No, it's not random. You can test this yourself :)

Ok) Anyway, using wirlpool to get to another side of the same wirlpool I would penalize. AI tries to do that really often and it looks quite weird.

@kitovyj
Copy link
Author

kitovyj commented Dec 4, 2023

@kitovyj

Really? But hero can get out at the same tile of the original wirlpool again? The tile he surfaces is random, right?

No, it's not random. You can test this yourself :)

In principle the penalty may depend on the amount of the wirlpools and the level of the creature the hero can potentially lose.

@Branikolog
Copy link
Collaborator

Hi, @kitovyj and @oleg-derevenetz
I personally prefer AI cheating with whirlpools. Because human players do always cheat: reload if they lost some troops, use spacebar, while AI can't. If AI would jump to the destination point instantly, this would also shorten AI turn time so no more complains from players, that AI is looking like a "stuck" in whirlpools jumping for a long time.

@oleg-derevenetz
Copy link
Collaborator

this would also shorten AI turn time so no more complains from players, that AI is looking like a "stuck" in whirlpools jumping for a long time

#8114 should help in this regard. This is also related not just to Whirlpools, but also to Stone Liths, which are also random in nature by design.

@Branikolog
Copy link
Collaborator

@oleg-derevenetz

#8114 should help in this regard.

Absolutely yes, I'm aware of this useful improvement, you've done recently. 👍

This is also related not just to Whirlpools, but also to Stone Liths, which are also random in nature by design.

I personally consider Stone Liths operation mechanics as really of bad design: randomly jumping between stone liths to reach the needed one is really annoying. I've seen multiple times players just spending a minute or so to appear in the proper place. If I'm not mistaken we've discussed somewhere a future opportunity to allow a player to choose the exit of the liths he want. So implementing this for AI would be necessary too, if we come up with this improvement. In the future. :)

@oleg-derevenetz
Copy link
Collaborator

I personally consider Stone Liths operation mechanics as really of bad design: randomly jumping between stone liths to reach the needed one is really annoying.

Map creators can use this to limit or slow down the ability to attack or transfer reinforcements from one part of the map to another. At least for AI players :)

@kitovyj
Copy link
Author

kitovyj commented Dec 27, 2023

Hi, @kitovyj and @oleg-derevenetz I personally prefer AI cheating with whirlpools. Because human players do always cheat: reload if they lost some troops, use spacebar, while AI can't. If AI would jump to the destination point instantly, this would also shorten AI turn time so no more complains from players, that AI is looking like a "stuck" in whirlpools jumping for a long time.

No, please no cheating. It kills all the fun. I don't reload and I don't want AI to cheat. It's better to make it smarter rather than cheat.

@oleg-derevenetz
Copy link
Collaborator

No, please no cheating. It kills all the fun. I don't reload and I don't want AI to cheat. It's better to make it smarter rather than cheat.

If, nevertheless, a decision is made to implement the spacebar operation for AI (at the moment, there are concerns that this will break some maps), then it makes sense to implement this mechanics as an instantaneous movement to the desired endpoint, and in no other way.

@FyiurAmron
Copy link

FyiurAmron commented Jan 10, 2024

TBH, how is it "cheating" if a player can do it? The fact that e.g. the AI in Heroes 2 didn't do something originally doesn't IMVHO make introducing that behaviour "a cheat". One can argue that the game mechanic interpretation assigned to the teleports by some players (i.e. that they should be "re-entered" and "re-exited" to trigger "without cheating") doesn't really make too much sense nowadays. If the teleports would be e.g. otherwise limited to a single random use per day - sure, that could be considered cheating, both by player (save-load) and AI (by allowing it the selection freely as described above).

That's not the case, however.

tl;dr what @Branikolog says about player UX is spot-on.

I personally consider Stone Liths operation mechanics as really of bad design: randomly jumping between stone liths to reach the needed one is really annoying. I've seen multiple times players just spending a minute or so to appear in the proper place. If I'm not mistaken we've discussed somewhere a future opportunity to allow a player to choose the exit of the liths he want.

I wouldn't go as far as to call this "cheating", though. It's not giving the AI additional 100k gold. It's not "free movement points". It's replicating the mechanics that humans use anyway - I haven't heard anyone in Heroes 3 call the "spacebar" trick "a cheat", after they introduced it in AB. 3DO did it for a good reason IMVHO: because it makes the game better.

@Branikolog
Copy link
Collaborator

I wouldn't go as far as to call this "cheating", though. It's not giving the AI additional 100k gold. It's not "free movement points". It's replicating the mechanics that humans use anyway

This goes without saying that allowing AI hero to appear in the needed place on his will would save a player a couple of moments watching those jumps through all the exits of whirpools/stone liths.

@kitovyj
Copy link
Author

kitovyj commented Jan 11, 2024

I have just realized that 'spacebar' doesn't eat move points. But that makes random exit point senseless. Shouldn't spacebar be not free in principle? Otherwise it is senseless.

@FyiurAmron
Copy link

FyiurAmron commented Jan 11, 2024

@kitovyj it worked like that ever since it was introduced, because that's how NWC/3DO devs envisioned it. Whether or not it's senseless is obviously open to debate, but IMVHO it's the only workaround for not being able to select the exit directly that there is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AI Artificial intelligence behaviour improvement New feature, request or improvement
Projects
None yet
Development

No branches or pull requests

4 participants