-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Minimal support for Alpha Frontier-like Workers #9690
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
Conversation
…er chances to create synergies
Hmm... something tells me eventually we may need to deprecate the workboat unique. Oh well, for now we can work around it I guess Heads up: I don't remember if |
Hidden contradiction? That Unique is only supposed to support improvements with a turnsToBuild, so the "not working" in the first half sounds more like "misunderstood". But yes, that "half" of the task, I've only looked for blockers and saw none, not in findTileToWork or upstream from it. tileCanBeImproved could well be the site I didn't yet check - because at some point you want the game to debug to see what's really happening... |
... Also raises the question what would happen if some mod had a carthage-style "can climb mountains" plus an improv buildable on Mountains - which does work fine for a human plr - just need to swap often or have enough acceleration and medic effects so a Worker can survive it - Good AI use of such a thing yould get tricky... Remove another early exit from tileCanBeImproved, yes, but that can't be enough. Or is that situation already the case with G&K Carthage and roads? Can't remember if I had to change the terrain to test that. |
Wait - isn't AF's Derrick already such an improvement? Any my simulation had a Derrick on Coast - how can that be with that |
Latest commit deals with a few blockers - @SeventhM 's observation and one more - and I've so far seen them go for it up to WorkerAutomation L253 "startWorkingOnImprovement". Using the save here by @hackedpassword , an excerpt of debugger notes:
Worker
currentTile Tile @(-4.0,0.0), Batou-Cho, Grassland, Hill, {3} {Promethine}, City center, Worker - Daikyu Boei Kikan, Drop Trooper - Daikyu Boei Kikan
tilesToAvoid.size = 312
filter up to getPriority -> 4 candidates
workableTilesCenterFirst -> 1 candidate
selects Tile @(-4.0,-1.0), Coast, Algae, Drop Trooper - Daikyu Boei Kikan
Worker
currentTile Tile @(-8.0,-4.0), Niihama New Port City, Mycelium, City center, Worker - Daikyu Boei Kikan
tilesToAvoid.size = 0
filter up to getPriority -> 40 candidates
workableTilesCenterFirst -> 37 candidates
selects Tile Tile @(-8.0,-5.0), Coast, {42} {Promethine}
Place 2 of workableTilesPrioritized after Tile @(-9.0,-5.0), Plains, Hill, {42} {Titanium}, Railroad, Mine
unit.movement.canReach(it) == true
tileCanBeImproved(unit, workableTilesPrioritized.first()) == false
Worker
currentTile Tile @(-5.0,5.0), Coast, Plankton, Worker - Badwalmusafir, Hovertank - Badwalmusafir
tilesToAvoid.size = 47
filter up to getPriority -> 26 candidates
workableTilesCenterFirst -> 13 candidates
selects #2 Tile @(-5.0,8.0), Coast, Ice-10 after #1 Tile @(-2.0,8.0), Grassland, {42} {Ulframite}, Mine
A size difference between "filter up to getPriority" and "workableTilesCenterFirst" means the danger avoidance level 2 works, tilesToAvoid.size varying and showing > 0 means danger avoidance level 1 works - which is upstream from the code I touchend and which I haven't analyzed. Could well be that they could be unified. The first two show the old code has parked a few in cities, which now embark to get to a resource. Last one did reach the "Ice-10" tile soon after and started the improvement. Sounds like a good return for a few minor strategic incisions. One open question - the first !isLand in tileCanBeImproved shoudn't always shunt out, but I didn't want to discard the optimization entirely, so I checked the close-but-not-quite cached unique instead. Cheap and fast but imperfect. Drop the line, leave it as is, or add another cached flag, with a slightly more complex formula than just hasUnique...? |
Was reading through and this caught my attention. Mod {the great unciv rework} has 2 natural wonders granting climber abilities. My in-development map takes advantage of these mountains as designed gameplay. fyi |
I should rename the PR to "Minimal AI support" in case that wasn't clear enough. Your or any Mod's changes to Mountains- if they test out fine by a human player that is only one side of the coin. Whether the AI can make effective use of such changes is relatively independent. But, agreed - making Mountains less boring is an attractive modding target. There's probably quite some opportunities to code more support into Unciv - is there control over the damage? Control that can depend on unique conditionals? Just one example. I have no clear picture, so I'll pretty much zone out. This PR exists because a specific issue triggered my curiosity and I saw an opportunity that -maybe- relatively little code might help. |
Commit messages tell a lot.
What would really help would be a fuzzy logic so improve land could return a best "quality" and create by sacrifice on water could do the same, both are compared the better ones win. Better result for more CPU. Concept could be extended to large parts of automation...
UNTESTED so farTests were done, by issue OP as well. See below. Looks like sizable improvement for little work (and little risk for G&K players).