Improve multiplayer AI attack targeting with TTK and softmax selection - #11273
Improve multiplayer AI attack targeting with TTK and softmax selection#11273Madwand99 wants to merge 12 commits into
Conversation
| int lifeDeficit = lowLifeThreshold - life; | ||
| score += lifeDeficit * lifeDeficit; | ||
| } | ||
| score += ComputerUtil.getCombatTtkScore(ComputerUtil.estimateCombatTurnsToKill(ai, opp)); |
There was a problem hiding this comment.
My main thoughts for now:
a) this scoring change makes it only look at attack power from AI, where previously being at low life was already enough (assuming other opponents will also consider the same defender)
b) How sure are we that it's really a superior strategy to get rid of the weakest player instead of e.g. slowing the strongest down?
c) I have some doubts looking more than one combat into the future this way won't just lead to other wrong conclusions (attackers/blockers trading or just the board state completely changing)
There was a problem hiding this comment.
Yeah, some valid concerns there that I also share. It is tricky to get this right. I pushed a change that should help: I’ve kept the existing threat evaluation as the primary signal and changed outgoing TTK into a short-term tactical modifier rather than a general low-life replacement: it only scores kills within one or two combats, so it no longer relies on long static-board projections.
The finishing bonus is also scaled down exponentially when that opponent’s underlying threat is below the table leader’s. This means a low-threat player who is easy to eliminate can help break a close decision, but should not displace a clearly more dangerous opponent that the AI ought to be slowing down. I did not reintroduce a separate low-life bonus, since that would largely double up on the same elimination pressure.
| return Integer.MAX_VALUE; | ||
| } | ||
| final int damage = defender.getLife() - remainingLife; | ||
| return damage > 0 ? (defender.getLife() + damage - 1) / damage : Integer.MAX_VALUE; |
There was a problem hiding this comment.
imo we're also losing accuracy here if AI is at very low life so all opponents will basically lead to TTK=1
but it should still matter which opponent causes lower negatives
There was a problem hiding this comment.
I think TTK should intentionally collapse all terminal next-combat outcomes to 1: once a player would lose, excess normal damage is not more immediately relevant, and comparing negative life would also mis-rank lethal poison or commander damage that may not reduce life at all. If we need to distinguish between multiple one-turn lethal threats, I think that belongs in the broader board-threat evaluation rather than the TTK value itself.
| } | ||
| int highestThreat = Collections.max(threatScores.values()); | ||
|
|
||
| final int temperature = AiProfileUtil.getIntProperty(ai, AiProps.MULTIPLAYER_DEFENDER_SOFTMAX_TEMPERATURE); |
There was a problem hiding this comment.
I wouldn't mind a more dynamic approach to determine the score interval that counts as equal threat
but allowing AI to make potentially game losing attacks (even with a rather low probability) just seems wrong
There was a problem hiding this comment.
The small chance for even low-threat opponents to be attacked is intentional. From a recent comment on the Discord: "...Also, humans will take attacks of opportunity. As in, attacking the least threatening guy because they can't get in on the biggest threat. I don't see the AI doing that at all. I will sit there with no creatures out for several turns, just land go. And I wont ever get attacked, they just plow into each other. "
No one should become immune to being attacked just because they sandbag. The small chance of being attacked prevents this. Some randomness added to AI decision making prevents them from becoming unnaturally predictable and makes the game more fun.
|
I need to think about if much more complexity for threat scoring is the right approach or if actually supporting AI spreading its damage to multiple players would solve this way more naturally (though maybe also a bit tricky to get right) |
|
I think your recent PR #11331 is complementary rather than a replacement for this PR. It introduces target variety through a dynamic equal-threat window, but it retains the existing threat signal, including the unconditional low-life bonus. This PR improves that signal with combat TTK, limits finishing pressure when a weaker player is serving as a check on a clearer leader, and uses a graded selection probability plus a fallback to an open target when the preferred defender produces no attack. In other words: we still need this PR. |
This improves multiplayer combat targeting so the AI is less likely to repeatedly focus a single player based on small or incidental score differences.
Changes: