• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

unmerged(31425)

Married Man
Jul 2, 2004
2.826
0
Introduction:

I'm making this guide for three reasons:to assist modders in modding, to help promote AI focus in modding(because I'm convinced this makes for much better mods), and because, frankly, I'm getting a little annoyed with having to explain how AIs work and are effected by such and such, and then having people misunderstand my explanation or even worse doubt it!

All are free to post in thread and discuss/debate/ask questions about AIs and how they work. The first 10 posts are reserved by me for using as chapters in this guide. If they are not all filled out, don't worry. Eventually they will be. These kind of things are too big of projects to fill out all at once. Just keep checking back on the first 10 posts of this thread. Eventually it will all be filled out.
 
Last edited:
Chapter 1: AI File Setting Description

Chapter 1: AI File Setting Description

All AIs can have their behavior modded to some degree. Individual AI files can be assigned to each AI in a mod. They can be made to be used by an AI country, when the games starts, when a country reappears, and can even be made to kick in via an AI only event, that you will not see in the event log. The 3rd use here of course means that a single AI country can have numerous AI files, all assigned to various specific times or circumstances via hidden AI switching events.

What is in code is given in the AI read-me file of the AI EU2 folder. This is a read-me for a generic AI file. You can of course make one yourself. I'm going to comment on it, give more extensive descriptions, and make comments for uses of settings as it applies to each mentioned setting.
Code:
# No preferred areas at all. Default AI does not colonize.
#
continent = { }
region = { }
area = { }
This is used to specify where an AI will explore and colonize. It is used for both. Lists of regions, continents, and areas can be found at Havard's website. Here is a link for it.
http://home.broadpark.no/~havmoe/EU/events.htm
Scroll down a little on his webpage. On the left You'll see where it says, "Appendices." Click where it says, "A - Continents, Regions, and Areas." It gives a complete list of these.

Also here is a map of these and for sea regions as well.
http://www.europa-universalis.com/forum/showthread.php?p=2679039#post2679039

If no areas are specified, an AI will explore/colonize America and then elsewhere.

Specifying these areas is an extremely useful setting to mod. With good selections, an AI can consistently colonize and explore where you want him to. The exploration part is very tricky though. I'll explain it further in the Conquistadors and Explorers chapter.

Code:
# The amount of provinces we try to colonize at the same time
expansion = 0
This is a very important setting. With expnasion 0, the AI will 99% of the time neither explore nor colonize. At 1-2 he will explore but less often. 3 or more is optimal for prolific exploration. An even higher setting seems to make the AI explorer even more frequently, but 3 is usually sufficient. The extra benefit of having it as high as say 15 or even 20, is small. He won't explore faster by a large margin past 3.

It also effects how many colonies/TPs an AI wil make before he starts another one. What he will do, is say it is set on 3, then he will not colonize or TP any provinces beyond a count of 3 until he colonizes a colony up to 1,000 population or TPs a TP up to level 6, then he will make another colony or TP.

Having a high setting on exploration can make an AI run out of colonizeable provinces in the specified area too quickly. He then, without having many of these colonies up to 1,000 or TPs up to 6, starts colonizing and TPing provinces that are not on his list. Make sure that specific AI can handle a high number or else you're just making him grab places you don't want him to, with a high setting.

Code:
# % of the time we prefer to establish a tradingpost if both are good.
tradingpost = 20
This is an extremely important setting as well. This determines how likely an AI is to make a TP or a colony with his colonists. A setting of 20 will actually make him make a decent amount of TPs. Don't let the number fool you. And at 100 he won't make exclusively TPs either, he'll still convert them occasionally to colonies.

If you want the AI to rarely make TPs past level 1 and start turning level one TPs into colonies or just making colonies from scratch instead of making a bunch of TPs(a good idea if that AI has the money to do this and he you want him to), don't be afraid to set it to 10 or even as low as 5. Even at 5 he'll make a few TPs here and there, but mostly colonies.

Keep in mind that AIs don't have the sense to know when to colonize and when to TP. They have to be programmed to. If an AI even has a setting of 20, he'll often spend his colonists wastefully and by no means will be able to colonize as efficiently as you. For most colonizing majors, this setting should be 15 max, unless you want that particular AI at a particular time to not have colonies, then a setting of 80 is good. 5 is a very good setting for a midgame England for example. 95 is good for AIs that should rarely have any lasting colonies.
Code:
# Bonus for areas to establish colonies adjacent to previous ones.
neighbour = 50
This setting is complete garbage. It's only real value is as a negative value, and yes it can have one. Essentially what this setting does is make AIs colonize undesired locations simply because they are adjacent to a desired colony that it already started. I recommend keeping this, 99.999999% of the time on zero, unless you want that particular AI to spread out colonies and not bunch them together, in which case a negative setting can be used. I use a negative value on this setting for my Portuguese AI in the 15th century, to make him spread out over west Africa and not colonize a good number of adjacent west African provinces.
Code:
# Bonus/Penalty for establish colonies adjacent to other countries.
enemies = -50
This is another oddball setting. Don't know why he has it on -50 but it's a hell of alot better than +50. Essentially a positive setting here makes the AI want to not colonize provinces adjacent to provinces owned by another country. This is almost completely useless, as it will make him pick less valuable colonies and ones that are harder to colonize than he otherwise would, simply because all the good provinces have a neighbor.

Even as a negative setting it is odd because it can have the exact same effect if the better provinces don't have a neighbor.

I recommend keeping this on zero 99.9999% of the time and I can't even think of a scenario where a positive setting here could possibly be useful at all.
Code:
# 100 = max trader rate, lesser means slower focus on sending a trader.
traders = 100
This is a useful setting. This effects the tendency for an AI to send a merchant to a COT. If it is low he'll be hesitant to do this. But very often he'll then send them in larger numbers anwyays simply because he has nothing else expediant that he needs to spend money on. I recommend this setting often be high. It can be useful to leave it low with poor colonizers, like 15th century Portugal. This is because it competes with spending on colonists. And if colonizing is more important for the AI at the time, then he ought to be spending more on that instead.

But in the long run, important countries, especially if they have high trade efficiency should have this setting high. In general AIs will spend their merchants anyways. I'll comment more on AIs and merchant placing in the spending chapter.
Code:
# 100 = Total monopolist, will refuse trade as much as possible.
monopoly = 25
This effects how likely an AI is to embargo another country that keeps filling up it's COTs or it is at war with. It is of course irrelevant if the poor AI is still stuck on 3 trade level or lower. This happens often. Poor AIs! But for level 4 or higher, it can be very useful, depending on whether you want that particular AI to embargo often or not.

EDIT:8/01/05 The monopoly setting is capable of handling a negative setting. And yes it does make a sizeable difference. You can cut way down on unwanted trade embargoes(TEs) with a given AI by a negative setting. I even have some settings as low as -1000 currently. This should be quite useful for preventing countries like Venice or Genoa from being COT freebies to human players conquering them because they gain CBs by dumping 6 merchants at a time in their COTs and getting TEed.

The AIs also get -3% trade efficiency penalty per TE in the betas. Since this is harmful to them, it is generally preferable to have them TE very little. They will still TE when at war as long as they have trade level 4. The monopoly setting does not seem to effect this at all. They also seem very disinclined to repeal TEs that they are not forced to from peace settlements, even with say -1000 monopoly setting. Except that I've noticed that in the first 3rd of the game or so they are sometimes willing to do this. Not sure why they so staunchly refuse to later.


Code:
# 100 = Total warmonger, 0 = absolute pacifist
war = (0.0 - 100.0)
This has a sizeable effect on an AI's tendency to DOW. However AIs will still be reluctant to DOW a member of an alliance that is more powerful economically.

IMO AIs should always be given an AI file with a warmonger setting of zero or less unless there is a specific reason for that AI to need to be hyper-aggressive at a specific time and then it ought to be used for an AI file for that time priod only.

In my experience with modding. AIs almost always do better being as peaceful as possible, with select exceptions.

BTW the default AI setting for AIs not assigned a personal AI file is WMS 10. So it is best to make a "peaceful AI," as the AGCEEP and myself have done and give it to all the AIs that don't get a personal AI file. Excessive wars have a number of bad effects on AIs. I'll comment more on all of this in the appropriate chapter.

EDIT:8/01/05 the warmonger setting is also capable of handling a negative setting. I have -500 for some AIs in my current game. It makes them very rarely DOW another country.
Code:
# yes = Nation fights to the death, no = Nation will try to get out of wars
ferocity = (yes or no)
This setting should almost never be used. It doesn't make the AI fight better, it just makes him not want peace until after a war has lasted a damn long time. This of course usually hurts him economically in the long run and rarely ever truly benefits him.

EDIT:8/01/05 recently I've found a use for the ferocity = yes setting. It can be used to make an AI stubborn vs peace settlements. The AI will not peace out easily with a ferocity = yes setting. It works well for making AIs hasslesome to humans or for making them conquer large amounts of territory. BUT, it is critical to make a 2nd AI file that kicks in within a few years of the ferocity = yes AI file firing, that makes it go back to ferocity = no. Otherwise you wind up with AIs that won't peace out for a long time and wreck both their, their allies, and their opponents economies and teching due to excessive inflation accumulating from the AIs pumping cash while at war.
Code:
#if possible we WILL go counter reform
counterreform = (yes or no)
This setting has little use. I find the AIs usually ignore it. A better way to make an AI go counterreform is via an AI only event. A historical event effecting both AI and humans and having a description could also be used.
Code:
#Which countries to conquer if possible. (to guide nation historically)
combat = { } (nation tags to conquer)
This is a very useful but very dangerous setting. It can be used to substantially motivate an AI to DOW another specific country. However it often results in an AI DOWing a historic enemy at the wrong time, resulting in undesired effects.

It can also cause two countries that fought many wars, with little historic changes in territory, to mutilate each other, causing one to overpower the other, simply because of random chance in war results. It can also cause AIs to DOW each other excessively, to a point where it is a detriment to their economic health.

My recommendations are that it be used only to cause an AI that is more powerful than the intended target country to beat him up and conquer him. It should never be used to simulate inconclusive wars. I also reccomend it only be used with extensive playtesting. This setting can cause very desireable results but often does just the opposite, despite the historical intentions of the AI file designer. Playtesting is required to make it work right. Just adding it to an AI list, simply because the recipient AI fought a war or wars with the target country, is IMO irresponsible modding and all too often gets whacko ahistorical results too. Use with Caution!
Code:
#How important is it to gather troops close to base
base = (0.0 - 100.0) #recommend really low value, like 0.1
Code:
#How important is it to be as close to target position when gathering troops.
front = (0.0 - 100.0) #recommend good sized value, like 5
EDIT:6/29/05 Daywalker gives a good description of how these two settings work in post #8 here.http://www.europa-universalis.com/forum/showthread.php?t=202849
Code:
#Evaluation factors for conquer plans, to pick which provinces to attack
conquer = 
{ 
enemy = (0.0 - 100.0) #small nations should keep this value high, expansionist nations shouldn't care 
	# low values go after all provinces, high values go after only rich provinces
This does exactly what it says it does and is a very useful tool. It is good for making an AI capture specific provinces in a war that you want it to, if those provinces happen to have high tax value. As near as I can tell only tax value is being read by the AI with this. I've seen a Portugese AI with a high setting here go for another province that had barely a higher tax value than one with a COT first in a war. I then upped the tax of the province with the COT, so that it barely was higher than the other provinces in the target country and the AI then went after the province with the COT instead.
Code:
	# low  values mean numerous seiges, high values mean one huge dogpile
	supply = (0.0 - 100.0) #I hate dogpile tactics myself, and put this really low
This is also a very useful setting. If for example you want a specific AI to attack multiple provinces rapidly and not lose too many troops from dogpiling, then keep it low. If you want him to zero in on one province at a time, like because the enemy he will most likely be fighting has high tax value provinces and you want him to stay intact and not lose too many troops, than keep it high.

With a low setting, I haven't noticed the AI making, if it can, more than 2 seiges simultaneously. It sends it's reinforcements to one of these 2 current seiges, instead of starting a 3rd one. With a high setting though, if it can, it will usally jsut make one seige at a time.
Code:
	# low values keep troops close to home, high values don't
	distance = (0.0 - 100.0) #small non-expansionists should keep this low to be defensive, expansionists high
This is an extremely important setting. Ever wonder why that darn AI always refuses to attack a province accross water unless it is nearby? Often it's because this setting is too low. It probably is beneficial for almost every AI to actually have this be higher than the default setting. I've made AIs attack provinces as far as could be needed, like with Spain or Portugal, with a setting of 30. I can't vouche for any real neccessity beyond this figure for helping with long distance wars.

Also it could be used as a low setting for example if you actually want an AI to not defend far away overseas possessions well for a specific period of time. Lots of potential uses with this setting.
Code:
# low values don't care if your provines are occupied, high values prioritize liberating your provinces 
	owner = (0.0 - 100.0) #small nations should keep this high, they can't afford to have their provinces occupied
This can be useful. Essentially a high setting here makes an AI stop seiging an enemy province and try to liberate one of his provinces if it is being seiged. This is useful for making one province minors last longer. But don't kid yourself. It's no miracle cure and it's effects, while desired for this, are actually fairly minor. Often it won't stop seiging that enemy province anyways, even with a high setting here.

Using it as a low setting can be very useful for an AI if he is stronger land technologywise than his oponent he's at war with, and especially if he has a nice leader or leaders with high siege vlaue, and you want him to rapidly seize mass provinces for a good war settlement. Otherwise with a high setting, he's liable to give up seiges and try and liberate his beseiged provinces too often. This will cause excessive attrition from moving too much thus reducing his army's strength and the besieged province often has a terrain advantage for the defender. This could cause him to lose his best army in a battle and not even liberate the province at all! OTOH, if he has a superior seiging capability and he keeps seiging enemy provinces instead, he will rack up a higher warscore than he'll lose in warscore, if he is programmed to ignore his beseiged provinces.

Truthfully, having this setting high, is a good way to prevent an AI from doing well in a big war too, as he'll waste lots of troops moving too often and lose more battles by consistently trying to liberate his beseiged provinces. So it is useful for that as well.
Code:
# low values avoid high attrition provinces, high values don't care
	notsupply = (0.0 - 100.0)  #depends on your preference, though Spain should have a high value for the Americas
This does what it says it does. It can be useful. Basically, aggressive AIs need to have it high, or else it may cause them to take too long to decide and seige that last unconquered province during a war, simply because it has too low of a tax value(tax value effects attrition).
Code:
# low values keep wars mainly defensive, high values make you extremely aggressive
	base = (0.0 - 100.0) #warmongers need this high
}
This also can be used to keep one province minors alive longer, but once again it is no miracle cure and makes only a tiny difference. And he's right warmongers do need it high. Don't be afraid to give them even as high as 15!
Code:
# Modifiers for garrison plans 
garrison = 
{ 
	# low values keep troops stationed in low or no fortress provinces, high values keep troops near the largest fortress you have
	fortress = (0 - 100.0) 
	# low values don't acknowledge the strategic value of a province in deciding where to garrison, high values do
	strategic = (0 - 100.0)
	# low values don't care if a province is big or small, high values do
	size = (0 - 100.0)
	# low values don't care if a province has a good supply amount, high values do
These settings do what they claim they do. But they actually make little difference. I wouldn't worry about them much if I was you. AIs tend to move all or most of their armies one place or another as soon as a war breaks out. And if they are not being besieged, even with very defensive settings, they'll often move to an enemy province and seige it, no matter what all their settings are.
Code:
supply = (0.0 - 100.0)
	# low values don't care if a province is occupied by you, high values do
	war = (0.0 - 100.0) }
[/code]I don't know what this does. If anybody does feel free to comment on this in this thread.

Here's a copy of the default AI settings that all AIs have if no specific one is made for them. You can see the settings that are average for what you see AIs regularly doing, to get a feel for what direction that could/should be tweaked in.
Code:
#
# Europa Universalis.
#
#
# Default AI preferences used by all countries unless otherwise stated.
# 
#
# Johan Andersson 21-12-98
#
#
# Modified by Henrik Fåhraeus 30-09-01


#
# No preferred areas at all. Default AI does not colonize.
#
continent = { }
region = { }

# The amount of provinces we try to colonize at the same time
expansion = 0

# % of the time we prefer to establish a tradingpost if both are good.
tradingpost = 20

# Bonus for areas to establish colonies adjacent to previous ones.
neighbour = 50

# Bonus/Penalty for establish colonies adjacent to other countries.
enemies = -50

# 100 = max trader rate, lesser means slower focus on sending a trader.
traders = 100

# 100 = Total monopolist, will refuse trade as much as possible.
monopoly = 25

# 100 = Total warmonger, 0 = absolute pacifist
war = 10
ferocity = no

#if possible we WILL go counter reform
counterreform = no

#Which countries to conquer if possible. (to guide nation historically)
combat = { }

#How important is it to gather troops close to base
base = 0.1
#How important is it to be as close to target position when gathering troops.
front = 5.0


#Evaluation factors for conquer plans 
conquer = 
{ 
	# multiply enemy province value 
	enemy = 5.0 
	# multiplying supply factor 
	supply = 0.1 
	# factor for distance to not owner provinces 
	distance = 0.5 
	# factor for owned provines 
	owner = 2.0 
	# Multiplier for provinces not in supply. 
	notsupply = 1.0 
	# Multiplying the base constant for conquer. 
	base = 1.0 
} 

# Modifiers for garrison plans 
garrison = 
{ 
	fortress = 1.0 
	strategic = 3.0 
	size = 1.0 
	supply = 2.0 
	war = 5.0 
}
 
Last edited:
Chapter 2: AI spending

Chapter 2: AI spending

AI spending is easily one of the most important things a modder should need to know. Knowing how an AI is operating it's budget is crucial. Without this knowledge new events that are made, both historical and random, can have massive detrimental effects on AI performances, even if they don't on human performances. Also this is important to know both for AI files that are being created and for AI cheat events.

By spending, I of course mean what an AI does with his monthly and annual income. AIs essentially have 2 modes of spending: 1)spending while at peace and 2)spending while at war. I'm not going to cover this second type of spending in depth in this chapter. That topic will be covered more extensively in the AI behavior while at war chapter, but undoubtedly I will mention parts of it here and there.

Every January we, and AIs too, recieve a chunk of cash that doesn't cause any inflation. It's essentially free money and based on our province taxes.

But every month we also recieve monthly income that is usually used to research tech or stab. It's important to differentiate between these two. Here is a link that discusses income for those of you reading this who don't know much about in-game income. http://www.europa-universalis.com/forum/showthread.php?t=157925

If we, and AIs too, spend our monthly income on creating cash, it causes inflation. This is no different for the AIs. They are penalized here too.

The AIs are programmed to spend all of their monthly income on tech and stab. The reasons why they will spend some or all of it on cash, obviously to use for other things, are the following.

1)If an AI is at war, it will pump cash to pay for troops and ships.

2)If an AI has a revolt and an insufficient amount of troops, in it's own opinion, to suppress that revolt, it will pump cash to build them.

3)If an AI cannot pay for it's monthly troop or ship support costs, with it's annual income alone, it will pump just enough cash to pay for them.

4)AIs will also pump cash to pay for loan interests IF this combined with troop ans ship support cost cannot be payed for with annual income alone.

*5)Possibly, but I'm not positive, an AI will pump cash to pay off loans.

In all other cirmumstances, an AI will not pump cash and will cover all of it's expenses with

1)it's annual income,

2)leftover money from loans that it is forced to take,

3)money from war settlements,

4)money from gifts given to it,

5)or money from random, historical, and AI cheat events.

In most circumstances, money from annual income is what the AI is really using to invest with. AIs will not pump cash to make manus, grab key colonial provinces, or make some other city improvement. They literally are making the majority of their non-tech and non-stab investments exclusively with their annual income. So quite obviously, annual income, that is left over after what the AI has put aside to pay for monthly troop support costs, ship support costs, and loan interests, is really what we are dealing with when we try to get a grasp of just how much money an AI has to spend on investments.

AIs will spend money on stab when it is low. We humans often refuse to do this and spend it all on tech alone. This is part of why we can tech faster than AIs.

AIs will spend more money on land tech than other techs. This is why in a game, the AIs are often close to us in land tech level but behind us in naval. You may also not realize it, but they are almost always quite a bit behind us in trade and infra tech as well. This is part of why we tend to out-tech them more and more as the game goes on. They lack high trade and infra tech to make their monthly income able to produce alot for the size of their empires.

Vassal income is part of the monthly income. Vassal income has a direct effect on AI teching and does not benefit AI investing at all. In fact it hurts it. I'll explain more about this later on in this chapter.

Now let's analyze what AIs spend money on and what priority they place on those types of investments. The types of investments available to an AI are:

1)colonists

2)bailiffs(TCs)

3)merchants

4)diplomatic improvments

5)fortresses

6)manufactories(this rarely happens, except by a few historical events and AI cheats that give enough money)

7)Conversion attempts

8)Other province impovements like legal councils(LCs), governors, conscription centers(CCs), and shipyards(SYs).

9)They will also spend their annual income on troops and ships, if they feel their respective counts are too low.

10)They will also have to spend their annual, not monthly, nor as a result of loans, income on war settlements in wars they lose.

The top 4 types of investments are a high priority for AIs. This may, in many cases, be more due to their cheapness than due to a built in preference for these types of investments.

I have also seen AIs ignore these types of spending and save up for fortresses or conversion attempts. This gives a false impression that they have fallen asleep. Daywalker, in his webpage http://www.lhjworld.sa-net.dk/
talks about how AIs fall asleep and that you should reload a game every 20 years of gametime. I've found that AIs do indeed fall asleep, but more often than not, when they look like they are asleep they infact not asleep at all and are just not at war and saving up for an investment in something more expensive, like a fortress or a conversion attempt. None the less, reloading a game rather than letting it go straight through is a good idea. You don't always notice when an AI is truly alseep. Also I highly recommend Daywalker's mod, available at his website. It is one of best mods I've seen, quality work.

Now lets talk about each of these types of investments and how the AI handles it.

1)Colonists are spent by the AI, only if he has them and only if he has at least 1 expansion setting in his AI file. I'll discuss where and why he sends them to which places in the AI and colonization chapter. But for now you just need to know that the "areas for expansion," in the AI file determines where he will colonize.

