• 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.
So what if I place 2k infantry next to the enemy, they assault - and yes their 5k cavalry is stronger than my 2k inf - but wait! I have another 6k cav one province further away that you didn't consider and once again the AI is "stupid". I'm not saying that your's or anyone else's suggestion is bad, just pointing out how quickly it can fall apart due to the player doing something else - nicely ilustrated by Premu above.

True. But as it is now, the AI checks neighbouring provinces and no further than that, so it would still be better than it is now. As it is now, just better. :) And it's a whole lot harder to exploit it if you have to keep the army 2 provinces away since time is very important in this case.

As I said, and I think you can see it. All 3 of my suggestions are quite easy to fix, there isn't a lot of checks to be done and a lot of calls to make. :)

EDIT: Or if you want to make it hard to exploit, why not do a combination of my simple suggestion and how it is now and let a dice decide if they want's to assault or not. (Makes it a little trickier to code I guess since I suspect the AI makes their decicions on a day to day basis but in this case they would have to stick to the non-assault plan and not do another check the next day.) But it will take out a lot of the exploitability if you don't know how the AI will react and a dice is hard to predict. :)

EDIT2: The dice thing could be used in a lot of places when thinking of it. I guess there are always a couple of different ideas to what is the best AI behaviour in each case and while one of them seems better I think it would be a whole lot better to let the dice decide when there are several good ideas around. That way a lot of things would be a whole lot harder to exploit..
 
Last edited:
I don't think you get it, Pany man. You've got great suggestions and you can keep churning them out till you're blue. The fact remains that you haven't posted any code. Until you can share some of that, you'll have to put up with the game.
 
I think one of the big weaknesses of AI (in land war or in naval warfare) is its predictability. The decisions AI makes are not particularly bad by themselves, but they are always the same and because of that the human player sets up the situation when AI decision is going to be bad. Human player's strategy is also highly sub-optimal and he simply relies on AI doing the same thing again. It is certainly difficult to create AI capable of recognizing such situations and countering them. Easier approach is to have several different decision (generally decent) AI can take and chose between them at random. This would make AI much harder to exploit.
 
I don't think you get it, Pany man. You've got great suggestions and you can keep churning them out till you're blue. The fact remains that you haven't posted any code. Until you can share some of that, you'll have to put up with the game.

Yeah, the difference between describing a concept and coding it is a world apart. I'm by no means an expert programmer, but I used to be a Computer Science major so I've taken a few CS courses and I understand the basic concept behind what it takes to program. When Captain Gars said "B) I'd be very interested in seeing some sample code for the "stacking problem" above. " I knew he wasn't being serious.

Then again, if someone created a massive post with a bunch of C++ code that the poster claimed would solve the problem it would be pretty funny to read (or at a minimum, interesting).
 
In my humble opinion the biggest problem with EU3 AI is the fact that there are too few "AI" personalities, which causes AI to perform very bad in situations where it needs to change its strategy.

For example, if u start game in 1399. England focuses on fighting the French, which then leads to revolts spreading all over the island which causes Scotland (when it takes it) and Wales to revolt almost every single time. I cant remember a single game where England's AI switched its "posture" to "colonizing" with any success ay 1500s.

Same thing happens with Castille who almost always takes Portugal apart (thus kinda screwing colonial part of the game for like 1/3) or wastes decades ignoring Aragon, or even worst, conquering north Africa and ignore Americas completely.

Now i understand ur development policy - for example, compare HoI2 AI system (every individual country has its own AI file) to EU3 which is kinda dumbed down, with all due respect to its creator. The reason AI cant realize its full potential is because its behavior is too "general". England and Castille are not in same contextual position in, say, 1500, so therefor, altho they could be "colonizers" this doesnt really tell AI much.

If we had individual country files, say, England for example, that would tell its AI something like:

#1: hold all provinces that make up England *insert province numbers* yes / no
#2: hold Wales *insert province numbers* yes / no
#3: hold Scotland *insert province numbers* yes / no
#4: hold Ireland *insert province numbers* yes / no
#5: hold northern France *insert province numbers* yes / no

then from this we could have alot of possibilities for AI to comprehend, that, for example, it should not do #5 if any other #, 1,2,3,4 is false, simply because attacking France without good power base (in this case whole Britain and Ireland) isnt really smart, and if it cannot do this, it should colonize.

I understand this would require alot of work, probably more than Paradox is willing to afford, but honestly, if u think about it, u have this whole modding community out there. If u dont wanna do it, then give us the code in .txt files, just like u did with HoI2 for example. No matter how complicated the system is i bet u, in a month u will have at least 10 different mods based only on changing the AI - thats how popular this thing is going to be.

