AI Defense pacts a needed upgrade

Cedbird

Warlord
Joined
Dec 31, 2009
Messages
217
I thought with BNW with the world becoming more integrated and the focus on cooperation and pacts this would be also in the game. But I am surprised and disappointed that this is not the case. This would make things so much more interesting and challenging. As human players we can sign a defensive pact and be safer. But the AI cannot. I am a Emperor player and probably wont go any higher ever I like the more realism/competition of human player/AI balance. So a little extra challenge for me great. I can single out any AI Civ I want and chances are I will take them out or have someone else do it without any other immediate military repercussions. Not true in the real world.
 
I can single out any AI Civ I want and chances are I will take them out or have someone else do it without any other immediate military repercussions. Not true in the real world.

Somebody want to count out how many territories Hitler absorbed before the rest of the world drew the line at Poland? :lol:
 
Somebody want to count out how many territories Hitler absorbed before the rest of the world drew the line at Poland? :lol:

To be fair Hitler was appeased, rather then ignored.

@OP I did not know the AI could not engage in DP. Are you sure about this ? I guess it does not surprise me, the HUMAN players gets many advantages that the AI just does not get, but still.........

I will have to delve into the code and see why/why.

Thanks for the info.
 
@OP

Well it look like you are right. I have checked most of the areas where the code for a DP deal would be listed and DP deals being proffered AI-AI or AI-HUMAN are absent.

The code does not actually prevent DP between AI's, the functions are all there and could be activated with about 5 minutes of effort.

It is unclear to me why this is not the case. I am assuming they want BLOC's to be formed through IDEOLOGIES rather then DP and that DP's are legacy diplomatic devices left over from VANILLA Civ V. Also perhaps DP's might prevent AI's from declaring war leading to a passive end game.

I don't think I misinterpreted the code, but if I did I would be glad to hear from anyone who wants to correct me.

Its a shame really. From my own perspective I now wont be using DP as it gives to much advantage IMO.

