Resource icon

AI+ v13.1

Dear Siesta, i have tried out the hotfix Ai+ and Ai+ v12, the AI in hotfix Ai+ is significantly better in terms of how they wage wars and keep up its military (3 Ai have 1.2k military score while i only have 150). This is a good improvement. :goodjob: Here are 3 observations i noticed in deity games.

(1) A important finding is that in hotfix Ai+, AI DO NOT build city walls at all. For Ai+ v12, one city out of 15 will build a wall. :o This makes their cities either vulnerable to the human player or to the other computer civs(the AIs civ easily managed to snipe off other AI cities since they do not have walls, even though they have much lower military tech and prowess.)
(2) Siege engines station at their cities refused to fire even if my units is just next to it. :sleep:

(3) When i have city walls, they will wait a long time before considering attacking it. Without city walls, they are like vultures aiming at my cities. :scan:

(4) Ai are still too friendly, even those neighbouring civs. I am not threatened even my neighbouring civs have 10 times the military score than mine. :crazyeye:

(5) Barbarians seems to think and wage wars more efficiently, as they ignore how much units you have and bullldozed our city, is there AI code different from the main civs?

Thank you for the patch!
 
Last edited:
The AI being too friendly is a big issue indeed but unrelated to AI+ I think. Basically once you declare friendship and later became allies you can stay that way for the entire game without any effort. Nothing will piss them off you can wipe out their religion, ally their friends, break promises etc. When its time to renew friendship, even if there are more negative vs positive modifiers, they accept. Something is bugged or off balance in the code.

Also, except the very early game, it's very common for AI to accept friendship AND alliance the very first turn of meeting them. Again, seems like a bug in the code behind the scenes.. All this on Deity. There seems to be either some large hidden positive modifier or the thresholds for accepting friendship is bugged.
 
The AI being too friendly is a big issue indeed but unrelated to AI+ I think. Basically once you declare friendship and later became allies you can stay that way for the entire game without any effort. Nothing will piss them off you can wipe out their religion, ally their friends, break promises etc. When its time to renew friendship, even if there are more negative vs positive modifiers, they accept. Something is bugged or off balance in the code.

Also, except the very early game, it's very common for AI to accept friendship AND alliance the very first turn of meeting them. Again, seems like a bug in the code behind the scenes.. All this on Deity. There seems to be either some large hidden positive modifier or the thresholds for accepting friendship is bugged.

Yeah unfortuantely I'll never be able to change something about this part of the code without dll access :( The diplomacy system can be really wonky, and it's very visible to players, so it's definitely one of the more important sections to have it feel sensible, but alas..


Dear Siesta, i have tried out the hotfix Ai+ and Ai+ v12, the AI in hotfix Ai+ is significantly better in terms of how they wage wars and keep up its military (3 Ai have 1.2k military score while i only have 150). This is a good improvement. :goodjob: Here are 3 observations i noticed in deity games.

That's great to hear! I'll take your concerns into account for the next patch too.
Unfortunately for (4), I won't be able to do much about relationship modifiers and trade deals, but I can get them to declare war. I hope to be ale to find a right balance in it, so that you don't get weird situations where I make it declare war, only for the inbuild AI to offer peace again in 10 turns.

About (5), barbs do indeed play somewhat differently. But the main difference isn't that they're much better at combat, it's that they don't have to care about their own units lives as much. That makes them feel much more dangerous. Humans will also think the barbs are successful after a few unit kills + pillages, while we expect enemy civs to be able to conquer cities.
 
So I was wondering what you guys thought about something for the next patch.
As it turns out, I can also control city states very well using lua and make them play differently. I don't think anyone would really oppose somewhat smarter city states, but I can also make city states do stuff that feel distinctively unlike city states.
For example, I can make their units cover much longer distances, to for example destroy barb camps or do scouting. I feel like this makes them more powerful, but it's also rather odd. You don't really expect to see random city state units half a continent away from their origin city state. And that also impacts the game quite a bit because you meet a lot more city states.
I can also make city states do things like building trader units. Again, something that helps them, but something which feels rather weird because they don't in the base game.

So here's my question. to what degree would you like to see city states changed? Should I make them as smart as possible, which may make them feel like normal civs playing a one city challenge or should I keep this feeling that they're completely different things?
 