As for AI's overstacking problem, u could solve this in a number of different ways: for example tell the AI to use max unit stack relative to either date (if its <1450 use max stack of 10, if its >1450 <1550 use 15 etc) or technology level (tie it to land tech, so if ure land tech 5 use stack size 10, if ure 10 use 15 etc.) u can even add a certain "dice" roll to go 5% up or down just to keep it "randomized". This shouldnt be too hard to do having in mind uve already made a whole game xD
 
All this is way over my head, but I just thought I'd throw in my two cents. I'm not a great player, not by a longshot, but I think the AI provides a very good challenge if I am playing a normal nation, like not France or the Timurids or something. It's ruthless, opportunistic, totally self-interested and plots against the player. The single biggest problem I've seen is that the AI will always fight wars aggressively, even if they are hugely outnumbered and would do much better by staying home and scorching the earth. This one addition would save a lot of Hungaries from Austrias and Moroccos from Spain. I'm not saying I can tell anybody how to program that, just putting my observations out there.
 
Yeah, the difference between describing a concept and coding it is a world apart. I'm by no means an expert programmer, but I used to be a Computer Science major so I've taken a few CS courses and I understand the basic concept behind what it takes to program. When Captain Gars said "B) I'd be very interested in seeing some sample code for the "stacking problem" above. " I knew he wasn't being serious.

That was the reason I only adressed those 3 changes and not "fix the stacking problem". I'm not a programmer either but I have done some C coding and even pascal in the computers adolescense, having studied both engineering physics and computer engineering gives at least some knowledge of how it works. :)
But if you read my suggestions again you can see there are only IF - THEN situations I suggest (except the randomization part but that was a detour).
IF enemy army in neigbhour province < than my cav THEN assault. As it is now it's exactly the same except that they remove the "< than my cav THEN assault" part and put in "THEN siege" instead. Everything is already there.
IF small enemy navy THEN attack with whole fleet. As it is now it's, "IF small enemy navy THEN attack with small*2 ships" which is very easily exploitable. And they fixed it in one beta but removed it for some reason so that can't be very hard. :)
IF transport fleet < 5 ships within certain range from another transport fleet < 5 ships THEN combine them, IF transport fleet > 14 split in two.

Everything is there in the game and it could be used to improve the AI. And there would be no point whatsoever for anyone here to make an exact C++ code for this since PI would have to rewrite it anyway to suit the rest of their code and it would only be harder to read than my semi code. Good enough? :)

But really. These ideas are only fixes of some of the worst problems. The best improvement would be the randomization part. If there are two or more decent ideas (and they could be extremely simple) of how the AI should react to each situation they could use a dice to let it decide which to use. Then it would be much much much harder to exploit the AI since you can't find a pattern where there are no pattern. :)
 
@Danubian Cossack
You seem to suggest taking away all general rules such as income/manpower comparison, depending on fixed geography-based rules. That's an absolutely worthless approach to AI, especially for such a large scale, moddable game as EU3. You can't script everything for over 200 nations. If you'd change something in the mechanics, you would have to redo all of your AI rules. If you'd change the map, it wouldn't understand your commands anymore. And furthermore, the programmer would have to be a perfect strategist, foreseeing all possibilities. Instead of 1 decent AI you'd probably end up with 200 very rigid, predictable, exploitable AIs. On the other hand, I do agree that there could be a general higher-priority goal telling the AI to secure their home landmass or home cultural group first.

Another thing you guys have to keep in mind is the sheer number of AI opponents, each with different goals, each with a potentially huge number of armies. This is a heavy workload and more advanced AI techniques would take quite a toll on performance. Therefore EU3 is a relatively unlikely game to feature very advanced AI (compared to say, shooters, or limited-scope strategy/tactical games with a few dozen units belonging to just two sides on the map at most).
 
@Danubian Cossack
You seem to suggest taking away all general rules such as income/manpower comparison, depending on fixed geography-based rules. That's an absolutely worthless approach to AI, especially for such a large scale, moddable game as EU3. You can't script everything for over 200 nations. If you'd change something in the mechanics, you would have to redo all of your AI rules. If you'd change the map, it wouldn't understand your commands anymore. And furthermore, the programmer would have to be a perfect strategist, foreseeing all possibilities. Instead of 1 decent AI you'd probably end up with 200 very rigid, predictable, exploitable AIs. On the other hand, I do agree that there could be a general higher-priority goal telling the AI to secure their home landmass or home cultural group first.