:(
 
I am assuming they want BLOC's to be formed through IDEOLOGIES rather then DP
But almost every ai pics order. Yes, there is sometimes some poor bastard pics freedom, or some warmonger pics autocracy. But former is irrelevant and latter hated by everyone to begin with. I'm yet to see 2-3 ai civs groups with different ideology, and i'm always play on large maps with 2-3 additional ai.
 
@OP

Well it look like you are right. I have checked most of the areas where the code for a DP deal would be listed and DP deals being proffered AI-AI or AI-HUMAN are absent.

The code does not actually prevent DP between AI's, the functions are all there and could be activated with about 5 minutes of effort.

It is unclear to me why this is not the case. I am assuming they want BLOC's to be formed through IDEOLOGIES rather then DP and that DP's are legacy diplomatic devices left over from VANILLA Civ V. Also perhaps DP's might prevent AI's from declaring war leading to a passive end game.

I don't think I misinterpreted the code, but if I did I would be glad to hear from anyone who wants to correct me.

Its a shame really. From my own perspective I now wont be using DP as it gives to much advantage IMO.

:(

Good points. Good points. The best point is that it is built in that the AI wont use DP's between AI Civs because it will lead to passive games . I did not think about that.
Here is a good fix though.
Number one - I feel that the AI in BNW is not aggressive enough. Give the AI a % 5 to 15 % aggression boost depending on the Civ. This will compensate on the lack of aggression for the AI which I think did need a tamp down from GK but is too docile now. But will give certain Civs that killer instinct again.
Number 2 - Its more of a point to make. The AI is going to way different things when making a pact with another Civ. Just like it does with humans players. So pacts will not be so common that it totally disrupts the game. And depending on the Civs in the pact and the anger,greed, and strength of the AI player they may still decide to go to war. Especially is they have Allies going with them.
I think if the Devs wanted this to happen they could make some tweaks and do it.
 
But almost every ai pics order. Yes, there is sometimes some poor bastard pics freedom, or some warmonger pics autocracy. But former is irrelevant and latter hated by everyone to begin with. I'm yet to see 2-3 ai civs groups with different ideology, and i'm always play on large maps with 2-3 additional ai.

Well I was more talking about what the designers may have been thinking.

If you check one of my other posts I go through how the AI picks an IDEOLOGY, and why.

The problem is that ORDER is considered a good choice for a number of reasons and as such gets picked early. Then as more AI's join in they tend to favour what there friends have picked and so it balloons out. Additionally once a couple of CIVS have it, any Civ that will experience unhappiness from another IDEOLOGICAL choice will be heavily influenced to go with the dominant one. NOTE : AI's that favour ORDER (on first pick) will be those that DO NOT prioritise the DIPLOMATIC VICTORY (See my other posts on these forums about AI GS to see what plays into this), and who DO favour the SCIENTIFIC GRAND STRAGTEGY (most of all if possible) and the CULTURAL GRAND STRATEGY. If there CONQUEST GS/ CULTURE GS is highest then they are more likely to favour AUTOCRACY, if DIPLOMACY GS/CULTURE GS is HIGHEST then they will favour FREEDOM. Cultural GS civs will tend to choose the ideology (all other things considered equal of course) that supports there second highest GS (Ie SCIENCE, DIPLOMACY or CONQUEST). IIRC quite often strong CULTURE Civs have reasonable DIPLOMATIC GS scores and as such will go FREEDOM.

If you don't want order to be dogpiled ensure that whoever picks it first gets diplomatically isolated (ie no friends and plenty of enemies) this will put a significant bias against ORDER. If you really want to make a difference, ensure that whoever picked FREEDOM (or AUTOCRACY) has lots of friends and no enemies.

Anyway I will look into more soon, but check out that other link below. It provides clear run down of how the AI chooses its IDEOLOGY and is lifted straight from the BNW codebase (code provided if you are interested).

http://forums.civfanatics.com/showpost.php?p=12639961&postcount=12
 
But almost every ai pics order. Yes, there is sometimes some poor bastard pics freedom, or some warmonger pics autocracy. But former is irrelevant and latter hated by everyone to begin with. I'm yet to see 2-3 ai civs groups with different ideology, and i'm always play on large maps with 2-3 additional ai.

The extra 2-3 AI's on a huge map unbalance's IDEOLOGY choice (as I have mentioned in past posts). I am not criticising your choices here BTW juust providing an explanation. More CIVS actually makes for a more interesting games (defence wise) especially on a HUGE map, but has other consequences. Unfortunately the further you get away from the default game parameters the more unbalanced the game becomes (whether this be size, speed, civ number etc etc). The game plays best (balancewise) on a STANDRAD/CONTINETS/8ish CIVS/16CS/STANDARD SPEED. Anything you alter unbalances the game mechanics just a little bit. Alter to much and things get squirly. Sure certain things Firaxis could have ensured scale in a balanced way (and in many things they do), but other things are just not that easy to program unfortunately.

I would suggest dropping the size of the map and maybe adding 1 extra civ. (I know this is a pain, I like lots of civs too. But think of it this way, less civs makes each civ all the more important.

FYI The game does not scale the results of the IDEOLOGY calculation based on CIV NUMBER, so the more people following ORDER who have friends the more likely it will be chosen. This balloons out after a while as by this time in the game there are generally quite a few FRIEND-BLOCS already formed. As a consequence of gameplay the first AI's to reach IDEOLOGIES are the more tech advanced and generally (although not always) following a SV (which favours ORDER IIRC). CIVS following an SV quite often have friends, which further skews the calculation.

BTW Anyone who wants a 100% effective way of determining what GS an AI is following can do so by looking at what GP an AI chooses upon receiving a FREE ONE (Ie through a POLICY/WONDER etc). CONQUEST = GENERAL, CULTURE = ARTIST, SCIENCE = SCIENTIST and DIPLOMACY = MERCHANT. The only exception to this is players who are WONDER-WHORES (ie EGYPT) and have a Wonder that can be built, they will always spawn an ENGINEER. This is a 100% effective way of determining the AI GS and is straight from the code. Or you could just turn on logging and check the logs as they are updated each turn :) Or be like me and try and work it out from witnessed gameplay for added immersion and frustration :)

APOLOGIES FOR THE DOUBLE POST RESPONSE. NOT SURE WHY I MADE TWO POSTS INSTEAD OF DOING IT UNDER ONE, I USUALLY ONLY DO THIS IF I AM ADDRESSING MORE THEN ONE PERSON AND HAVE A LONGER ANSWER TO PROVIDE. SORRY ABOUT THAT.
 
Good points. Good points. The best point is that it is built in that the AI wont use DP's between AI Civs because it will lead to passive games . I did not think about that.
Here is a good fix though.
Number one - I feel that the AI in BNW is not aggressive enough. Give the AI a % 5 to 15 % aggression boost depending on the Civ. This will compensate on the lack of aggression for the AI which I think did need a tamp down from GK but is too docile now. But will give certain Civs that killer instinct again.
Number 2 - Its more of a point to make. The AI is going to way different things when making a pact with another Civ. Just like it does with humans players. So pacts will not be so common that it totally disrupts the game. And depending on the Civs in the pact and the anger,greed, and strength of the AI player they may still decide to go to war. Especially is they have Allies going with them.
I think if the Devs wanted this to happen they could make some tweaks and do it.

Well the passive end game thing was my opinion of why IT MIGHT not be in the game, rather then directly lifted from an in code comment. Just wanted to make that clear lest anyone thinks I am taking liberties here :)

What was from the code was the fact that the code is there to support them but is not activated (unless a human does it of course). Unfortunately the code for whether an AI will accept a DP is very simple (it was more complicated but the DEVS removed parts of it). Now all that really matters is the AI's opinion of you (NOTE I said OPINION not APPROACH. APPROACH is what is listed in the DIPLOMATI window in game (ie GUARDED etc). OPINION is not listed (except through logging files). Essentially be good to the AI and they will have a better OPINION (ie return workers, don't break promises or make demands, give them stuff when asked etc).

If I had more time I would respond in detail to your points. BUt here goes in brief.

POINT 1
Agree in principle but would prefer fixing the reasons why the AI is less aggressive. Some of this was for the better (making the AI attempt an attack that will never work is never a good thing IMO). The main reason is the lack of gold and that the AI does not pick a GS until 50 turns are up (this was to fix the old we are trying to win the same way on turn 2 issues from vanilla). This means a CONQUEST GS is never active during the first 50 turns, and a CONQUEST GS is the quickest way to AI aggression :) There is more but I am pressed for time so I will end this point by saying good thinkin, but I thjink addressing the reasons for the lack of aggression is better. BTW SLighly increasing the number of CIVS per map (and not playing on HUGE maps0 will help increase aggression, its what I do to assist with this. I regularly get CLASSICAL wars (but not ancient), with more militant (but not warmonger) civs.

POINT 2
Yes you are right they could pretty much make anything happen. The problem is time. The code is enormous, and each change has compounding effects (the ORDER issue from Ideologies is one, the code that governs it seems pretty damn detailed, but due to the nature of the game tends to favour ORDER). I will say this however the code is very well written (in terms of layout anyway). It is very easy for me to easily find whatever I want when a question from these forums needs a code based answer. I would not be able to do that with many other (more poorly organized codebases from other games) with the time I have available to answer peoples queries (or make my own points) and as such wouldn't even try. When you can zip through the codebase, isolate the code for IDEOLOGIES, digest it, and respond to posters with the full code and some more easy to understand pseudo code in less then 15 minutes, then the designers have done an exceptional job ... because trust me I am no Einstein :). Thanks for this FIRAXIS.
 
POINT 1
Agree in principle but would prefer fixing the reasons why the AI is less aggressive. Some of this was for the better (making the AI attempt an attack that will never work is never a good thing IMO). The main reason is the lack of gold and that the AI does not pick a GS until 50 turns are up (this was to fix the old we are trying to win the same way on turn 2 issues from vanilla). This means a CONQUEST GS is never active during the first 50 turns, and a CONQUEST GS is the quickest way to AI aggression :) There is more but I am pressed for time so I will end this point by saying good thinkin, but I thjink addressing the reasons for the lack of aggression is better. BTW SLighly increasing the number of CIVS per map (and not playing on HUGE maps0 will help increase aggression, its what I do to assist with this. I regularly get CLASSICAL wars (but not ancient), with more militant (but not warmonger) civs.

POINT 2
Yes you are right they could pretty much make anything happen. The problem is time. The code is enormous, and each change has compounding effects (the ORDER issue from Ideologies is one, the code that governs it seems pretty damn detailed, but due to the nature of the game tends to favour ORDER). I will say this however the code is very well written (in terms of layout anyway). It is very easy for me to easily find whatever I want when a question from these forums needs a code based answer. I would not be able to do that with many other (more poorly organized codebases from other games) with the time I have available to answer peoples queries (or make my own points) and as such wouldn't even try. When you can zip through the codebase, isolate the code for IDEOLOGIES, digest it, and respond to posters with the full code and some more easy to understand pseudo code in less then 15 minutes, then the designers have done an exceptional job ... because trust me I am no Einstein :). Thanks for this FIRAXIS.

Thanks for this, GABRIEL. :)