Whether he makes a TP or a colony is determined by his trade post setting and expansion setting in the AI file.

TPs can increase his monthly income. But they do not, and this is important to note, increase his annual income at all. Thus AI colonizing with colonies and then building bailiffs there, has a direct impact on an AI's ability to invest in the future. I'll commnet more on this later on in this chapter.

2)TCs are needed for an AI to collect annual income from a province. Without a TC, an AI, and us too, can only collect up to 25% of our net, NOT base, tax income, in ONLY core provinces, depending on the centralization DP setting in place. TCs also increase the base NOT net tax of a province by 1.

Obviously TCs are very, very important for an AIs investing capacity. Another phenomonen of TCs is that because many AIs lack them at the start of the game AND lack infra one at the start of the game too, they are unable to invest beyond their initial treasury. This, especially if war breaks out before the poor AI can make a bailiff, is a big reason why AIs rack up massive inflation in the first few decades of the game. They desperately need at least one bailiff before they are forced into a war or they will literally be massively crippled economically for the rest of the game. Sometimes AI cheat intervention may be neccessary to correct this. Giving a country infra one at the start of tha game and at least enough money to cover a year's worth of troop and ship support costs can enable the AI to avoid this economically trapped situation as well.

3)Merchants are placed by the AIs with annual income as well. Merchants do not themselves benefit an AI's annual income. In fact they, AI investing-wise, are actually financial losses. Their real benefit is that they help an AI tech faster and they compete with us humans. Otherwise they would be pointless for an AI to send.

Many AIs send plenty of merchants to COTs only to have them get competed out. The vast majority of AIs throw alot of money away on merchants with little return even in non-investable income. This is because they such low trade efficiency(TE). Their merchants don't stand a chance. A good way to curb this wastage is to keep the "trader" setting in their AI files low or DPs can be manipulated via AI cheat events to make them have less merchants to throw away or even better TE to be more successful with their merchants.

Obviously it is highly desireable to have big powerful AIs, that can produce many merchants and have high TE, to send plenty of them as it will give them good teching and competition with us humans both in merchant placing and the tech race.

4)Diplomatic improvements are indeed a way that AIs spend their annual income. We may not realize it but they actually spend quite alot on this, especially if they have many vassals or even just one or two. This is of course why the AIs actually diplo-annex fairly well. They keep giving money to their vassals.

This may seem bizarre to you, but having a vassal is actually a great way to make an AI throw his money away. All he gets is that tech bonus, undoubtedly, more often than not, not even worth the money he throws away on that vassal.

Likewise an AI being a vassal is a great deal. They then receive these showers of gifts and have even more investable income. They don't give any of their annual income to their suzereigns either. What a great deal for them!

Having diplomats to spare is of course neccessary for this type of spending. And this is why some AIs appear to be asleep while at war. Sometimes, they occupy their enemies provinces but refuse to make peace with them. It's not that they are asleep it's that they are spending their tiny amount of diplomats on something other than a peace settlement. Click on that country's diplomacy window. Check if he has a vassal and if he has good relations with them. It may be that he's throwing money away on a vassal instead of making peace with the other AI he's at war with! It's even worse when you consider that the vassal often has a different religion and can't be diplo-annexed anyways.

AIs also from time to time spend money on warnings.

5)AIs will make lots of fortresses, if they have the money. They will ordinarily try to make 2 tax or more provinces level 2 fortresses or even higher. I believe that they try to keep their core provinces with high fortifications, but I'm not 100% sure. Needless to say they do indeed wind up doing this, whether it's more due to other factors or not, I'm not sure.

7)Conversion attempts are also something that AIs like fairly well. They will conduct a decent amount of these if they have the money.

The rest of the types of investments, seem to be a really low priority. It's a pity that AIs over look the usefulness of LCs and governors so much. This condemns them to struggle with inflation much more than us the last 2/3rds of the game. Also the LCs will help their annual income. It seems the only real way to compensate for their ineptness on this matter is with AI cheats that flat out give them to them.

So what can we really know about how to help AI spending be more productive and help AIs to avoid economic dead-ends? Well the thing to really key in on is the net tax income of AIs. Sure we can use an inflation for manus strategy, pumping cash to make lots of refineries and dominate global trade, but AI do nothing of the sort. For them tax value is atrociously important whether we like it or not.

There are a number of things to pay attention to in tax value matters. AIs that are expected to colonize rapidly off low net tax value simply can't do it. It doesn't matter that we can, they can't! Thus it is extremely useful to manipulate AI inflation free income and improve their capacity to improve themselves.

There are a number of things that can be done. First of all, we can moniter their performance and make sure they are getting lots of bailiffs early. If they aren't, unless we actually want that AI to be crippled(like if it needs to be conquered or badly out-teched anways), we should re-work the setup to assist them, by giving them 1 infra and enough money at the start to make bailiffs. We can also give them AI cheat events, that either give them bailiffs, infra boost, extra cash early, or some combination of these. This will help the AIs get past that obstacle.

Other things to pay attention to are the fact that big AIs with lots of tax income may not need any extra help at all. They may have started off poor, like with Portugal, but if we get them big tax income-wise, later they may not need our help at all. Stability also effects tax income. it has a direct effect on net tax income. Also, if it is low often, the AIs could be suffering from RR. This also causes a loss in net tax income. It may be worthwhile to give an AI a free FAA or give it stab boosts like with it's AI switching events to help it maintain a high annual income.

As far as monthly income is concerned, it is mostly for tech purposes as far as AIs go. It needs to be playtested to get a feel for the teching power of an AI. There are a great number of things that can be done to enhance the teching potential of AIs. They can be given a huge assortment of things via AI cheat events. I'll adress this more in future chapters of this guide as this topic will be brought up again and again there.

IMO, the future of EU2 modding really ought to be about AI enhancing. Let's face it, AIs in EU2 are retarded. And in EU2 mods, more often than not, they are even more retarded. Half the visitors of this forum are MP players. Most of them aren't interested in playing SP because it isn't even remotely challenging to them. The primary reason why is because, well, the AIs just plain suck, even in the vanilla.

But it doesn't have to be this way. If we start paying attention to how AIs work and how we can make them work better, we can make mods that have all the good stuff that current EU2 mods have and be challenging and more entertaining to boot. MP players will have to admit that although, AIs are idiots in most versions, in AI enhanced mods they can actually be much more challenging. This is my vision for EU2 modding and I don't doubt that many of you will share it as your eyes are opened to the reality of AIs and their potential if cared for correctly. The first big step in this direction should be people becoming informed about just how exactly they are running their budgets.
 
Last edited:
Chapter 3: How AIs use Conquistadors and Explorers

Chapter 3: How AIs use Conquistadors and Explorers

AIs use Conquistadors and explorers very differently than we do. AIs will use them to explore. But AIs, unlike us, will NOT use them to fight battles, at least not deliberately, or to reduce the cost of colonization attempts, at least not deliberately. Thus as far as AIs are concerned, conqs and explorers are for exploration only.

The AIs use them in specific ways too. An AI will only explore with 1 explorer at a time. The same goes for conqs. They may however explore with 1 conq and 1 explorer simultaneously and may even send an additional one of each out on an exploration trip if the current ones exploring are done exploring and simply on their way back to a port.

How they do it is they send an explorer out with just one ship. This BTW sometimes results in them losing their explorers in a battle to an enemy or pirates. They also are reluctant to send out explorers if they are at war and an enemy fleet is nearby. They will send it out while at war, however, if the enemy fleet is not nearby, and may even run right into an enemy fleet later and get slaughtered, as they only use 1 ship to explore with.

AIs also do not need to dock when they explore. They just send out an explorer for a few years at a time. AIs don't suffer attrition for any of their fleets at all in fact. And explorer movement speed and naval tech level can make a very big difference in AI exploration speed and efficiency.

They send out their explorers to explore the areas specified in their AI file's "areas for expansion." They will stick to these areas, as long as there is more to explore. If they run out of areas to explore, another AI file, made by the engine not you, will kick in and they will explore wrong areas instead. They usually wind up being America as that is the default place for AIs to explore, if this happens. They will even colonize wrong areas then as well. Spain and Portugal however will still only colonize unstarted colonies and TPs within the ToT, even before it begins and after it is expired.

AIs also will need at least 1 in their "expansion" setting of their AI file to explore. Once in a great while they will still send out an explorer on an exploration trip on zero anwyays, but it will be a small trip. 3 is optimal for exploration, as it will cause more frequent exploration trips. More makes it even more frequent, but only by a small margin, and high "expansion" setting can cause other problems. I'll discuss them in the AI colonization chapter.

AIs prefer to send their explorers on short trips, distance-wise. They do not like long ones, and often won't do them unless they have run out of short trips to make. But they usually will do them eventually, it just may be 50 years or so, and that far away area has been on all of it's AI lists the whole time!

AI explorer exploration is very tricky. For example, AIs, if they have certain sea zones on their "areas for expansion" will often re-explore them over and over without even exploring all of it. It's a bit frustrating when that darn AI keeps sailing in the same spot like an idiot, and he has all these other important areas farther away to explore and is taking his sweet time. The AI explorer won't even check every single area in that sea zone. This is why when you gain access to an AI's map, like from a capital sacking or a maptrade, you see bald patches in the AIs known sea zones, even if it is some time into the game and you, if you played that country would know all those sea zones already by then. It may become neccessary to remove those sea zones from later AI files, of a given country, to prevent his joyriding in known sea zones.

I suspect that the AI is reading that he still doesn't know every area of these sea zones but is then trying to only pass through the sea zones that have the briefest travel time. I've noticed that AIs often, when they go joyriding, will do it in the exact same specific sea provinces game after game after game. Also AI explorers will explore coastal provinces just fine, even without sea zones on their specified expansion areas. They will also sail up and down those coastal provinces too, unless they have already found all the provinces in that listed area, they will then only pass through it enroute to another expansion area target.

Conqs operate very similarly to explorers. But they will not go back and forth between known sea zones or land provinces. They will just explore what they can and then sit around when they are done and have nothing left to explore. They will also just abandon the surviving troops after the conq has died. This is why we see an army just sitting there in some empty province for no good reason and the AI even at war will not move them. It's because they are the brave survivors of a once great expedition to explore the unkown hinter regions of some distant continent and their country has forget all about them, but not paying them, and they have forgetten all about their country too. As far as I know the AIs still have to pay for them. What a great life, free pay and no work!

Conqs will not deliberately attack natives or rebels or enemy armies for that matter either. If they fight natives, it is only because they were attacked by them, while exploring. AI conqs are sometimes lost because they ran into some force too strong for them to handle. The AIs tend to give them small forces as well.

There are other quirks in AI exploration, because the AI will both explore AND colonize anything on their "areas for expansion" list. Thus it may be neccessary at times to make an area for expansion for only 1 AI file and then remove it from later AI files, if you don't actually want the AI to colonize there and just explore it at a certain time instead. I recommend extensive playtesting for creating AI exploration files. Too many unpredictable things happen and you can't just put such and such an area in at a historic time and expect perfect results. It's pretty much a balancing act, a skill so to speak.

Also when playtesing, check those save files under the nation part for that particular AI. Often a specified area is mistyped or misplaced, like if it's a region and you put it in as an area instead. I've found many flaws this way in both my AI files and others' AI files. If they are misplaced or mistyped, they will show up in the save file under the AI section of the nation part like this, ("-"), minus the brackets of course.

My advice for conqs and explorers for modders is that they need to be evaluated in light of their uses by AIs. The fact is that long lived conqs, with high war settings, are nothing but a gift to us humans. We can do all kinds of outrageous stuff with them that AIs won't do. Thus, IMO, it is better to keep them as short lived as possible, same for explorers. In my mod, I've made many additional conqs and explorers. They are mostly short lived, some even as little as 2 years. This prevents humans from excessive conq and explorer abuse that AIs can't capitalize on.

Also IMO conqs should not represent anything except leaders of land exploration expeditions. Making many conqs for the governor of such and such can't even be used by the AI at all, if there is no land for them to explore because the explorers already found all the areas for expansion in the AI file. I also don't make explorers or conqs for leaders who explored regions that aren't in the game or explored in such a way that the AIs can't handle it. For example, Pedro Cavilha is deleted in my mod.

For explorers I never make them unless they were a captain, and they must have been exploring the whole time of their existence or most of it. Thus Vespucci for example is deleted in my mod. He never captained any expedition. And leaders who primarily fought naval battles, are made into admirals instead.

All these kinds of interpretations prevent humans from exploiting explorers and conqs to a significant degree greater than the AIs. We then have to decide whether or not to use them to explore or to assist in colonization. And if we use them for the latter, our time for this is short, due to their shorter lifespans.
 
Last edited:
Chapter 4: AIs and Colonization

Chapter 4: AIs and Colonization

AIs colonize a bit differently than we do. First of all, AIs don't move their DP settings to capitalize on creating a maximum amount of colonists. Neither do they, ordinarily, pump cash to invest in colonists. So if they don't have the annual income to send many colonists and/or favorable DP settings to send many colonists, they won't!

AIs will also only colonize in their specified areas for expansion in their AI files. They may create their own AI file though if they run out explorable provinces and then start colonizing there, usually in America, where we didn't specify them to colonize in their AI file we created for them. This is the part of the AI file that has their areas for expansion.
Code:
#
continent = { }
region = { }
area = { }
See chapter one for links that can help you with filling these areas out.

AIs will also only colonize as many provinces at a time as their "expansion" setting in their AI file dictates. So if for example, it is set on 3, the AI will not make more than 3 TPs or colonies, cumulatively, at one time. They will however start working on another colony or TP if one of the 3 that they were working on, gets to 1,000 population or level 6 TP. It is also important to bear in mind that an expansion setting of say 15 may allow the AI to cover alot of territory at once, preventing later AIs or humans from getting as much of the territory in question, but it can also very often result in the AI running out of colonizeable provinces on their "areas for expansion," and then they start colonizing wrong areas as well. I recommend playtesting with the expansion setting, to keep it as high as desireable without causing this kind of unwanted side effect.

AIs will also send more than one colonist at a time to a single colony. They will not send multiple colonist at a time to a TP though, unless they are in fact upgrading it to a colony. This undoubtedly keeps them colonizing within their specifiec areas for expansion much more strictly than if they could only send one at a time like we humans do. Unfortunately though, the AI will not get the reduced price and higher precentage chance for success that we do by having to wait for the current travelling colonist to arrive and be successful. Anotherwards for the exact same amount of colonial attempts, the AIs on average have to pay more than we do.

For those of you who don't know colonization facts very well, here is a link discussing them, as this may be a useful thing to be familiar with when trying to understand how and why you would actually want your AI to colonize.http://www.europa-universalis.com/forum/showthread.php?t=47145

AIs have certain priorities to factor in their colonizing decisions, that they make within their expansion areas and according to their expansion setting, as well. They also decide whether to colonize or TP based on their "tradingpost" setting in their AI files. It can vary from 100 to 0. The higher the number, the more likely they will be to make TPs instead of colonies.

This number should be very low, like 5 to 10 if we want an AI to make mostly colonies at the time the given AI file is being used. It should not be 0 however, because the AI will often, at 5 or 10, make only 1 TP and then switch making that particular province into a colony. Level 1 TP makes it cheaper, and with a higher chance for success, for the AI to colonize that province.

If we want the AI to make mostly TPs we can set this number higher, like 65 to 95. I recommend that there not be many number settings used between these 2 objectives as a setting of 50 for example won't really get you 50% colonies and will often just result in an AI making many level 6 TPs into colonies rather than making provinces with an easy TP rate into TPs and provinces with easy colonization rates into colonies. This would of course result in alot of AI colonist wastage as a level 6 TP that exists only for a short period of time, is essentially a waste of 5 of the AIs colonists. We ourselves of course either make a TP to last for awhile or, usually, make a level 1 TP into a colony. So there's no sense in encouraging an AI to colonize in an inefficient manner by using "tradingpost" setting numbers like 20 to 60.

AIs also factor in the "enemy" and "neighbor" settings in where they decide to TP and colonize. I recommend these settings be kept at 0, except in extremely rare and specific circumstances. Check chapter 1 for more details on the uselessness of these 2 setting and how they almost always just cause detrimental results.

I strongly recommend that when modding for a major AI colonizer, that extensive playtesting be used. There are many unpredictable things that can go wrong. Simply adding a historic list for areas of expansion and making a historic guess at the other relevant settings, will most often not get the desired results completely and will very often get unwanted results as well.

AIs pick provinces within the boundaries of all these settings combined, based on the cost/percantage chance for success(both of these go up and down simultaneously based on various factors), the base goods value, and the base tax value. We actually pretty much do the same thing as the AIs here.

As I pointed out in chapter 2, AIs use almost exclusively their annual income, minus troop and ship support costs, to invest in colonizing. Thus this combined with the inneficiency of stacked colonial attempts and often not having optimal DP settings for colonization, almost certainly condemns an AI to not being able to colonize anywhere near as effectively as we can.

Thus in order for an AI to colonize effectively, he will need a well tailormade AI file, optimal DP settings for colonization, an adequate supply of annual income, and often additional colonists via AI cheat events. With all 4 of these factors in optimal condition, an AI can be made to colonize about as well as we can. Indeed my colonizing major AIs in my mod do this very thing. I'll elaborate more on a good way to manipulate AI DP settings, give cash bonuses under select circumstances, and colonist bonuses in a future chapter.

Another thing to note for AIs in colonizing, is that they will manually send an army to slaughter any natives above level 4 aggressiveness. In fact to prevent this wastage, which almost always hurts the AI more than even us, I have actually set the aggressive setting of most of my natives to 4 or less. It works great and the AIs skip wasting troops on depopulating colonizeable provinces. Various other factors can be manipulated in the province.csv file that have a substantial effect on AI colonizing, but since they also effect us humans substantially as well and because it is in itself quite a large subject, I'm going to skip going over it in this guide. But if you want to know more about these settings and how they effect colonization, feel free to post questions, comments, etc in this thread.
 
Last edited:
Chapter 5: AI DOW Behaviour

Chapter 5: AI DOW Behaviour

DOW stands for "declaration of war." Essentially what I mean by DOW is the AIs', or it could be us too, act of declaring war on another country, AI or human. Knowing what causes AIs to DOW other AIs is very important information for a modder to know. Otherwise various changes that we make to a mod, often wind up making some delicate AI balance go out of whack and then when we are stuck trying to fix a problem, and we won't even know where to begin because we may not even know what is causing the problem. I'll explain the good/bad effects of AIs being at war in the next chapter of this guide, but the particular topic in this chapter is in itself extensive enough to be deserving of being discussed seperately.

AIs take into account a number of things when DOWing. They take into account the following:

1)How long has it been since they have been in a war.

2)How strong is the economy of ALL the countries cumulatively in their alliance vs how strong is the cumulative economy of ALL of the countries in the potential victim's alliance. I strongly suspect the AIs are reading monthly income in this equation. I'm about 99% sure it's not province count though.

3)If another country is on the AIs hitlist in their AI file, this is also a very strong incentive to DOW them.

4)It's partially random. In fact as near as I can tell all or almost all of the AIs descision making has to run through the medium of a random generator.

5)The relations of the respective countries. Although other factors can combine to make an AI DOW, even inspite of +200 relations. So there is no cut off point. The relations are merely one of a number of factors.

6)AIs also consider the economic strength of a potential target's suzerein if it is in fact a vassal.

7)The warmonger setting in the AI file has a direct effect on an AI's tendency to DOW.

8)I do not know if CBs or core claims instigate AIs to DOW or not. If they do, the contributing effect in their DOW descisions is certainly not much effected by this.

9)According to Hive, AIs also factor in respective troop counts. I'm inclined to believe him, even though I haven't seen conclusive evidence for this yet myself. I don't know whether the AIs are weighing troop count vs the target victim or the cumulative troop counts of both alliances. Also I'm pretty certain that this is not as big of a factor as 1, 2, an 3 on this list.

10)AIs also consider whether or not a target victim is at war. If they are at war, this inceases the chance of a DOW.

11)If another country is over the BB limit this has a substantial stlimulus for DOWing. The BB limit is not neccessarily the same one for us.

Now let's analyze each one of these factors a little more closely.

1)AIs have a built in clock so to speak. Essentially AIs need war, like we need food. They are programmed to proggressively crave war more and more until they are plunged into one, by any means actually. It can even be from a forced DOW event or as honoring an alliance. Any way possible an AI can be involved in a war it will reset his war clock and start it all over from the beginning. The war clock can only stimulate the AI to DOW so much. More often than not other agitating factors will need to be added to it to convince the AI to DOW.

2)The strength of an AI's economy AND the strength of his allies' economy vs the cumulative stength of his opponent's economy and his allies, is an incredibly important component of understanding AI DOW behavior. Essentially an AI can literally DOW a weak neighbor for no other reason than because he is cranky on account of his war clock and the neighbor is weaker. No other factors are neccessary to convince AIs to engage in wars abundantly than these two factors alone combined.

This is of course one of the biggest reasons why 1 province minors are flat out doomed to die in EU2 the second you press start at the beginning of the GC. Their one province almost always makes them weaker economically and thus they take the brunt of DOWs. This combined with the fact that they are simply unable to lose a single province and are often on the losing side of a war, if they were the ones who got DOWed, is enough to make them a losing cause in modding. Being surrounded by many other countries also hurts alot too. Because of the engine's innability to handle 1 province minors, I strongly recommend making them be avoided if at all possible.

3)The hitlist is this part of the AI file.
Code:
#Which countries to conquer if possible. (to guide nation historically)
combat = { }
You type in the 3 letter country id TAG to put it on the list. This has a powerful effect on an AI's tendency to DOW. Often an AI will overlook a weaker potential target and pick a slighlty stronger one if it is on his hitlist. So essentially it can and does stimulate an AI to DOW more often if he has nearby countries on his hitlist and he is cranky and itching for a war on account of his war clock.

It may seem that this is a great way to get AIs to attack historic targets, but as I pointed out in chapter one, making two AIs DOW each other often, often gets bad results. I recommend extensive playtesting for hitlists.

5)It is important to not exasperate the relations of AIs by many random and historical events that frequently reduce their relations. Doing this results in causing additional AI wars, which of course, more often than not, wind up hurting all the AIs involved more than it helps them. I'll explain this part a bit more later on in the next chapter.

When making random and historical events, I have found it best to make relation increases large, like +50 to +400, and relation decreases small like -50 to -15. This may seem imbalanced, but due to the engine's inherent tendency to lower relations over all much more than it allows them to increase, it actually winds up helping alot. Numerous CBs and core claims should also be avoided, as they tend to wreck relations quite a bit.

6)It is definitely true that AIs are considering the suzerein's economic strength of a potential target when deciding to DOW, but don't let this mislead you, as it is certainly less than the amount it factors in for an ally's economic strength of a potential target. Thus a 1 province minor that is a vassal of a much larger country may indeed deter another AI froming DOWing the vassal for a while but it by no means will prevent this 100% of the time forever.

7)This is what the warmonger setting in the AI file looks like.
Code:
# 100 = Total warmonger, 0 = absolute pacifist
war = 10
The warmonger setting can be used to make historically aggressive AIs DOW more often. However it should be used sparingly, as most wars, as I've said before, actually wind up hurting AIs more often than helping them.

I recommend that all AIs, unless there is a very good reason, have their warmonger settings be set on zero. I personally however have noticed that AIs tend to become more passive as the game goes on. This could be due to a number of reasons, and I'm not entirely sure which ones they are. It is even possible that it could be programmed into the engine for them to do this. At any rate, I'm personally suspiscious that making the more important AIs be more progressively aggressive by increasing the warmonger setting for late game AI files may be the best route to go. I haven't personally tested this out yet though.

8)As I've said already, I can't notice any discernable difference about how AIs DOWing being effect by CBs or core claims. They certainly don't mind taking -2 stab hits left and right, by DOWing without them, unlike us.

11)The BB threshold for AI DOWing doesn't appear to be the same as ours. I don't know entirely how it works. But I do know that many 1 province minors being killed will cause more BB wars to happen more quickly. This once again is a good reason to, if at all possible, avoid the creation of 1 province minors. They have a direct effect on the number of BB spiral wars AIs will wind up being forced to engage in.

To sum up, I recommend that AIs have, very selective and thoroughly playtested hitlists, good relations at the start with little negative relation causing events or small ones and more and bigger positive relation causing events, warmonger settings of zero except for very select cirmcumstances, as little as possible CBs and core claims for provinces they don't own at the start and events can be made to have, and that as few as possible 1 province minors be made. If all of these effects are implemented into a mod, it can tremendously curb the amount of unproductive AI on AIs wars that AIs are forced to engage in, in both the vanilla and various mods.
 
Last edited:
Chapter 6: AI Behaviour While at War

Chapter 6: AI Behaviour While at War

AIs behave very differently both from us when we are at war and from how AIs behave while at peace too. Understanding AI war behaviour is important for modding because then we will know just how far we can push AIs.

The first thing that is important to know is that AIs when at war spend either all or most of their income pumping cash, and I'm not 100% sure which is the case but I am 100% sure that one of them is.

If an AI has to fight wars often, especially in the early part of the game, this will make his economy suffer. He will get additional inflation effecting everything that costs money for a long time. Also if he is fighting a war, his tech slows to a crawl, as he is investing little or nothing in tech during the duration of the war. This can directly cause them to tech more slowly.

Consequently, we need to ask ourselves when programming an AI to be more aggressive DOW-wise, do we actually want this? Making an AI fight wars for no other reason than that country really did fight wars at that time, only hurts the AI. He recieves zero benefit from this. Ideally AIs should only be made to fight wars if:
1)They need to conquer certain provinces and war will enable them to do it consistently.

OR

2)we want that AI to lose provinces that it lost in historic wars.

For all other reasons we should ideally not want the AIs to fight at all, as it only helps to give us an edge over them, on account of how badly it effects their economy.

Another bad effect of an AI war is that sometimes the victorious country will over-produce troops. This causes his normal troop support cost to increase and this gobbles up his spare annual income, directly causing an AI to spend less on merchants, colonists, and city improvements, and this all goes on for sometime, perhaps even indefinitely, long after the war is over. Obviously this is a pretty bad side effect. I'll get into how to curb this problem later on in this chapter.

AIs have certain disadvantages in war that we humans don't suffer from. AIs transport troops accross water more poorly than us. The primary reason why is because they assign a portion of their fleet to patrol, while at war. The patrolling fleets usually will sail around the coastal provinces of the country they are at war with. Patrolling fleets will not transport troops. They will only patrol. Whatever the AIs have left, after they assign some of their fleets to patrol, and often they have none left if their fleet is not very large, they then try to use to transport ships. If they have a fleet transport capacity capable of transporting an army that they have free, they will transport it. Contrary to what many people believe the AIs will actually transport the troops long distances although they prefer shorter routes and will decide to transport them quicker.

The reasons why it seems that they are reluctant to do this, is because of a number of factors.

1)The "distance" setting in the AI file will need to be high, like 10-30, if the AI is expected to transport across long distances. If this setting is low, they are reluctant to do it and may even flatly refuse to.

2)If the naval tech of the AI is low, they will still transport across long distances, but due to the time it takes, it will seem like they are poor at it. Thus if their naval tech is high, AIs can transport more often and more quickly. Transporting becomes less of a problem for AIs as the game progresses on account of the increase in tech and fleet sizes.

3)AIs don't seem to want to break up armies for transporting. If an AI has an army of 30,000 doing nothing but only 28 transport capacity in one place at the time, due to patrols and other ships just lying around in a different places, they will not transport the troops. AIs having their fleets get annihilated, exasperates this problem as often the armies then keep getting bigger and their fleets available for transporting keep getting smaller.

An AI having his fleet get annihilated, can be utterly devestating to him. Not only will it ruin his ability to make amphibeous assaults during that war, it often result in him having too many troops pile up, which after peace is settled upon, he can't support well. This then causes an acute shortage in funds, which also effects even his rebuilding of his fleet during peace time, which often even causes the exact same problem to still be in place by the time of the next war the AI engages in.

Needless to say, an AI having a large fleet with high naval tech is extremely important for the health of that AI if he does indeed need to fight inter-continental wars, like for major colonial powers for example.

There are a number of things that can directly enhance the AIs to avoid this pitfall and be more competitive in AI wars.

1)If AIs are given free transports via AI cheat events, they then will have more transport capacity left over after sending fleets on patrols during war time. I've used this tactic quite a bit myself and can testify that it does indeed make a very big difference.

2)If the AI has a low land and low aristocracy DP setting, he can then make ships more cheaply.

When AIs build ships in war time, they select a spot based on ship building capacity, and I think but am not positive based on distance from the front of the war as well, closer being more desireable. Shipbuilding capacity winds up being the biggest factor by far though. Shipbuilding capacity is effected by net NOT base tax value, core status, and shipyards. Thus if an AI has a shipyard, in a core province that has high tax value, than that province can enable him to build a larger fleet at a given point in time. Having multiple provinces with high ship building capacity is ideal. This is because of how AIs build ships during war. What they will do is select a province to build a fleet in, then spend all the money they have available at that particular moment on building a fleet in that province. Thus if the province the AI has selected has extremely high shipbuilding capacity and that AI has at that moment a large amount of cash in his treasury, he will literally build a gigantic fleet. If he has low cash but high shipbuilding capacity in the selected province, he will spend all the money he can. Consequently, low ship cost from low land and low aristocracy DP settings has a direct impact on this.

3)Low land and high quality also decrease the MP of a country thus increasing the likelyhood that an AI will run out of MP and then have more cash left over for the next shipbuilding command. Low land also increases the AIs likelyhood of winning naval battles, due to higher naval morale, thus helping it to sustain a large navy longer.

4)Free naval manus or free naval tech through AI cheat events also increase the chances that AIs will win naval battles and thus will build and sustain a large navy better.

5)Monarch MIL rating can effect morale. Thus with an AI cheat giving additional monarch MIL rating temporarily during key time periods, and even triggered with specific conditions, an AI navy can be made to fight better and thus sustain a larger navy longer.

The AIs produce armies in much the same way. They will decide to make troops then select a province based on troop building capacity and closeness to the front then spend all the money they can on building troops in that province, unless they run out of MP first, then pick another province.

There are a number of things that can help AIs fight long distance wars that are connected by land. Obvously an AI having high troop building capacity near the front of expected wars can help in AIs getting troops to the front faster.

1)The "distance" setting also helps. If the war is far from the AI's capital, then a higher distance setting the more likely he will be to target more distant provinces. Often the biggest reason why the AI just won't attack a province we want him to is because this setting is too low. A high setting of 15-30 is good for long distance wars.

2)Making the "base" setting(the conquer one) higher can make the AI more prone to attack an enemy province thus making him target provinces, including long distance ones, more often. 10-15 is good for making the AIs much more aggressive.

3)Keeping that "owner" setting low will make AIs lift seiges less often and thus control provinces they are seiging faster. It will also reduce troop attrition due to less moving back and forth. Truthfully the "owner" setting should be low like 1.0 unless we deliberately want an AI to fight crappy or we want to make him fanatically defensive, like if he's a 1 province minor and is dead if his province is captured. In which case the "base" setting(the conquer one) should also be very low. But it is no miracle cure and the AIs with these two settings optimally set for defensive behavior will still not prevent aggressiveness and make them stay at home, especially if the AI's 1 province is not being seiged right away.

4)Giving AI cheats to AIs that give cores to them(it can even be done only for a specified time period only by a later event removing them) in provinces they own near the front of a distant war will help them produce more troops nearer to the front as cores increase troop building capacity.

5)Likewise, giving AI cheat events that give free bailiffs or LCs in provinces near the front of a war will increase the troop building capacity of these countries because they increase net tax. Net tax effects troop building capacity.

6)AI cheats giving increases in stability can effect net tax of provinces near the front of a distant war as well.

7)Making AIs less likely to lose troops in battles by modifying DP settings that increase their morale can effect their efficiency in retaining large enough armies to conduct seiges in long distance wars. A MIL boost from an AI cheat can help here too.

8)Events giving troop stacks near a front of a distant war can help AIs fight them quite a bit. Transports given in the same provinces can help AIs make amphibeous assaults faster too, so long as the transport capacity is enough to carry the troop stacks.

Keeping AIs from overproducing armies, while at war, is very important. For AI minors, I'm afraid they are just screwed. They lack the funds to handle the big troop stacks they seem so fond of making. This causes massive inflation and zero investing as a result of a lack of free funds. Their problem can be curbed however, the same way the larger AIs' problem with excessive troop production can be fixed.

By making DP settings shift to high quality, we can reduce available MP thus reduce overproduction while at the same time increasing troop efficiency in combat and cost of troops which also will reduce overproduction. We can also lower aristocracy to decrease cavalry production causing the same cost effect. We can decrease serdom to do the same thing cost-wise. Same with the land setting.

Ideally what we want is this; countries that have various provinces across water, like major colonial powers, need low land settings to reduce MP, increase cost of troops, and decrease cost of ships. They also need low aristocracy, low serfdom, high offensive, and high quality to keep their troops strong and not overproduced but keep their ship numbers high and strong too. This will make them perform much better in wars.

