Page 1 of 1
Can't turn to reduce flank threat
Posted: Sat Aug 28, 2021 2:53 am
by DanZanzibar
You can see the scenario in the attached image. The selected unit is not allowed to turn to reduce flank threat and the only reason I can think of is that the threatening unit is currently ZoC'd by another unit of mine (although you can see how that will change). Is this the correct assessment and is this WAD? I would think that a situation like this should allow you to turn.
Re: Can't turn to reduce flank threat
Posted: Sat Aug 28, 2021 4:01 am
by w_michael
The Scots Offensive Spear unit (one tile to the west of the selected Papal unit) appears to be pinned (ZOC'd) by the Papal Defensive Spears (one tile to the south-west). The ZOC is broken though when the Papal Defensive Spear is charged by the Scots schiltron (two tiles west), and the selected Papal unit is flank charged. I think that the turn to face was prevented for the reason that the OP suggested. It would be asking too much for the game engine to anticipate future moves.
Re: Can't turn to reduce flank threat
Posted: Sat Aug 28, 2021 5:17 am
by tyronec
The unit to the front is facing directly and that is causing the pin.
The unit to the left is not facing directly and so is not considered a direct threat. If it were rotated so that it were facing directly then your unit in question would be able to turn to face both threats.
Re: Can't turn to reduce flank threat
Posted: Sat Aug 28, 2021 10:50 pm
by DanZanzibar
w_michael wrote: ↑Sat Aug 28, 2021 4:01 am
The Scots Offensive Spear unit (one tile to the west of the selected Papal unit) appears to be pinned (ZOC'd) by the Papal Defensive Spears (one tile to the south-west). The ZOC is broken though when the Papal Defensive Spear is charged by the Scots schiltron (two tiles west), and the selected Papal unit is flank charged. I think that the turn to face was prevented for the reason that the OP suggested. It would be asking too much for the game engine to anticipate future moves.
I don't think it would be hard on the implementation as you're only testing if there are adjacent enemy units of your flanks regardless of what ZoC's they may be in. I'd be surprised that it wasn't coded this way because of how simple that is... and maybe there's another explanation for what is going on, I don't know.
Re: Can't turn to reduce flank threat
Posted: Sat Aug 28, 2021 10:52 pm
by DanZanzibar
tyronec wrote: ↑Sat Aug 28, 2021 5:17 am
The unit to the front is facing directly and that is causing the pin.
The unit to the left is not facing directly and so is not considered a direct threat. If it were rotated so that it were facing directly then your unit in question would be able to turn to face both threats.
You don't need to be in the primary ZoC of the flank-threatening unit to be able to turn to reduce flank threat. I was about 95% sure but I still went and double checked this.
Re: Can't turn to reduce flank threat
Posted: Sat Aug 28, 2021 11:40 pm
by tyronec
You don't need to be in the primary ZoC of the flank-threatening unit to be able to turn to reduce flank threat. I was about 95% sure but I still went and double checked this.
You are right, secondary ZOC counts. I have been playing with a misunderstanding of the rules !
Re: Can't turn to reduce flank threat
Posted: Mon Aug 30, 2021 1:38 am
by w_michael
I think that the OP depicted the AI flank threat evaluation logic. Since it didn't see one, the highlighted unit couldn't turn away from a primary ZOC.
Re: Can't turn to reduce flank threat
Posted: Mon Aug 30, 2021 2:50 am
by DanZanzibar
w_michael wrote: ↑Mon Aug 30, 2021 1:38 am
I think that the OP depicted the AI flank threat evaluation logic. Since it didn't see one, the highlighted unit couldn't turn away from a primary ZOC.
It certainly seems like the most likely explanation. There's one thing I very hazily remember reading though that gave me pause on this - when they changed the game rules to prevent light units from turning units and exposing them to being charged the next turn by non lights I vaguely recall seeing something in the forums about how the test that is done does NOT factor in if the potential flanking unit is ZoC'd by anyone... meaning they just had to be in a position to attack, not actually free to do so. From a game logic point of view, I do think this unit should be allowed to turn as they should still be feeling threatened on their flank, regardless of what another unit of mine is doing to threaten the enemy unit (i.e. ZoC'ing them) into not being able to charge.
I'm pretty sure I need an RBS answer on this one and am hoping he chimes in (best game developer ever for almost always helping out with these questions!).
Re: Can't turn to reduce flank threat
Posted: Mon Aug 30, 2021 3:18 am
by w_michael
I agree that given this situation that the selected unit should logically be allowed to turn. The ZOC rules in all of the FOG2 and P&S game systems have always been contentious.
Re: Can't turn to reduce flank threat
Posted: Tue Aug 31, 2021 6:56 am
by rbodleyscott
DanZanzibar wrote: ↑Mon Aug 30, 2021 2:50 am
w_michael wrote: ↑Mon Aug 30, 2021 1:38 am
I think that the OP depicted the AI flank threat evaluation logic. Since it didn't see one, the highlighted unit couldn't turn away from a primary ZOC.
I'm pretty sure I need an RBS answer on this one and am hoping he chimes in (best game developer ever for almost always helping out with these questions!).
The current code does exclude an enemy unit from counting as a flank threat (for the purpose of a unit being able to turn to reduce flank threat) if that enemy unit is unable to charge the unit because it is pinned by another unit's ZOC.
Whether it should or not is another question, of course.
In this case, it might seem that it shouldn't, but the same EstimateFlankThreat() function is used when deciding whether an AI unit should charge (or even advance), and in most cases, it would be better off ignoring the potential (but not currently actual) flank threat and charge rather than standing there doing nothing.
Here is my comment from the actual code:
// If testing for imminent flank threat, ignore risk if enemy unit in close combat or pinned.
// Ignoring units in combat has some risk, as they might win and pursue into our flank. However, the AI needs to take some risks to avoid getting stuck.
// Ignoring pinned enemy units could be more risky - the unit pinning them might subsquently move so that it isn't pinning them.
// Will need testing to see if the balance is favourable
Of course, the EstimateFlankThreat() function could be made to work differently in different circumstances.
Re: Can't turn to reduce flank threat
Posted: Tue Aug 31, 2021 9:04 pm
by DanZanzibar
Thanks for clarifying that. While I don't imagine it's the most critical change, I do think it would make sense to have a separate "check flank threat" function that governs when a unit can be turned. I really can't think of any odd situations where this would have an undesirable effect.