You've mentioned how the code is written to favour Order. How difficult,in your opinion, would "the code" be to rewrite so that it favours a more equal distribution for the Civs?
 
It would be nice if the AI knew who you had a defensive pact with. In one game, I had a defensive pact going with England, and France DoWs England. This is a problem, as I'm allied with France. So I automatically declare war on France and take a huge diplo hit. That's why you don't make defensive pacts.
 
Thanks for this, GABRIEL. :)

You've mentioned how the code is written to favour Order. How difficult,in your opinion, would "the code" be to rewrite so that it favours a more equal distribution for the Civs?

Well to be honest I probably should have chosen my wording a little more carefully :)

The code does not EXPLICITIELY favour order, its the way the game unfolds that tends to ensure ORDER gets favoured (See my previous posts for more info). In other words the code seems more then comprehensive enough (and probably has a little more thought put into then some players do into their ideological choices :) ) but due to the way IDEOLOGIES unlock (ie favours tech leaders, tech leaders tend to be SV Civs, SV Civs tend to favour an initial ORDER choice and have more friends then enemies, future civs tend to go for what their friends pick and not what those they are hostile/war with do etc. So it is an emergent problem rather then a HARD CODED one.

As to making it happen less. Yes that would be fairly easy, although any change needs to be balanced against what problems you can introduce :)

I would suggest boosting the priority of any policy that has not been chosen by a little more, reducing the dependence on friends/enemies (although this should still be a factor) and probably capping this number or scaling by the number of civs in the game.

I would also change the code that looks at happiness gains/losses for each policy to compare against the current AI happiness. So that Civs with large happiness reserves are less worried by happiness losses.

You don't want the AI to make a counterproductive choice, but Civs that are more dominant in the game ie top 2-3 civs should be more inclined to choose whats best for their victory condition and less affected by other factors as their civs can probably absorb the happiness or diplomatic issues that arise.

Perhaps the AI should decide if a factor is really worth considering for the current Civ, before adding that factor into the mix ie we have +90 happiness should equal I DONT CARE WHAT THE HAPPINESS PENALTIES ARE (unless I am really into GOLDEN AGES of course) :)

Please check out my other thread/post (I linked it above somewhere) if you want to know how the AI currently chooses things. I have broken it down into fairly simple steps for those who are not code-monkeys and provided the code for those who are. You might be able to come up with your own ideas from this.

So SHORT ANSWER = YES, and failry quickly. CAVEAT : Any change can incur unforseen consequences, the current ORDER issue is one such example, so care must be taken.
 
So player ideology choice is irrelevant?

No. Apologies if I implied this.

The HUMAN (or any player AI or not) players IDEOLOGY choices affect an AI's choices in the following ways.

1. If an IDEOLOGY exists that no one has taken then it is more likely to be taken by an AI.
2. The IDEOLOGICAL choices of all of a given AI rivals Civs all affect the choice. Whether the probability of a given ideology being taken goes up or down depends entirely on the relationship between the two civs ie if they are friends it becomes more desirable, if they are enemies it is less desirable.

That's essentially the only way the human's choices can affect the AI. The second component however is a big one and contributes greatly to the ORDER bug when you have many civs. So do not underestimate the power of your own choice, particularly if you have many friends or enemies.

Please check the post here for more info. If you have any problems understanding it just post a question and I will do my best to help.

http://forums.civfanatics.com/showpost.php?p=12639961&postcount=12
 
Interesting find in the code Gabriel.

If I understand the ideology code correctly an order-, freedom-, autocracy-priority for the AI is initially set to 0 and then increased through 5 of the 7 steps you mentioned in the linked post (i.e. victorytype > freetenets > friend&enemy choices>happiness impact>randombump).