Countries like Russia or the Ottomans that we want to be strong, we make high land in addition to low aristocracy, low serfdom, and high quality. This will keep their troop production costs high and not let their MP get out of hand, while at the same time make their ships weaker and produced less often. It will also make them extremely strong in battles, so use with caution as it may be over-done.

I'll go into DP settings and their overall effects on AIs as well as their usage for specific circumstances in the next chapter and I'll even talk more there about their effects on wars too but for now hopefully what I've said should be sufficient for understanding the main elements of AI war behavior.
 
Last edited:
Chapter 7: AIs and DP Settings

Chapter 7: AIs and DP Settings

When we play the game we manipulate DP settings to maximize strategic potentials. But AIs do nothing of the sort. Instead they have DP settings forced on them from setup, historical events, but often by random chance.

AIs pick the A option in events about 95-80% of the time. This means that after the 1 option historical and random events that cause DP changes and the starting DP settings are factored in there is still a sizeable potential for variation. The more random events with 2 options or more the AI is eligible for, the more the AIs can have varying DP shifts. Same goes for historical events. If that AI has many historical events, he can have his DP settings shift into all kinds of strange directions.

Often these shifts are detrimental to a particular AI's performance. For example if the Ottoman AI shifts to too much innovative and centralization, he will tech too quickly, often he'll be in the lead. But OTOH, he'll have many revolts, because of the decreased tolerance to war exhaustion. This can result in an Ottoman empire that can't get big but can screw up the game by making muslims tech as fast as Europeans.

Here's another example, England and France have many land/naval DP shifting historical events. If they pick land too far, come 1600 or so when their colonial empires need to take off, they may only be sending 1 or 2 colonists to colonial provinces a year, and often as just TPs too, resulting in puny colonial empires by 1700 or so.

Another problem is when an AI gets too many aristocratic DP shifting events and he'll go too plutocratic. This can result in him having an innability to DOW as often as he needs to, make alliances frequently enough, or not resolving wars quickly enough when he is at war. This is because of too low of a DIP rating. We can handle 1 to 2 diplomats a year but AIs aren't programmed to be restricted that much.

Well all of this should make you aware enough that DP settings do indeed have a dramatic effect on AIs. Now let's analyze each DP setting and how it does or can be made to effect AIs to help or cripple them.

Plutocratic/Aristocratic:Aristocratic makes the AIs have better diplomatic ratings. This increases the amount of diplomats they recieve annually and also improves their relations with surrounding nations slightly, mostly it helps compensate for hits to their relations. It also makes cavalry cheaper. The downside to it is that it makes warships more expensive and lowers trade and production efficiency.

OTOH Plutocratic makes ships cheaper and increases trade and production efficiency. But it also lowers that DIP rating and increases the cost of cavalry.

Most AIs begin the game around 3 or 4 aristocracy and due to random and historical events, tend to fluctuate around that number too. We OTOH, are well aware of the benefits of high plutocracy and usually tend to eventually go full plutocracy. This gives us an edge over the AIs in that we can make ships cheaper than them and we have better merchants. Both these advantages really give us quite an edge in the long run.

At high aristocracy the AIs have low cavalry costs. Ironically this is often a detriment to them, because they tend to make alot of cavalry then. AIs have no sense about where and when to use cavalry effectively. They also do not target our armies, particularly in plains terrain where they can capitalize on cavalry advantages. Instead they choose to either gather troops together to use either offensively or defensively, keep those troops in a defensive spot, or usually pick a province of one of their enemies and start to seige it. If they have 20,000 cavalry and 5,000 infantry, that will not stop them from seiging a mountaneous province first. We can then march in with little or no cavalry and lots of infantry and butcher their army. Much of the map is covered with mountaneous and swampy terrains that cavalry is crippled in.

Cavalry also has a much higher support cost than Infantry does. An AI with alot of cavalry is really going to be paying through the nose for their army. As I've pointed out in previous chapters, this saps their available funds for investing quite a bit. Therefore for these reasons, except in select circumstances, we actually don't want AIs to make much cavalry.

This leaves one sole benefit for an AI to be aristocratic, high DIP, which is very important to healthy AI diplomatic behaviour. Fortunately there is a way to bypass the low DIP of an AI being too plutocratic with this command here.
Code:
command = { type = DIP which = 6 value = 3600 }
If this is used in conjunction with a big, proabably full shift to 0 aristocratic, AIs can receive maximum benefit from this DP setting.

Having an AI at full plutocratic, can be very useful, particularly if that AI should be competing well with our merchants. It will help him quite a bit, increasing his trade efficiency(TE) on average by about +6%. This will delay human players achieving global trade dominance. Global trade dominance is where a human player can fill every COT in the game with 5 to 6 merchants and due to overwhelmingly superior TE, the AIs can't do anything about it and can't outcompete a human player's merchants faster than humans can replace them.

Many players make achieving global trade dominance, one of their highest, if not their highest, priorities. But does humans achieving this in say 1520 really make for a good game? IMO, humans achieving this so quickly makes for a boring game, as it makes you so filthy rich that the game is then all downhill from that point on. Once you have global trade dominance, you can do whatever you want. The struggle to overcome competing AIs ceases, because they simply can no longer muster the monthly income that you can. Does this current phenomonen of EU2 make any historical sense? Does it not make an atrocious farce out of gameplay? Hopefully I am not alone in my disgust of this common result in most games in the early to mid 16th century. Wouldn't it be more fun and historically relevant if we still had to struggle against AIs past this date? This can be achieved through a variety of means. Making key AIs having full plutocratic through AI only DP shifting events is a big step in this direction.

If an AI is a colonial power or a country that has some territory seperated by water, plutocratic can also help them quite a bit by making warships cheaper and making cavalry more expensive, thus increasing the size of their navy and limiting the growth of their army.

As I've pointed out in previous chapters, AIs have problems with overproducing armies, thus anytime we can make their army more expensive, we are usually helping them. The exception for cavalry costs would of course be in circumstances where an AI country clearly benefits from large numbers of cavalry. In these circumstances however, full land can compensate for the cavalry cost increases caused by being plutocratic. In my mod I only make an AIs aristocratic if I want to hurt him.

decentralization/centralization:The main difference as far as AIs are concerned between these two settings is the production efficiency(PE) increase and the effect that centralization has on annual income. The other settings can be compensated for by manipulating the innovative DP setting in conjunction with this DP setting to compensate for any unwanted effects and thus I'll discuss those effects in the innovative section of this chapter instead. PE likewise has a useful effect but since it can be tweaked in conjunction with other DP settings that effect PE, I'll talk about it there as well.

This leaves us with the annual income effect of centralization to consider. Annual income is derived from each province that is a city. Bailiffs make 75% of the net tax, taxable for census tax(annual income). All core provinces have the other 25% automatically given. But non-core province recieve some, all, or none of this 25% unaccounted for based on the centralization setting. Thus if an AI has many non-core provinces, like in the case of a colonial major, it is very useful to have it get full centralization, thus increasing it's annual income and thus his investing capacity.

The benefits to centralization are clearly better than the benefits to decentralization. All the unwanted effects can be compensated for by other DP settings. Thus the only reason we don't want an AI to have full centralization is if we don't want to help him but cripple him instead.

Narrowminded/Innovative:Narrowmindedness makes AIs tech more slowly, convert wrong religion provinces more often due to an increase of random conversion events and more available missionaries(really this one is matter of having any available at all), delays war exhaustion, increases the amount of colonists they have, and decreases stability cost. High innovativeness increases tech speed, decreases chances for coversion, increases war exhaustion, decreases the amount of colonists they receive(it could go negative), increases war exhaustion, and increases stability cost.

