Open PathosEthosLogos opened 2 months ago
I must add that this is especially problematic if the escort unit is a siege unit. They just take hits instead of siege + attack, and maybe let the settler wait a bit or run back to base alone if very near.
Yeah, this is a big problem that we are seeing. The fix isn't very simple however. The AI generally lacks vision of barbarians until it is too late. It is also hard for the AI to remember anything about barbarians.
I did investigate a little into the AI try to protect it's civilian units more but it won't be an easy fix. It also doesn't help that the AI has extra happiness and tries to settle as much as it can.
If this is a big problem, I'm okay with allowing the AI to "cheat" and know about barbs it shouldn't know about, to make better choices
If this is a big problem, I'm okay with allowing the AI to "cheat" and know about barbs it shouldn't know about, to make better choices
Interesting solution! But yes, I would say it's one of the biggest problems at the moment.
One extra tile-distance vs. barbarians could be the solution I think. This means that the vision should not be shown on the UI (for the spectator) and it should not reveal the tile (its characteristics/resources).
Possible solution as patch - "don't enter any tile that enemies can enter":
Index: core/src/com/unciv/logic/automation/unit/CityLocationTileRanker.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/core/src/com/unciv/logic/automation/unit/CityLocationTileRanker.kt b/core/src/com/unciv/logic/automation/unit/CityLocationTileRanker.kt
--- a/core/src/com/unciv/logic/automation/unit/CityLocationTileRanker.kt (revision e8565b0b6f868c9559380c29919e8ae7a785c654)
+++ b/core/src/com/unciv/logic/automation/unit/CityLocationTileRanker.kt (date 1724526102545)
@@ -31,9 +31,17 @@
}
val nearbyCities = unit.civ.gameInfo.getCities()
.filter { it.getCenterTile().aerialDistanceTo(unit.getTile()) <= 7 + range }
+
+ val nearbyEnemies = unit.currentTile.getTilesInDistance(range*2)
+ .mapNotNull { it.militaryUnit }
+ .filter { it.civ.isAtWarWith(unit.civ) }
+
+ val tilesEnemiesCanEnter = nearbyEnemies.map { it.movement.getDistanceToTiles() }
+ .flatMap { it.values }.map { it.tile }.toSet()
val uniques = unit.getMatchingUniques(UniqueType.FoundCity)
val possibleCityLocations = unit.getTile().getTilesInDistance(range)
+ .filterNot { it in tilesEnemiesCanEnter }
// Filter out tiles that we can't actually found on
.filter { tile -> uniques.any { it.conditionalsApply(StateForConditionals(unit = unit, tile = tile)) } }
.filter { canSettleTile(it, unit.civ, nearbyCities) && (unit.getTile() == it || unit.movement.canMoveTo(it)) }
If we have a military escort this might not be the best solution though. Do you have an example game?
Before creating
Problem Description
I'm still trying to pinpoint more precisely what the conditions are, but basically, when there are barbarians on the map, some AIs get stuck, continuously trying to settle on the same spot or similar direction. However, they are unable to due to barbarians aggressions. When there are few barbarian camps that can converge on to the AI's intended target settlement location, then it is likely that the AI will fail to settle for three eras (longest I've seen survive before they're dominated in deity).
Related Issue Links
No response
Desired Solution
Escorting AI might need a boost with extra army, or only settle after barbarian camps are killed (doesn't have to be all cleared in the area, but at least halved or something)
Alternative Approaches
Settlers could have two or three options and select the next best option when failed twice in a row.
Barbarian camps nearby could deduct 'settlement score' in those tiles.
Additional Context
No response