The linked code doesn't seem to reveal the relative impact of each of the steps however.
Nonetheless I think it wouldn't be too difficult to correct for the number of civs on a map. Take a look at this part:

Spoiler :
case MAJOR_CIV_APPROACH_FRIENDLY:
if (eOtherPlayerIdeology == eFreedomBranch)
{
iFreedomPriority += GC.getIDEOLOGY_SCORE_FRIENDLY();
}
else if (eOtherPlayerIdeology == eAutocracyBranch)
{
iAutocracyPriority += GC.getIDEOLOGY_SCORE_FRIENDLY();
}
else if (eOtherPlayerIdeology == eOrderBranch)
{
iOrderPriority += GC.getIDEOLOGY_SCORE_FRIENDLY();
}
break;


We have iOrderPriority += GC.getIDEOLOGY_SCORE_FRIENDLY(); this means: if a friendly civ has chosen order then increase the value of iOrderPriority by the value that rolls out of the function GC.getIDEOLOGY_SCORE_FRIENDLY(); If the latter is a fixed value, it might not be a big deal to scale this by the number of civs.

In pseudocode:

iOrderPriority += GC.getIDEOLOGY_SCORE_FRIENDLY() *(standard_nr_of_civs/actual_nr_of_civs);

Am I seeing this wrong?
 
Interesting find in the code Gabriel.

If I understand the ideology code correctly an order-, freedom-, autocracy-priority for the AI is initially set to 0 and then increased through 5 of the 7 steps you mentioned in the linked post (i.e. victorytype > freetenets > friend&enemy choices>happiness impact>randombump).

The linked code doesn't seem to reveal the relative impact of each of the steps however.
Nonetheless I think it wouldn't be too difficult to correct for the number of civs on a map. Take a look at this part:

Spoiler :
case MAJOR_CIV_APPROACH_FRIENDLY:
if (eOtherPlayerIdeology == eFreedomBranch)
{
iFreedomPriority += GC.getIDEOLOGY_SCORE_FRIENDLY();
}
else if (eOtherPlayerIdeology == eAutocracyBranch)
{
iAutocracyPriority += GC.getIDEOLOGY_SCORE_FRIENDLY();
}
else if (eOtherPlayerIdeology == eOrderBranch)
{
iOrderPriority += GC.getIDEOLOGY_SCORE_FRIENDLY();
}
break;


We have iOrderPriority += GC.getIDEOLOGY_SCORE_FRIENDLY(); this means: if a friendly civ has chosen order then increase the value of iOrderPriority by the value that rolls out of the function GC.getIDEOLOGY_SCORE_FRIENDLY(); If the latter is a fixed value, it might not be a big deal to scale this by the number of civs.

In pseudocode:

iOrderPriority += GC.getIDEOLOGY_SCORE_FRIENDLY() *(standard_nr_of_civs/actual_nr_of_civs);

Am I seeing this wrong?

No you are not seeing it wrong (IIRC and am not getting it wrong myself :) ).

That is what you would do, but it would only account for extra civs above the standard number. Unfortunaetly the code DOES NOT account for MAP SIZE and therefor any larger number of Civs (regardless of whether it is the right number for the map size or not) will lead to problems.

Personally I think they need a non-linear means of scaling, ie first civ friends/enemy adds the most, next civ adds a little less etc.

This would at least help in this regard, but it may not alleviate the problem, the amount added may need to be tweaked too.

I didn't link the code that determines the amounts as I was trying to keep it as brief as possible (as my responses tend not to be at the best of times :) ) whilst still showing people I was not just making it up and allowing others to check my interpretations.

I will dredge it up later on today and link it so you can have a look at it. I will also put a new post on the forums with instructions for people to allow them to get their own copy of the code (if they do not already know how) and will try and provide links to which files the code comes from in future.

BTW The happiness calculations may also cause some issues. I have yet to see how they play out, and have some suspicions I need to confirm/debunk; especially given the tendency for SCIENTIFICALLY flavoured Civs to be the first to choose IDEOLOGIES.

NOTE : I do intend to get a comparison of values done so we can all see the power of each of the components ; (like I did in the thread regarding CS TRIBUTES in the BNW subforum). Unfortunately time is an issue :)
 
Top Bottom