IMO narrowmindedness is almost always better for AIs than innovativeness. The war exhaustion usually hurts AIs and as I almost always give AIs more centralization to help their tax income and PE(which I'll explain more later on in this chapter) narrowmindness winds up being used to offset both the increased techspeed and war exhaustion.

Most AIs suffer from low stability worse than us. It's true that they often invest in stability, whereas we often don't but the facts are that they pay no attention to things that cause stability decreases. They will not hesitate to pick event options that in fact lower stability. We are careful of this if it will really hurt us, they are not. Also they pay no attention the stability lowering effects of diplomatic actions. Thus in the end their average stability is lower than ours. The decreased cost in stability then really actually helps them out quite a bit. Plus I also tend to make AIs have low serfdom. That increases stability cost and so often the full narrowmindedness merely offsets that as well.

It can be useful to have an AI have high innovativeness for a certain period of time though. If we have an AI that needs to increase his tech dramatically for a short period of time to gain a technological lead, like with England or the Netherlands, it may be useful to keep them as highly innovative for a 20 or 30 year period of time. Otherwise I would say in most circumstances, narrowmindedness helps the AIs best.

Freetrade/Mercantilism:I think that we as modders need to view AI DP settings as not something that represents a country's historical personality but instead view them as something that can be manipulated to achieve historical results. What does it matter if an AI has low mercantilism that had high mercantilism historically, if the low mercantilism can cause that AI to achieve more historically relevant results? We can make the starting DP setup be historically relevant but we ourselves never keep it that way. We manipulate them to our advantage while the poor AIs get tossed to and fro by blind chance. And we do not even see the AIs' DP settings. Why would someone see what an AI is doing and then scream, "no fair, that AI gets full freetrade, and I have to take years to get it," when they can't ever see the DP setting in the game? I think it is time we view DP manipulation for AIs the exact same way we view personal AI files, as a means of programming AIs to perform better and more historically.

This brings us to analyzing the effects of the mercantilism DP setting. Being more free trade causes an AI to receive more merchants, make his merchant sending attempts more successful, makes his merchants' cost more, and gives him more colonists. Being more mercantilist causes an AI to have less colonists(could be negative overall too), less merchants, less chance for successful merchant attempts but more chance for surviving merchants to last, and merchants to cost cheaper.

We need to consider which one of these best helps AIs. In this particular DP setting, I think it is clear that some AIs are helped more by being heavily freetrade and other are actually helped more by being heavily mercantilist.

For large colonial majors or countries that have decent TE due to religion and techspeed and have large funds in comparison to other countries, I think it is clear that they benefit from being heavily freetrade. If an AI has high TE, giving him low mercantilism can increase the amount of merchants he sends to COTs. This is also very good for delaying us humans' ability to achieve global trade dominance sooner. If the most trade efficient AIs are merchant starved, how can they compete well with us in COTs? We can outproduce them. We tend to go full freetrade in most games. This is because with our high TE which we make a priority we can really capitalize on merchant income, success, and sustainance in the COTs. AIs can be made to benefit more from this kind of income too.

AIs do not increase their available funds for investment by gaining more income from their merchants in COTs. Trade income only effects monthly income. The reasons why we want the AIs to be successful in COTs is so that we are less successful and so they will tech faster.

The extra colonists also help colonial majors. We get them when we intend to colonize alot but often the AIs don't have low mercantlism, so how can they compete with us in colonist production? They will need their DP settings tweaked right and have an AI file that is optimal for this.

Now there are some circumstances where high mercantilism is actually better for the AIs. Did you know that AIs regularly blow alot of their investable income of merchant placing that doesn't even succeed? Obviously some AIs just simply lack the TE that their competitors have. If this is the case, why should we force that poor AI to send merchant after merchant in a futile effort to make a profit? Instead we can make him full mercantilist thus decreasing the amount of merchants the he wastes foolishly while at the same time increasing the longevity of the few merchants he does send that are successful. A good example of this is German minors. They lack the funds to send mass merchants anways. Their one province often barely leaves them anything left over after troop support costs, and sometimes it leaves them nothing at all. If we give them low mercantilism, then the little they do have for sending merchants can be done more cheaply. We can also give them a low "trader" setting in their AI file, to keep them from sending many.

Defensive Doctrine/Offensive Doctrine:This DP is setting is IMO a bit odd. It's main effect for AIs is the morale increase/decrease, the +1 shock value or the -1 shock value, and the +1 seige value that comes with the -1 shock value. The cost of fortresses and Artillery seems petty to me.

The lower fortress costs that come with low offensive undoubteldy help AIs. This is because unlike us, do build fortresses quite a bit if they have the funds. But fortresses are a rip off even at the lowest setting. And an AI getting to save money at the expense of having troops that don't fight as well is hardly a good trade off.

The additional shock value can help AIs but if they have a leader with +1 seige, he will then lose it and since often AIs need to conquer provinces at the same time they have leaders with a seige value at all, it often doesn't benefit them as much, as AIs heavily rely on capturing provinces to win wars rather than winning land battles. As I said earlier, AIs don't actually target armies, they really just get attacked by them or run into them while pursuing another target. I suppose full offensive could be used by AIs to help 1 province minors survive better but there is a point when tweaking battlefield strength effects can be overkill. Human players may not appreciate the fact that some puny 1 province minor that is in an alliance of some country they DOWed, seems virtually invincible in battle. Thus I'm inclined to believe that 8 offensive is the optimal setting but anywhere from 3 to 8 is OK too as the offensive DP setting's effect on morale isn't too much.

OTOH having even 1 or 0 offensive can make an AI have a +1 seige bonus. This can then make them grab provinces even faster. But if the defending country is relatively close in battlefield strength then it is hardly a worthwhile setting to have. In some cases it may be benficial to use it temporarily. For example it can really help a Spanish AI beat up the Incan AI. If the Spanish AI has good DP setting for fighting already, he's unlikely to really be hurt by having 1 less shock value. The +1 seige value then helps him grab Incan provinces even faster. But obviously after awhile this should be set back to 3 to 8 to prevent him from being to easy to bully by other Europeans later.

As far as the Artillery cost effect is concerned, I haven't seen AIs make much artillery anyways.

Naval/Land:This setting is one of the most important ones in it's effect on AIs. High naval gives the AI extra colonists, higher TE, higher infantry and cavalry costs, lower warship and galley and transport costs, lower manpower(MP), higher naval morale, lower PE, and gets rid of tax penalties, which effects annual income for provinces not connected the capital by land. High land gives less colonists(can cause a negative effect too), lower TE, lower infantry and cavalry costs, higher warship and galley and transport costs, higher MP, higher land morale, higher PE, and extra tax penalties for no land connection to the capital provinces. Obviously these are some pretty massive effects for just 1 DP setting.

If we want a colonial major to do well, we really need to give him full naval. Not having low land will mess up his TE, lower his annual income, make his navy smaller, weaker, and harder to rebuild, and constrict the amount of colonists he can produce. IMO there is just no reason we wouldn't want a colonial major to have full naval as soon as he needs to start colonizing alot.

Full naval can also help out countries like Denmark, who really need all the annual income they can get. Having nasty no land connection penalties and inferior navies can really mess him up.

Full land OTOH can really help countries like the Ottomans and Russia. They can use the ability to crank many troops to their advantage. They need to be too hard for humans to push around easily simply because they have too many good troops and can replace them easily. They don't need the naval advantages as much either.

The TE for large major AIs is very important too. Once again this DP setting has the potential to delay human global trade dominance. If low land is combined with low aristocracy and low mercantilism we can literally turn a major AI into a much more formidable trading force than we are used to having to deal with. Fortunately this also makes a lot of historical sense.

The low land/low aristocracy combination also allows those AIs to field larger navies. This makes it harder for us to bully AIs in large worldwide wars. It also enables them to rebuild their navies easier should they get slaughtered in a war.

Quantity/Quality:High quantity makes the AIs' morale lower, gives more MP, lowers the cost of cavalry and infantry, and if low enough gives -1 fire value. High Quality, gives higher morale, less MP, increases the cost of infantry and cavalry, and if at 9 or 10 gives +1 fire value.

Obviously if you've been reading this guide carefully up until this point, you can already figure that this setting being high is very useful to AIs. In fact I would go so far as to say that if you really want to completely screw up an AI for the rest of the game, give him low quality.

With the decrease in MP and higher cavalry and infantry costs, high quality helps AIs budget their money much better as it significantly reduces the chances of having an oversized army remaining at the end of a war. The only real draw back to high quality is that if it is overdone it can cause an AI to be too strong in wars. But obviously we very much want large AI majors to be very strong in wars so we can't bully them so easily.

MP that AIs and us get for troop building and troop supporting is not the same thing. The restrictions on MP from DP settings effects the MP that is used for creating troops. It's the number that is on the top right of the screen. It has that men icon next to it. The MP that we use for supporting troops isn't penalized. So by reducing MP from high quality and low land, we restrict an AI's capacity to build troops not support them.

Giving quality increases to AIs at the beginning of the game can also cut down on human player early game exploits as it makes AIs too strong in battle to pick on easily.

Free Subjects/Serfdom:Free subjects causes an increase in cost to stability, an increase in cost to infantry, an increase in PE, and an increase in land morale. Serfdom causes a decrease in the cost of stability, a decrease in cost of infantry, a decrease in PE, and a decrease in land morale. Obviously with the exception of the stability increase costs, low serfdom is best for AIs.

The low innovative however, offsets this. Likewise it also offsets the increase in PE from low serfdom, increased centralization, low aristocracy, and possibly high land. With all of these effects AIs have more income. But it doesn't wind up making them tech significantly faster because the low innovativeness penalizes their tech speed. The excess penalty is compensated for by the additional PE and/or TE and the increase in tech speed from centralization. And it winds up evening out in the end.

Giving those increases in monthly income from the additonal PE and TE also has another beneficial effect. If you recall in chapter 5, I talked about how AIs weigh economic strength in deciding whether or not to DOW and that this was one of the largest factors involved in that decision. Well the extra income discourages AIs from bullying weaker neighbors, like one province minors.

It also happens to decrease the likelyhood of diplo-annexations. Many people strongly dislike the fact that German minors get killed so quickly. What some may not realize is that if they don't get killed off quickly they'll likely just get diplo-annexed instead. The extra income from DP setting tweaks can reduce the likelyhood of both of these occuring. It doesn't perfectly solve the problem. Nothing that I know of can, that's why I've said often in this guide that the engine simply can't handle 1 province minor. But at least with DP settings tweaks we can delay these things from happening as well as reduce unwanted AI wars.

By using both AI files and DP setting shifts, which often don't even need another AI event and can merely be added to an existing AI file shifting event, we can manipulate AI behaviour to be better and more historical to an even greater degree.
 
Last edited:
Chapter 8: AIs and trade

Well, this is a late edition to this guide. But since my understanding of this aspect of AI behaviour has increased so much since I wrote this guide and I realize that it is important and useful to know, I'm making this additional chapter, AIs and trade.

AI income from trade has three important effects on the game.

1)It has a significant impact on the AIs teching speed. AI income from trade, both from active merchants and trade taxes, is only used, in a significant way, for tech, except while at war. Thus an AI with little merchant income, likely will not tech as fast as human players or the other AIs that do have lots of active merchants.

2)It directly effects the tendency for an AI to DOW other countries and get DOWed by other AIs. As has been pointed out in previous chapters, read economic strength of the AIs respective alliances is a big factor in DOWing. Thus if a given AI has lots of active merchants, his alliance will be read as being economically stronger than it would if he had no active merchants. So by an AI having a large amount of merchant income, it can avoid more unwanted wars, and stick to wars that are more winnable.

3)It has a direct effect on merchant competition with us humans. If AIs have lots of active merchants, then we have more merchant competition. Our merchants get bumped out or blocked more. This delays or theoretically even prevents global trade dominance(GTD). If their merchants are stronger, they will last longer and compete with us in more centers of trade(COTs).

Obviously due to the trade efficiency penalties associated with trade agreements(TAs) and trade embargoes(TEs) from the latest beta patches(They both reduce trade efficiency by 3%), we humans get a big advantage over AIs in COTs. We also have the sense to make mass refineries. They both directly increase trade efficiency and trade tech speed, which in turn increases trade efficiency even more. This sadly results in us quickly getting GTD. This quick GTD directly results in us humans having ridiculously large amounts of trade income, so much so that we are quickly then able to beat up AIs almost effortlessly, as we rapidly dwarf them in tech, available income, and the effects these have on investments that we can then make.

Early GTD arguably causes the description of the game to shift from a historical strategy game to a historically farcical strategy game. It bears no resemblance to history and makes for boring games, where we can do darn near anything we want to the AIs and no longer are stimulated by challenge in the game, except to try and see how much some farcical exploit or another can be played out. Quite a let down if you ask me. So from a modders perspective, one of our biggest concerns should be to stop/delay GTD.

There are a number of factors that effect AIs success in placing and sustaining merchants in COTs, as well as the income they accrue while in the COTs.

1)Number of available merchants:The number of available merchants is effected by, stability, trade tech level, the mercantlism DP setting, the ownership of a protestant or reformed province with a port, the number of COTs owned, and the number of monopolies in COTs owned. AIs need lots of merchants to send, or else simply time and chance will reduce their active merchant numbers.

This is particularly true since the latest betas have AIs programmed to make 1 trade agreements only. This was done to prevent AIs from having rock bottom trade efficiency due to abundant TAs. In previous versions, AIs would make 10-15 or so TAs. This had the desireable effect of enabling AIs to compete more with humans and less against other AIs. Now they have terrible trade efficiency as well as vicious AI on AI merchant competition. This sadly further aggrevates our task of delaying/stopping GTD.

2)Available cash:Obviously if an AI doesn't have the money to send merchants to COTs, they can't do it even with a good annual supply of merchants. As pointed out in previous chapters, the primary source of income that AIs use for merchant placing is from annual income aka census tax. However, it sometimes happens, that while at war, an AI has extra left over money from pumping cash and spends it on merchants instead of troops or ships. This also happens sometimes right after a peace settlement too. Otherwise, the vaste majority of the time, it is literally annual income that effects available funds for merchant placing.

3)The trader setting in the AI file:Having this setting be higher makes the AIs more likely to spend available money on merchants. I reccommend it always be 100. As a lower setting won't really help the AIs or may not even effect them, if they have little else to spend money on while at peace.

4)The monopoly setting in the AI file:This setting increases the chance for a TE. EDIT 8/21/05:I've discovered since I've made this chapter that the monopoly setting can handle a negative value, even ones as low as say -500. It indeed cuts down on AIs making trade embargoes(TEs) against other AIs and us humans as well and can be quite useful. It will however not make AIs not TE other countries when at war with them. That seems to be built into the engine, irregardless of the monopoly setting.

5)The land and aristocracy DP settings. Having both of these low, increases trade efficiency, which in turn effects the success and sustainance of merchants in COTs.

