Littlebob86
Prince
- Joined
- Oct 24, 2016
- Messages
- 332
How does the cheating Bastard ai have the population for so many damn settlers ! 

How does the cheating Bastard ai have the population for so many damn settlers !![]()
much of Civ6's AI code is recycled from Civ5, so it was written with certain assumptions in mind that don't necessarily apply to Civ6 ([...] movement points are spent after moving into a tile instead of as a requirement before you move into a tile).
Not sure if this is a result of your mod or just really bad AI or what but I just had Germany run a settler across the continent (probably about 30-40 tiles) from where their capitol is to build a city next to my capitol. Heck, I don't even know if something like that is moddable. Needless to say, I'm really pissed with them for this, I plan out my early settlements at the very start of the game, not anticipating the AI being THIS dumb.
What. Just, what. How can the AI possibly cope with moving their units if its programmed to fundamentally misinterpret the cost of doing so... This must explain the moronic constant shuffling and illogical routing of units that happens in some cases, as well as the seemingly random wandering of some units. I think it would be a very good idea to change back to the Civ5 movement cost system, until the AI is able to understand the new one.
Did the devs open access to the xml schema (xslt) file? That would probably help a lot with these changes.
You can see the schema in Assests/Gameplay/Data/Schema/01_GameplaySchema.sql
You can at least see some defaults etc there, not sure if you can do much useful editing there though
Legacy code from Civ5. The settling spot evaluation algorithms have a terrible way of understanding when a settle spot is too far away from their core empire to properly protect, and Civ5's high-boldness AIs will deliberately go out of their way to settle near opponents because those spots get an extra +33% boost to their score under high boldness (and a penalty under low boldness). I'm fairly certain that you're seeing a similar version of this in Civ6, albeit with boldness being replaced by some other AI property. Settle plot evaluation is hardcoded into CvGameCoreDLL in both its computations and the way it feeds into operation targeting data, so there's no way we can change it without access to DLL source code.Not sure if this is a result of your mod or just really bad AI or what but I just had Germany run a settler across the continent (probably about 30-40 tiles) from where their capitol is to build a city next to my capitol. Heck, I don't even know if something like that is moddable. Needless to say, I'm really pissed with them for this, I plan out my early settlements at the very start of the game, not anticipating the AI being THIS dumb.
Random wandering and some illogical shuffling is actually intentional, via the "wander" tactical and homeland moves. If the AI doesn't know what to do with a unit, it just has it wander about randomly, which occasionally conflicts with other units who have a goal to get to but wandering units are in their way (especially because the AI doesn't have access to the swap units command, or at least Civ5's doesn't). No, the movement point system's effects are primarily in how the AI judges "closeness": when units need to spend movement points before entering tiles instead of after, raw tile distance is even less of an indication of closeness than before, and the code has plenty of places where raw tile distance is used instead of a dummy pathfinder to judge how close a unit is to a target. This is because an extra turn's worth of movement needs to be spent in most cases moving from open tiles to rough ones, so the standard of 2 movement only actually translates to 2 tiles' of movement if both tiles are open terrain, whereas in Civ5, open + rough was also possible.What. Just, what. How can the AI possibly cope with moving their units if its programmed to fundamentally misinterpret the cost of doing so... This must explain the moronic constant shuffling and illogical routing of units that happens in some cases, as well as the seemingly random wandering of some units. I think it would be a very good idea to change back to the Civ5 movement cost system, until the AI is able to understand the new one.
Settle plot evaluation is hardcoded into CvGameCoreDLL in both its computations and the way it feeds into operation targeting data, so there's no way we can change it without access to DLL source code.
It's my understanding that the Civ6 Ai uses behaviour trees.<snip> ... Most AI experts work best when they're working with neural networking architectures (also called "deep learning" by marketing people). In fact, even when such architectures aren't used, being able to rely on heuristics and a static ruleset makes all AI programmers' lives easier; this is why CPP was able to get its decent AI through 4+ years' of work from 2+N programmers (2 main as Gazebo and Ilteroi, N supplement/groundwork as ninakoru, notque, and myself to name a couple), ... <snip>
I had a look, and the mod's intriguing. Some of the new rows they've written don't have vanilla equivalents, e.g. the "Total Yield" and "Specific Resource" items, which means that unless they've debugged the AI with the settler plot evaluation layer, it's possible that they're not actually doing anything with rows that reference. There's definitely indication that the modder isn't necessarily thoroughly testing of their work, because their STD_DISTRICTS favored list would actually do nothing, since they're not actually setting the districts in that list to be favored, they're just introducing a new list of possible districts to build that the AI may or may not take. However, some of the items they've edited definitely would affect settle plot evaluation, it's just that most of them are rather limited in scope (e.g. there's no way to make the AI disfavor settling near an enemy city).Are you sure of that? I have taken a look into Siesta Guru's work (AI+ mod), and it seems he has figured a way to improve the AI settler spot selection (via a "ModdedSettlerSpot" favored item in the behavior tree).
It's my understanding that the Civ6 Ai uses behaviour trees.
I had a look, and the mod's intriguing. Some of the new rows they've written don't have vanilla equivalents, e.g. the "Total Yield" and "Specific Resource" items, which means that unless they've debugged the AI with the settler plot evaluation layer, it's possible that they're not actually doing anything with rows that reference. There's definitely indication that the modder isn't necessarily thoroughly testing of their work, because their STD_DISTRICTS favored list would actually do nothing, since they're not actually setting the districts in that list to be favored, they're just introducing a new list of possible districts to build that the AI may or may not take. However, some of the items they've edited definitely would affect settle plot evaluation, it's just that most of them are rather limited in scope (e.g. there's no way to make the AI disfavor settling near an enemy city).
Besides that, the values they modified are many of the same values that could be modified in Civ5. There are still many other, algorithmic portions of settle plot evaluation that cannot be changed (because they're algorithmic, i.e. they revolve around the process and the operations by which the AI evaluates a tile, not just the numbers feeding the evaluation). Also, settler targeting doesn't use the unmodified values spat out by the settle plot evaluator: there is a non-linear distance dropoff scaling, where tiles further away from the settler will have their settle values lowered, and this dropoff definitely affects how the AI uses its settlers.
Nope, or at least not in majority. The behavior trees stored in SQL are but a tiny portion of the AI system. Most of the AI actually runs off flavor systems (now renamed pseudoyields) not dissimilar to the way The Sims' scoring systems work.
It unfortunately seems to still count tiles already in your territory, which is a big issue with luxuries etc, and makes it settle a little too close to its own cities, but I don't think we can do anything about that.
Any thoughts on how to proceed with 2 AI mods around btw? It may at least be desirable to use some of each others stuff
Ah, thankyou for the clarification.<snip> ... Nope, or at least not in majority. The behavior trees stored in SQL are but a tiny portion of the AI system. Most of the AI actually runs off flavor systems (now renamed pseudoyields) not dissimilar to the way The Sims' scoring systems work.
Hey, chiming in here. Most of the features have been tested out, including the districts one. The districts work because the default for 'Favored' is true and its set at not null (see the schema), so if you dont add the attribute, it'll pick true. It's only necessary to specify if you want it to be false.
The total yields aspects and the specific resource also work (I have tested them with extreme values and have seen settlers run across the continent to avoid production) and are indicated in the source vanilla, I didn't just think of them on my own haha. They're in agendas.xml and leaders.xml:
Spoiler :
<PlotEvalConditions>
<Row ConditionType="Nearest Enemy City" Value="0"/>
<Row ConditionType="Nearest Friendly City" Value="1"/>
<Row ConditionType="New Resources" Value="2"/>
<Row ConditionType="Inner Ring Yield" Value="3"/>
<Row ConditionType="Total Yield" Value="4"/>
<Row ConditionType="Coastal" Value="5"/>
<Row ConditionType="Fresh Water" Value="6"/>
<Row ConditionType="Specific Resource" Value="7"/>
<Row ConditionType="Specific Feature" Value="8"/>
<Row ConditionType="Resource Class" Value="9"/>
<Row ConditionType="Foreign Continent" Value="10"/>
</PlotEvalConditions>
<Row ListType="TomyrisCitySettlement" Item="Specific Resource" Favored="true" Value="4" StringVal="RESOURCE_HORSES"/>
The total yield has no implementation, but I just tried it the same way as inner yield and well, it works.
You can try a royale game with my mod on and you'll see that the settling spot choices are pretty decent now. It unfortunately seems to still count tiles already in your territory, which is a big issue with luxuries etc, and makes it settle a little too close to its own cities, but I don't think we can do anything about that. You rarely see a settler pick a far spot either until very far into the game.
It does still sometimes do those settler traffic jams which I'm sure you'e experinced too, where it somehow ends up creating 3 settlers, then only has 2 slots for OP_SETTLE, so that it can only run two over. But then it runs them both to the same spot, so once the first settles, the second still has to run somewhere else. Even more slots than 2 for the operation just makes them produce way too many settlers as I saw you experienced tooNot sure what to do about that, not even behaviortrees can solve that I think. Perhaps special settler operations that don't use the contracts to build more settlers.
Any thoughts on how to proceed with 2 AI mods around btw? It may at least be desirable to use some of each others stuff
Ah, I'd assumed that the default state for districts was favored=false.
As for the other stuff related to settle spot evaluation, good to know that it works, I was just on the more hesitant side. It'd still be good to know how some of those values are factored in (e.g. does Nearest Enemy city simply multiply distance x score, or is there a more complex function behind its weighting?), but for the most part, I can guess how those value feed in by looking at the Civ5 settle spot evaluation C++ code and assuming that Civ6's works in a similar way (so far, that has worked for me more often than it hasn't). For example, setting the max failures arguments on nodes 4 and 21 for the Settle City Op behavior tree to -7 is probably pointless: they most likely control the maximum times an internal retargeting loop is run (read: that's what these things did in Civ5), and usually 2 or 3 failures is plenty enough, you don't need to make the AI run until it fails the process 7 times. It's also pointless to set the Attack High Priority and Attack Medium Priority moves to be homeland moves as well, since the functions only exist in CvTacticalAI, there's no way they could be run within a CvHomelandAI loop (really, I highly recommend you have a read-through Civ5's DLL source code if you have the time, it'll give you a ton of insight into how Civ6's code would work). Now, if only there was a way to access the citizen manager's values...
Re: settler traffic jams, that was a problem in Civ5 as well, one that I think CPP / Vox Populi ended fixing the best. Different settle operations can't target the same spot, but they can still target adjacent spots, and this can cause the problems you're seeing, especially with Civ6's new movement rules emphasizing choke points caused by rough terrain even more. Even if you have the settle behavior tree have a bunch of operation retarget leaves, there's nothing stopping two settlers from targeting two adjacent tiles. My usual answer is, "we need DLL source code", but all we really need for a hacky solution is to create a "zone" of bad settle value around a settle operation's target, then make sure said settle operation doesn't see the "zone" it's generating... and it might be possible to hijack one of the existing plot evaluation conditions to set these zones up, hmm...
Re: 2 AI mods, well, right now, Civ6 doesn't have workshop support, and I definitely don't plan on really immersing myself in AI modding until CvGameCoreDLL's source code is released (if it's released), so I'd definitely say we're fine with these 2 AI mods. Besides, nothing's stopping either of us from using each other's code, e.g. I've definitely been using some of notque's code, and I might have a look at those settle plot evaluation arguments now that my attention has been brought to them. I don't mind helping you out with questions, either (or asking you a few myself in the future); PM your Discord if you're up for discovery/testing sharing.
There are a tremendous number of mistakes. It's code, it happens.
However, I suspect no AI alterations, e.g. to the way it judges the value of more movement points, were made to account for this.