Another thing you guys have to keep in mind is the sheer number of AI opponents, each with different goals, each with a potentially huge number of armies. This is a heavy workload and more advanced AI techniques would take quite a toll on performance. Therefore EU3 is a relatively unlikely game to feature very advanced AI (compared to say, shooters, or limited-scope strategy/tactical games with a few dozen units belonging to just two sides on the map at most).

Actually no i dont suggest that AI should ignore anything at all, im just saying, it should have a "contextual" focus on certain areas, so for example, England shouldnt try to fight France if the island is divided/under revolts or owned by someone else. Thats simply because it will not have a big enough tax base to afford troops needed to defeat France, so it will mint and thus destroy itself just like it happens in almost every game i play from 1399.

I also suggested that those files should be made available for modders because i know people will add new provinces etc. If u modify my first suggestion and switch privnce IDs with regions, then there would be no problems at all with modding, as most of the people who add new provinces also know how to put them in proper regions.

Its the same thing with my own mod, in which i added something like 300 new provinces (i completely redid France) which caused most of the missions in Europe to become messed up since they use province ID. With my way of doing stuff u wouldnt have this problem at all. :)

I dont agree that u cant script everything for 200 nations (theres less in EU3 afaik anyway) its prefectly doable, if u ever played HoI2, there were way more AI files than what im proposing for EU3.

Again u interpret my idea "very rigid" for some reason, i never said that AI should follow a path a>b>c>d etc, i said it should have some goals as listed in England example, and its decisions should be based on those goals. This would actually give u quite a big diversity in AI decisions. Anyway, think about it, 3 different AI personalities which u can learn in a few hours, OR 200 different personalities, that would take ages to learn, ud have a new expereince with every country u play...

As for performance, well idk, i have a quad core processor, and due to current state of EU3's engine im wasting 3/4 of my CPU power. This is not something for us to think about, but rather for Paradox, in my humble opinion.
 
I think one of the big weaknesses of AI (in land war or in naval warfare) is its predictability. The decisions AI makes are not particularly bad by themselves, but they are always the same and because of that the human player sets up the situation when AI decision is going to be bad. Human player's strategy is also highly sub-optimal and he simply relies on AI doing the same thing again. It is certainly difficult to create AI capable of recognizing such situations and countering them. Easier approach is to have several different decision (generally decent) AI can take and chose between them at random. This would make AI much harder to exploit.

This. If your enemy can predict your every move, you've already lost.
 
If we had individual country files, say, England for example, that would tell its AI something like:

#1: hold all provinces that make up England *insert province numbers* yes / no
#2: hold Wales *insert province numbers* yes / no
#3: hold Scotland *insert province numbers* yes / no
#4: hold Ireland *insert province numbers* yes / no
#5: hold northern France *insert province numbers* yes / no

then from this we could have alot of possibilities for AI to comprehend, that, for example, it should not do #5 if any other #, 1,2,3,4 is false, simply because attacking France without good power base (in this case whole Britain and Ireland) isnt really smart, and if it cannot do this, it should colonize.

So ENG should just let FRA or whoever take over their French provinces and make no effort to fight in France before they've annexed all of Scotland and Ireland? That doesn't sound like a better AI at all.
 
Personally I've never had any issues with UK/England and their continent holdings. If anything it's the French that are far too passive in getting them back.

The only thing that could be improved on, IMO is when a larger nation has cores on a smaller nation but won't DoW them for over hundreds of years. I see this with UK when some Irish minor revolts and sometimes with the Ottomans, Persia and France
 
Now i understand ur development policy - for example, compare HoI2 AI system (every individual country has its own AI file) to EU3 which is kinda dumbed down, with all due respect to its creator. The reason AI cant realize its full potential is because its behavior is too "general". England and Castille are not in same contextual position in, say, 1500, so therefor, altho they could be "colonizers" this doesnt really tell AI much.

If we had individual country files, say, England for example, that would tell its AI something like:

#1: hold all provinces that make up England *insert province numbers* yes / no
#2: hold Wales *insert province numbers* yes / no
#3: hold Scotland *insert province numbers* yes / no
#4: hold Ireland *insert province numbers* yes / no
#5: hold northern France *insert province numbers* yes / no

then from this we could have alot of possibilities for AI to comprehend, that, for example, it should not do #5 if any other #, 1,2,3,4 is false, simply because attacking France without good power base (in this case whole Britain and Ireland) isnt really smart, and if it cannot do this, it should colonize.

I understand this would require alot of work, probably more than Paradox is willing to afford, but honestly, if u think about it, u have this whole modding community out there. If u dont wanna do it, then give us the code in .txt files, just like u did with HoI2 for example. No matter how complicated the system is i bet u, in a month u will have at least 10 different mods based only on changing the AI - thats how popular this thing is going to be.