6)The number of refineries and trade tech level:Each finished refinery increases trade efficiency by 1%. Refineries also increase trade teching speed. Trade tech in turn increases trade efficieny as well. Here is a chart of it's effects.
Code:
Level	Efficiency	Effect
 0	20%		Allows Merchants
 1	30%		Allows Trading Posts
 2	40%		Allows Monopolies
 3	50%		Allows Trade Embargos
 4	55%		Allows Chief Judges
 5	60%
 6	65%
 7	70%
 8	80%
 9	90%
10	100%

7)The trade efficiency bonus/penalty from religion:Each religion has a moddable effect on trade efficiency.

8)ADM & stability:Monarch administrative ability(ADM) & the AI's stability, due indeed have a sizeable effect. I will even go so far as to say that the direct effect of trade efficiency is overexaggerated and that ADM & stability have sizeable effects on merchant placing and merchant sustainance. I've often noticed AIs being successful in COTs and even competing human merchants out, with sizeably inferior trade efficiency but high monarch ADM & high and stable stability. It is safe to say that AIs suffer from poor merchant placing and sustainance a great deal from stab hits combined with low ADM. We humans compensate for our low ADM & stab, by consistently having higher stability.

9)BadBoy(BB):BB also effects both merchant placing and sustainance. We may not notice it effecting us much, because we having enormously superior trading efficiency over the AIs anyways.

Now there are a number of ways that we can capitalize on making AIs more successful with merchants and thus more competitive with ours.

1)We can increase their number of available merchants. We can make them receive more merchants by making their mercantlism DP setting shift to 0 by an AI cheat event(it is true that high mercantilism effects the likelyhood of merchant sustainance, but considering that the AIs then have less available merchants as well as a reduced chance for merchant placing success, it is unlikely to benefit them overall). We can also give stability boosts by AI cheat events. We can also increase their trade tech and/or give them refineries by AI cheat events as well. The increased trade tech level may bump them into a trade tech level that gives more merchants to them.

2)We can give a DP shift lowering land and aristocracy. This will increase their trade efficiency, thus increasing their merchant placing success and sustainance.

3)We can inflate their monarch ADMs at key times to make them more successful with their merchants. We can also give them extra merchants and cash by AI cheat events at the times we know they have good monarch ADM ratings.

Giving an AI a monarch ADM boost can be noticeable if the normal monarch ADM stats for that particular monarch are known to be lower. However, the monarch's ADM does not show up as literal. 1 ADM reads as 1 pip. 2 and 3 ADM reads as 2 pips. 4 & 5 ADM reads as 3 pips. 6 & 7 ADM reads as 4 pips. 8 & 9 ADM reads as 5 pips. Thus if we have a monarch with say 4 ADM, we can make an AI cheat event boosting it by 1 ADM for as long as that monarch lives. This is completely undetectable by a human player, who literally still reads the ADM as 3 pips. We can also inflate an 8 ADM by 9. The highest ADM will read as is 5 pips and 9 ADM. The engine won't read it as higher. However if due to random events it is lower at the time the ADM boosting AI cheat is fired, it can then increase it to the maximum inspite of this.

4)Giving BB reductions by AI cheats, will also effect merchant placing success and sustainance.

For example, if we make an AI cheat event that looks like this,
Code:
event = {
	id = 224500
	trigger = { ai = yes atwar = no }                
	random = no
	country = SPA
	name = "AI_EVENT"
	desc = "AI check"
	date = { month = january year = 1480 } 
	offset = 360
      deathdate = { month = december year = 1499 }
	action_a ={ 
		name = "AI check"
            command = { type = gainmanufactory which = -1 value = refinery }
            command = { type = badboy value = -25 }
            command = { type = ADM which = 9 value = 60 }
            command = { type = domestic which = mercantilism value = -10 }
            command = { type = domestic which = aristocracy value = -10 }
            command = { type = domestic which = land value = -10 }
            command = { type = trade value = 5000 }
            command = { type = cash value = 200 }
            command = { type = stability value = 6 }
            command = { type = merchants value = 6 }
            command = { type = diplomats value = -6 }
            command = { type = colonists value = -6 }}}
we can make the receiving AI's merchants more successful. The negative colonists and negative merchants just ensure the money is spent on merchants and not colonizing and diplomatic actions instead. The "atwar = no" trigger, ensures that it won't be wasted on troops or ships due to the AI being at war.
 
Last edited:
Chapter 9: IDLF's Miscelaneous Advice on AI Enhancing

To be filled out later.
 
Chapter 10: Who knows, I might need another chapter!

To be filled out later, maybe.
 
This setting is complete garbage. It's only real value is as a negative value, and yes it can have one. Essentially what this setting does is make AIs colonize undesired locations simply because they are adjacent to a desired colony that it already started. I recommend keeping this, 99.999999% of the time on zero, unless you want that particular AI to spread out colonies and not bunch them together, in which case a negative setting can be used. I use a negative value on this setting for my Portuguese AI in the 15th century, to make him spread out over west Africa and not colonize a good number of adjacent west African provinces.

It seems like there would be certain values to it, like, say Russia. You want Russia to colonize next to herself, not in totally random locations. It seems like if you want to encourage a country to have one sizable colonial empire, rather than going to different continents, you might want to have a setting higher than zero. Would a positive setting for England or France be so outrageous?
 
Cagliostro said:
It seems like there would be certain values to it, like, say Russia. You want Russia to colonize next to herself, not in totally random locations.
It won't help Russia. The AI will colonize like that anyways. I'll explain more how AIs prioritize colonization and how this setting factors into that equation when I fill out the AI colonization chapter.
Cagliostro said:
It seems like if you want to encourage a country to have one sizable colonial empire, rather than going to different continents, you might want to have a setting higher than zero. Would a positive setting for England or France be so outrageous?
It does seem that way. That's what I was thinking initially myself and no doubt this exactly what the makers of EU2 were thinking too. But I assure you this setting on something other than zero, isn't even as useful as the DOTF and almost always causes detrimental results.
 
To IDFL, congrats on your site ,very informative.

See you tested my theory on the "expansion" as I did say that 10 was to high and we should use 6 for POR. Using 3 is a bit low, don't u think.

I will play around with the numbers for POR and SPA as they are under different circumstances than other trading nations.

On this -" Bonus/Penalty for establish colonies adjacent to other countries.
enemies = -50"
are you saying it is better to be negative or will zero be Ok.

Fine work. Wish I had the patience..
regards
 
Toio said:
See you tested my theory on the "expansion" as I did say that 10 was to high and we should use 6 for POR. Using 3 is a bit low, don't u think.
The main problem with this setting being too high is that sometimes AIs run out of colonizeable territory on their expansion lists. They then start colonizing elsewhere, where I didn't assign for them to colonize, when they have like 10+ colonies or TPs aready still not on the highest level. So ya 6's often are more useful than 10's.
Toio said:
I will play around with the numbers for POR and SPA as they are under different circumstances than other trading nations.
You can if you like DL my mod. It's in the mods thread. You can use whatever you want from it, like the AIs files or parts of them, even if you never play it.
Toio said:
On this -" Bonus/Penalty for establish colonies adjacent to other countries.
enemies = -50"
are you saying it is better to be negative or will zero be Ok.
Zero is almost always the best. See if it's negative then the AI will prefer provinces for colonization that are next to another country's province. So for example, a Portuguese AI with a negative number here may ignore Fernando Po, because he is adjacent to no one, and grab mainland provinces instead. That's not good because Fernando Po is a historical target and worth colonizing too as it's very cheap and has a good commodity. See the problem? OTOH there are occasionally times where for say 10, 15 years you actually happen to want an AI to grab provinces adjacent to another country's province. However for the most part by making this figure either positive or negative you are essentially telling the AI to pay less attention to cost/success ratio and colonize more foolishly. Odd that the EU2 makers would make such a rarely beneficial tool like this setting huh?

Toio said:
np I made it for everybodys' use. I figured if I passed on my know how, others will started modding better and may even make stuff that I like and can then borrow myself. Also if they have access to guides like this they may get to points of profficiency quicker and then be even more likely to discover some technique or trick that I haven't figured out yet myself. And if I am unknowingly wrong about something I'm stating in this guide, hopefully someone else can shoot me straight and then I learn something new, which I like.

Anyways, enjoy the guide. I got 2 or 3 more chapters to make and will probably have them filled within a week or two. So keep checking back on it.
 
Daywalker put out an ai package a couple of years ago. Its quite good. Not sure if you've seen his site, but it has a lot of information on it. It might be worthwhile and informative to compile both your work and his into one place.

http://www.lhjworld.sa-net.dk/
 
Stonewall said:
Daywalker put out an ai package a couple of years ago. Its quite good. Not sure if you've seen his site, but it has a lot of information on it. It might be worthwhile and informative to compile both your work and his into one place.

http://www.lhjworld.sa-net.dk/
I'm a fan of his work. I even recommend his mod in one of the chapters of this guide and provide a link to his site. As far as I know he hasn't done an AI guide. He did in fact point out to me some of the things I mention in this guide though.
 
idontlikeforms said:
I'm a fan of his work. I even recommend his mod in one of the chapters of this guide and provide a link to his site. As far as I know he hasn't done an AI guide. He did in fact point out to me some of the things I mention in this guide though.

Yep, you sure did. I missed that the first time around. Apologies. :cool:
 
Interesting thread IDLF, I hope I get the time to test some of this. For the neighbour setting, would you still keep it low if you wanted to direct England or France to filling up the US and Canada, or for late-game Portugal to focus on Brazil?

EDIT: I don't agree on the usefullness of LC's, and I think it's not so bad that the AI is reluctant to pay for them. They take forever to get profitable, even more so in low population provinces.
 
Last edited:
Norrefeldt said:
Interesting thread IDLF, I hope I get the time to test some of this. For the neighbour setting, would you still keep it low if you wanted to direct England or France to filling up the US and Canada, or for late-game Portugal to focus on Brazil?
I would reccommend not using it, keeping it on 0. AIs don't need it to influence their colonizing descisions at all. The designated areas for expansion and their built in prioritization for colonising is quite sufficient. Having anything on that neighbor setting at all mostly screws him up by making him less inclined(or more inclined) to colonize provinces adjacent to others already owned by someone else. It's completely unnessary to make AIs colonize profitably or historically. Basically it's about as useful to an AI as the Defender of the faith.
Norrefeldt said:
EDIT: I don't agree on the usefullness of LC's, and I think it's not so bad that the AI is reluctant to pay for them. They take forever to get profitable, even more so in low population provinces.
LCs make luxury commodity trade values go up. But since this is almost always going to be increased up to 200% demand by humans and by mayors and LCs recieved through historical events prior to their actually manually making them, this usually has no effect.

The real usefulness of them is that they increase annual(census tax) income. Which if you read the AI spending chapter, you would realize that, this is almost all the AIs are using to invest with. Thus it has a very sizeable effect. An AI that has 20 provinces with 20 LCs is essentially an AI that regularly invests 24 ducats more per year than other AIs that don't have them.

They are also useful for increasing troop production. For example an AI has 1 province distant from their capital but close to an enemy they are at war with. The AI will then create more troops closer to the battle. But obviously this is a lesser point.