having them build traders sounds reasonable, having them send units far away from their city would be weird. You could take a look at city states expanded mod, they change how CS behave a bit :)
 
I am pretty sure CSs already build traders. I too think major civ AI is primary; CSs should focus on maintaining the best defensive military they can not to get invaded and that's it.
 
It's not that I want to put in tons of extra effort into city states, it's that by doing entire rewrites parts of the AI behavior, the city states would without additional changes act exactly the same as normal civs. Which isn't desirable. They shouldn't build wonders or try to secure good settle spot locations for example.
 
IMO:

CSs units:
make them cover area something like the span of another city, that is:
say, max 8 tiles from city center...

CS should
- have military to able to defend itself,
- also, when attacked or at war, build units...
- (perhaps save up money so to rush buy some army?)
- have walls and ranged unit in city...

- have districts and buildings according to CS-type
 
Yeah unfortuantely I'll never be able to change something about this part of the code without dll access :( The diplomacy system can be really wonky, and it's very visible to players, so it's definitely one of the more important sections to have it feel sensible, but alas..

@Victoria knows quite a bit about diplomacy modifiers. Maybe there's something possible?

So here's my question. to what degree would you like to see city states changed? Should I make them as smart as possible, which may make them feel like normal civs playing a one city challenge or should I keep this feeling that they're completely different things?

They already do build traders, actually.
As for what they should/shouldn't do, in my opinion they should keep their units relatively close (including naval units, which isn't always the case currently), and focus on defense. I do like the traders though. Also, they should keep developing the city and building districts.
 
Hey @Victoria it's not just simply making the less friendly but fixing the system that appears to be bugged somehow. See my observation below; do you agree and/or know the cause?


The AI being too friendly is a big issue indeed but unrelated to AI+ I think. Basically once you declare friendship and later became allies you can stay that way for the entire game without any effort. Nothing will piss them off you can wipe out their religion, ally their friends, break promises etc. When its time to renew friendship, even if there are more negative vs positive modifiers, they accept. Something is bugged or off balance in the code.

Also, except the very early game, it's very common for AI to accept friendship AND alliance the very first turn of meeting them. Again, seems like a bug in the code behind the scenes.. All this on Deity. There seems to be either some large hidden positive modifier or the thresholds for accepting friendship is bugged.
 
Sadly one suspects as do both of you this is code bound.
The accept envoys on the first turn is a good example of this that has always been there but they do seem to be throwing more into the bucket. The allies bit was there before R&F, I could be -100 with Barby for spying amd he would still open his sleeping bag for me.
I know the joint wars are not everyone’s cup of tea, they seem OK to me but where they are specifies seems code bound again.
Trade is a great example of the point that if you do not explain the concepts to the players they often get the wrong idea and in some cases it is broken. Code bound also and sadly the no communications policy is the safest way nowadays where the world is full of critics amd flamers.
 
So is Civ's AI hard coded into bunch of "if, then" clauses or does lack of DLL access means one doesn't even know how the AI code is phrased?

Could half decent results be met with simple conditions like:

******
production
if peace 10% of production on units.
if still not top military out of threats, 20% on units
if neighbor denounced, 25% on units.
if neighbor has 3+ units 5 hex away, 30%.

production if war is lasting:
if war distant: 30%
if war w neighbor: 40%
if a forward city faces defeat: 50%
if major city faces defeat: 60%
if capital faces defeat 75%

(all % until upkeep can be met)


when to decide to declare war (threats):
if opponent a neighbor- 10%
if opponent settles nearby- 10%
if opponent settles nearby again - 20%
if opponent buys land so it borders after purchase - 10%
if opponent tries to convert religion- 10%
if religion convert again- 15%
If opponent spies: 10%
if opponents spies again: 15%
if opponent makes a demand: 10%
if opponent denounces: 25%
if opponent has 3-4 units 5 hex away, 1% per turn. 50 turn duration.
if opponent has 5-9 units, 3% per turn.
if opponent has 10-19 units, 10% per turn.
if opponent is found to plan joint war - 30%
+special random modifier.
if some of the above has total of 100% or more, decision to go to war is made. units are first assembled and then war is declared.