Everything you mention here can be done by modders (and is in some mods). I've done some AI modding myself but if you're interested here's what some of the real pros have done:

Lothos' AI Scripting Project for Vanilla
Lothos' AI Vanilla Project
Helius' Ad Infinitum 3.3

Johan's scripting guide for modding the AI.
 
Some "I conquered and colonized the whole world with Ryukyu!" hardcore types overestimate the average capability of a EU3 gamer, true.

Exactly. I'm not a great player, and I failed all the times I tried to play with a medium faction. When I played with Mecklemburg, it went well until France became a monster and, eventually, ate me, along many other German minors.
 
So ENG should just let FRA or whoever take over their French provinces and make no effort to fight in France before they've annexed all of Scotland and Ireland? That doesn't sound like a better AI at all.

Euhm no, but if "making effort" leads to failure in 99% of cases, and by failiure i mean England usually being overrun by Scottish/Welsh rebels and losing Ireland, then u tell me? Id rather have England colonizing from 1500s without French lands than have 1399. England try to hold everything only to fall apart never to regain its power, but thats just me.

In any case i just gave u an example, dont take it litteraly, the point i tried to make is give AI smaller and bigger objectives. English AI attacking France (unless theyre losing war with Bur or whoever) is basically a suicide in almost every single case, and thats exactly what the English AI usually does, but if they hold more land (i.e. Scotland and Ireland) they should have better chance, right?
 
No, that's exactly what would happen if you code the AI to
not do #5 if any other #, 1,2,3,4 is false

You have to remember the computer will take whatever you program in exactly literally, that's the entire point. "Garbage in, garbage out". It's easy to say "The AI should do X" but you have to then decide exactly how and when it does X. You cannot just give a computer a list of vague guidelines and trust it to follow your meaning, everything has to be coded exactly. If you make a simple AI it'll be dumb, if you try making a smart AI it gets very complex indeed.
 
No, that's exactly what would happen if you code the AI to

You have to remember the computer will take whatever you program in exactly literally, that's the entire point. "Garbage in, garbage out". It's easy to say "The AI should do X" but you have to then decide exactly how and when it does X. You cannot just give a computer a list of vague guidelines and trust it to follow your meaning, everything has to be coded exactly. If you make a simple AI it'll be dumb, if you try making a smart AI it gets very complex indeed.

Would it be possible for Paradox to "decode" AI files some time in the future? I mean, to make those files accessable like in HoI3 or whatever if u know what i mean. I would really like the opportunity to mess with those files :)
 
Did you see post 73? Aside from what's already possible I don't think anything else is likely.

Yeah i saw post #73, thats not quite what i want. Im more interested into other stuff like what makes AI declare war (different values i assume) how it distributes its armies (garrison vs overseas if there is such a thing), how it determines stack size etc. The stuff Johan released is more about relations between countries.

Thx for the reply tho, i didnt expect much tbh, it just would be pretty awesome if u guys could release more.
 
In my humble opinion the biggest problem with EU3 AI is the fact that there are too few "AI" personalities, which causes AI to perform very bad in situations where it needs to change its strategy.

For example, if u start game in 1399. England focuses on fighting the French, which then leads to revolts spreading all over the island which causes Scotland (when it takes it) and Wales to revolt almost every single time. I cant remember a single game where England's AI switched its "posture" to "colonizing" with any success ay 1500s.

Same thing happens with Castille who almost always takes Portugal apart (thus kinda screwing colonial part of the game for like 1/3) or wastes decades ignoring Aragon, or even worst, conquering north Africa and ignore Americas completely.
You can do something like this by manipulating the mission system: the AI often responds to that. Also, a lot of bad AI decisions come out of the mission system: I've seen a 1-province AI get a mission to attack a 3-province AI, so it does, so the 3-province AI annexes it. Or consider a situation that happened when I was playing Portugal, with a strategy of keeping Castille safe by high relations and royal marriages: I got the mission "attack Castille". Now I knew enough to discard that mission, but the AI wouldn't have: but you could make the AI better by modding that mission (I think it was one of the "attack a rival" ones) so that countries don't get the mission to attack rivals they have relations better than 100 with, or that they have royal marriages with, or perhaps that have more provinces (or some other metric of strength) than them.

One bug in this is that the AI interprets a mission to colonize provinces as a mission to conquer them. (You can tell this by looking at the save file when Ming has the "colonize Taiwan" mission, there will be a conquer_province = taiwan's province number structure, not a colonize_province = taiwan's #.)