special cases -
if opponent has city close, which has strategical resource that AI lacks and if 50% weaker - 10-50% (domination victory condition preference)
if opponent has city close, which has luxury resource which AI lacks, and if 50% weaker - 5-25%.

if opponent is 100% of strength as AI - AI looks into joint war. if joint war does not lower the percentage under 100%, AI does not declare war. all else is overridden.

military strength is each unit (certain units lose value if too disproportionate in numbers, like siege rams) times its attack value.

if war decided - check if there are multiple threats. weigh them. appropriate available units per threat. send units to a threat, close by. if war not declared yet, wait for declaration.
if war declared - check where threat's units are. check what can be seen. send stronger army, if possible. if army not stronger, then defensive stance.

if threat city nearby, check for units around it. check for approach vector. how many units could fire at once. how many turns would need to surround the city. how much damage would own units suffer while surrounding. if stronger, based on units and city strength, send units tasked to that particular threat/subthreat.
*****

and then have them subdivided into bunch of local sub-threat areas? Or would checking of all those mean 2 minute turns for AI to compute all that?
 
Could half decent results be met with simple conditions like:
sure or even an array each of these conditions is taking nanoseconds (10-100 maybe) and there is a billion nanoseconds in a second. You could code a million decisions and not notice if it was not for the pretty stuff and exceptions you also have to wrap around this code.
No access to the functions so no clues possible beyond what was seen in civ V
A deal screen does not slow a turn noticeably because it’s interactive.
 
Last edited:
So is Civ's AI hard coded into bunch of "if, then" clauses or does lack of DLL access means one doesn't even know how the AI code is phrased?

Lack of dll access means we can't see the code, correct.
But we do have access to xml files and logs, which betray a lot about the internal code. The system used also seems very similar to civ 5 codes in places, which suggests theres code reuse, and since we know the civ 5 code, we can infer some things.
It depends a bit on the system, but most of the internal civ systems use some kind of heuristics. For example building buildings, it calculates the worth of buildings based on the yields, then compares all the buildings and picks what it thinks the best one is. The desire for each yield can then depend on some factors
This is honestly probably one of the best approaches if done well, which it unfortunately isn't.

Internal diplomacy logic is a bit less clear. But it too seems to put certain values on items in a trade, and then calculates whether a deal is acceptable enough (also taking relationship into account)
Again, the problem isn't that it's a bad approach, it just doesnt seem to be tweaked very well. It doesnt make much sense to only accept 1 for 10 resource trades or something, even if you hate someone else, youll benefit from a 1 to 1 luxury trade.

Your declaration of war system actually looks a lot like what they used in civ 5, but they've done something entirely differently in civ 6. Luckily I'll be able to overrule (non joint) war declaration so I can try to build something better.
What you describe is computationally no problem. Usually you get into computational issues because of some algorithms with nested loops. Like, suppose you want to determine for every tile what the fastest path to every other tile is. Because of the large numbers of start tiles, the large number of destinations and the large number of possible paths you run into computational limits. A couple of small checks per turn for just one player is no big deal at all
 
So er, has anyone here tried to do an entertainment complex spam strategy to see if it was viable?

While working on the next version, something I did in my build logic made the AI spam entertainment complexes in every city. And while it looks dumb, funnily enough, I'm getting my best results with the new build system so far. As in, a prince level AI having both nationalism as well as renaissance techs in 1300AD while having plenty of troops.

And thinking about it, it does make some sense. They're getting much bigger cities with more districts, and are profiting from the % bonuses for happy cities + all the free culture and science on larger cities. It just never occurred to me to actually try spamming them.
 
So er, has anyone here tried to do an entertainment complex spam strategy to see if it was viable?

While working on the next version, something I did in my build logic made the AI spam entertainment complexes in every city. And while it looks dumb, funnily enough, I'm getting my best results with the new build system so far. As in, a prince level AI having both nationalism as well as renaissance techs in 1300AD while having plenty of troops.

And thinking about it, it does make some sense. They're getting much bigger cities with more districts, and are profiting from the % bonuses for happy cities + all the free culture and science on larger cities. It just never occurred to me to actually try spamming them.

I could try it out in my next game. Other people will probably be faster though.
 
Top Bottom