EU4 - Development Diary - 27th of February 2018

Showing developer posts only. Show all posts in this thread.

DDRJake

Field Marshal
108 Badges
Feb 4, 2011
5.156
6.567
  • Europa Universalis IV
  • Ship Simulator Extremes
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Mount & Blade: With Fire and Sword
  • Cities: Skylines - Mass Transit
  • Cities: Skylines - Parklife
  • Cities: Skylines Industries
  • Cities: Skylines - Campus
  • Age of Wonders: Planetfall
  • Battle for Bosporus
  • Europa Universalis 4: Emperor
Good day all. Tuesday rolls around as it often does and we're back with another Dev Diary for Europa Universalis IV. Today we'll talk about 2 things: Improvements to the Naval AI and the new National Ideas of the various Irish Earldoms.

Firstly the AI. For this I will pass the mic to the living legend among AI programmers @Chaingun

#####

Hello, I am Chaingun aka. Skynet, although my real name is Petter (non-Swedes feel free to pronounce as Peter). Today’s dev diary will put the lens on what kind of new AI bugs (and occasionally WAD behavior) you may expect from the 1.25 update accompanying Rule Britannia.

The main [AI] focus of 1.25 has been to sort out the less than ideal naval behaviors. Some of you may have the perception that France transporting all their troops to an island in the Pacific is a recent thing, though in fact the AI’s logic has always permitted that to happen. It has been showcased far more frequently beginning when @Gnivom fixed overseas war declarations, due to the increased frequency of AI troops transport attempts overseas.

This overall situation is interesting because it highlights some of the many perplexities of game AI development, of which I would like to recap:

  • Fixing an issue can make the AI worse indirectly because of another latent issue, as the naval transport situation illustrates. Another example would be reducing the AI’s siege army sizes to reduce attrition when it doesn’t understand how to distribute cannons in their armies.
  • Fixing an issue can make the AI worse because we actually create another issue by breaking something.
  • A symptom often has multiple causes. An example is the famous sleeping army bug which is in very general terms can be explained as the AI getting into an external or internal state it cannot handle, resulting in all the commands it attempts (if any) being invalid.
  • A cause can have multiple symptoms that seem entirely disconnected or otherwise have very far-fetched causal dependencies. Ottomans falling behind massively in tech due to AI refusing to invade a rebel held island (due to having fewer transports than rebel regiments times a constant) would be an example.
Game AI programming is not a recommended job if you don’t like hearing how stupid you are on the forums forever afterwards not tweaking for their pet issue when working on a fixed time schedule. The line between bug and feature is thin indeed.

Returning to transport issues; in 1.25 the naval invasion AI is constrained from moving more than 50% of their troops “abroad”, where abroad is defined as a different landmass on a different continent, and army divisibility is not subject to said restriction (so if France does just have one army, it may be found in South America all the same). However, this is just the naval invasion logic… the land army AI may still decide to walk across Eurasia with all their armies for obscure reasons. It’s something I would like to rectify in the future if I get time for it.

Another big problem with the naval AI of previous patches is that it’s simply extremely slow in transporting troops. This issue turned out to be complex, and a number of sub-issues were identified and dealt with to various degrees:

  • There were several bugs where AI fleet and/or an army awaiting transport actually would be forever stuck until reload or even after.
  • The AI can now actually split a fleet if not all transports are required.
  • Sailors had been rebalanced to actually matter for some countries. Nobody had taught the AI this, resulting in many large countries having 0 sailors all the time, in turn leading to fleets spending most of their time in repair. As this was a surprise to me as well, and the issue is highly complicated to fix, the AI may now cheat on sailors by conjuring them out of thin air if they run out. This allows seamlessly working towards fixing the sailors handling without the naval AI being utterly handicapped in the meantime.
  • The AI’s transport fleet (of e.g. Spain) would often be found sailing around in Indonesia or some other far away place, taking years to respond to anywhere else. For Great Britain, this was even worse as the warships that were needed to defend against invasion partook in said expeditions. A fairly intense rework in how the structure their fleets has been made as detailed in the next paragraph.
Initially, when I set out to improve the AI’s fleet response times, I thought it would be a matter of having fleets based in appropriate ports around the world. Unfortunately, the AI (and neither do human players) have enough ships for this. Even the largest colonizers in the world can at most field a couple of hundred warships and transports. Splitting up warships lightly can therefore be disastrous.

The solution settled for has been to make the AI place the bulk of its warships into a Home fleet, which is forbidden from venturing far from the home coast, and does not contain any transports. Because it does not contain transports, it will never be busy transporting troops. This behavior is conservative, but conservative behavior is better for AI in practice. Europeans will not attempt to challenge Ming with a large fleet of heavy ships, they do however pose a token challenge to someone attempting to land troops on their shores.

So were these changes enough to make the AI a formidable force at sea then? Astute players may have noticed the AI barely built any ships whatsoever. During Christmas, the AI’s economy was tweaked to build far more warships, force limit buildings, and float less money. It was bloody perfect for a while with the Ottomans fielding 1.5 million men. Much later, new army maintenance costs came into the picture later as a surprise wrecking AI economic balance, so the 1.25 release may have regressed in this regard. Still, it should be better than it was on the naval front.

The implication of this rework on the whole makes the AI a bit more capable at naval stuff. Its micromanagement is still terrible, and skilled players will still be able to play “lure the fleet away” tactics to invade Great Britain with ease. Players using house rules or otherwise not exploiting AI behavior may however find some challenge in making naval invasions sometimes where previously they would not.

It’s worth some amount of extraposition explaining why the human player will always beat the AI as it’s coded in EU4. The crux is, the AI in Paradox games is using a fixed manual coded strategy. The extent to which is changes its behavior in response to what a human opponent does is limited to the exact tactics pre-programmed by the human author. Merely the fact the AI will not change is enough for the human to pick counter-strategies that are very effective against whatever the AI is doing, whereas they can not go into the same extreme degree of specialization against another human opponent.

Lastly, let me state I’ve been here since the Autumn on EU4 as a consultant (I was working with PDS full time until around 18 months ago), but I am being reassigned from EU4 to SECRETPROJECT, still at PDS, where I have freedom to create many new and wondrous AI bugs, or maybe even let the AI create the bugs itself, as any intelligent being would.

That’s all for now.

#####

Cheers Chaingun. Next up we'll look at New National Ideas for the Irish. Ireland is one of those places that could honestly be divided up but we are satisfied with the setup we have reached in 1.25. The following National Ideas have been either added or amended, with credit to @macd21 who made considerable contributions to these:
  • Leinster
  • Kildare
  • Clanricarde
  • Tyrone
  • Ulster
  • Maccarthy
  • Ormond
  • Faly
  • Tyrconnell
  • Repurposed group set for united Ireland
With this the entire Island's nations have their own unique National Ideas, with a formable Ireland having their own set. Let's pick 3 to look at: Meath, Kildare and Ireland

MTH_ideas = {
start = {
fort_maintenance_modifier = -0.2
global_garrison_growth = 0.25
}

bonus = {
leader_siege = 1
}

innefectual_overlords = {
global_tax_modifier = 0.10
"The English government in Dublin and their Irish Parliament puppets have been weakened as result of England's many conflicts in the Hundred Years War and the War of the Roses. Their influence no longer holds any sway over the true lords of Ireland, and now is the time to strike out for our independence."
}
foreign_nationals = {
diplomatic_reputation = 1
"In 1487, the Irish lord John de la Pole, Earl of Lincoln, invited a host from Burgundy to Dublin to support the crowning of Yorkist English pretender Lambert Simnel. Ireland would make for a fine base of resistant against the English mainland, and forever keep the would-be occupiers at bay. We may also one day gain powerful supporters, such as the Kingdom of Spain."
}
mth_parliament_of_ireland = {
stability_cost_modifier = -0.10
"When the English were expelled from Dublin, they left behind an institution called the Parliament of Ireland. Meant as an instrument to subjugate us, we will instead use it to organise our efforts to resist a return of English rule."
}
mth_englishtown = {
culture_conversion_cost = -0.15
"Once known as Irishtown and a ghetto for native Irish in Dublin, we have turned the tables. The district is now relegated to the Englishmen who remain, there being forced to integrate into the new order."
}
mth_the_cess = {
global_tax_modifier = 0.1
"The Cess is a special tax for the purpose of maintaining the extraordinary garrisons required to keep our towns safe. The people resent the tax, but understand its necessity."
}
mth_trinity_college = {
adm_tech_cost_modifier = -0.1
"Ireland lacks an institution of higher learning. A Catholic university in Dublin would put Ireland on the academic map."
}
mth_siege_mentality = {
defensiveness = 0.20
"The people of Dublin and Meath have had to endure many sieges through the years. We understand how to survive them and how to resist them."

KID_ideas = {
start = {
global_unrest = -1
defensiveness = 0.20
}

bonus = {
prestige = 1
}

kid_lords_of_ireland = {
diplomatic_reputation = 1
"Through strategic marriages and alliances with both Gaelic and Anglo-Irish families, the rulers of Kildare maintain a degree of influence throughout the island of Ireland unmatched by any of their rivals. Such is their power that successive English monarchs appointed them as their Lords Deputy over the island."
}
kid_ear_of_the_king = {
improve_relation_modifier = 0.2
"Despite repeatedly betraying the crown, the FitzGeralds of Kildare talk their way out of trouble, returning home with a pardon and a promotion."
}
kid_silken_finery = {
land_morale = 0.10
"When Thomas FitzGerald renounced his allegiance to the English king, he did so accompanied by his retinue of armoured gallowglasses, who were bedecked with silken fringes on their helmets. When Thomas wavered in his course of action, an Irish bard recited to him a poem, calling upon the Silken Lord to avenge his father’s death."
}
wizard_earl = {
technology_cost = -0.05
"The 11th Earl of Kildare spent many years abroad, studying and learning much of the world. When he returned home, he brought with him a keen interest in alchemy. Such was his knowledge that his neighbours referred to him as the wizard earl, for he was thought to have magical powers."
}
the_curragh = {
cavalry_power = 0.1
"The wide open plains of the Curragh have long been used as a gathering place for armed forces, but also make it a popular site for horse racing, and later, horse training."
}
kid_architects_of_nation = {
build_cost = -0.1
"The ancestral seat of the FitzGeralds at Carton House is grand, but our fortunes have improved of late. We have drawn up plans for an even grander residence, that could serve not only as a family seat but also as the Earl's court."
}
kid_royal_irish_army = {
global_manpower_modifier = 0.1
"The forces sent by the King of England to subdue the Irish can easily be repurposed by the Peerage. By simply offering better pay the Earldom of Kildare could command a sizable force of English soldiers."


irish_ideas = {
start = {
land_morale = 0.1
trade_efficiency = 0.1
}

bonus = {
legitimacy = 1
republican_tradition = 0.5
}

irish_endurance = {
shock_damage_received = -0.1
"Decades of disease and famine have mostly pushed the English invaders from our lands. Meanwhile, the Irish people grow all the stronger from their harrowing experiences. Yes, there is no stronger man on God's green earth than an Irishman!"
}
the_clanns = {
same_culture_advisor_cost = -0.2
"The Clanns of Ireland make up a strong political body for land and family management. In smaller families, the family elected chieftain is in charge of maintaining the family and protecting their lands. Land and leadership is passed through the family electorate system of Tanistry. From the royal clanns the symbolic high king of Ireland is elected, creating a bond of union between the Irish families."
}
more_than_irish = {
global_unrest = -2
"Heartily did the Norman invaders embrace the Irish traditions; so much so that it was said they put on the airs of being 'More Than Irish'. The very nature of our culture is contagious, and for centuries yet will men embrace our way of life."
}
loyal_catholics = {
papal_influence = 1
global_heretic_missionary_strength = 0.02
"While the English may toil and spin in the winds of the Reformation, the Irish people as a whole are determined to remain under the wing of their lord The Pope."
}
ire_abundant_harvests = {
global_trade_goods_size_modifier = 0.10
"Now that the greedy, neglectful English landlords have been driven out of Ireland, our farmers are finally able to manage their produce in peace. Blights and crop failures are addressed as matters of critical state importance rather than as peripheral concerns of an irrelevant colony."
}
unconquerable_ireland = {
war_exhaustion = -0.02
"No English lord could contain the will of the Irish for long. Despite all efforts, rebellion after rebellion sprouted in an attempt to displace English rule. Insurgency after insurgency will spring up in their path, and Ireland shall never truly be theirs. And, as they sail from our lands, we shall further influence resistance against the protestant imperialists to on our eastern flank."
}
ire_gallowglasses = {
discipline = 0.05
"Formerly loose mercenary bands, the Gallowglasses are being consolidated into a national army. Their institutional experience is almost unrivalled, and their septs are the perfect foundations for regiments."


And that's our lot for today. Well, if I don't add an image then the front page won't be happy, so here we go:

meathinks the time for change is uppon England.jpg


Next week we'll show off the new unit models and music which will both be included as part of Rule Britannia. See you then!

Don't miss today's Rule Britannia Feature Stream with DDRJake on our twitch channel at 15:00 CET - the stream will as usual be available on Youtube if you can't make the livestream
 
Last edited by a moderator:

Chaingun

Field Marshal
47 Badges
Jul 15, 2002
3.797
2.509
  • Knights of Honor
  • 500k Club
  • Europa Universalis III: Collection
  • Europa Universalis IV: El Dorado
  • Magicka: Wizard Wars Founder Wizard
  • Mount & Blade: Warband
  • Mount & Blade: With Fire and Sword
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Rights of Man
  • Steel Division: Normandy 44
  • War of the Vikings
  • Europa Universalis IV: Third Rome
  • BATTLETECH
  • Surviving Mars
  • Age of Wonders III
  • Europa Universalis IV: Rule Britannia
  • Europa Universalis IV: Dharma
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome
  • Prison Architect
  • Imperator: Rome - Magna Graecia
  • Crusader Kings III
  • Europa Universalis III Complete
  • Europa Universalis III
  • Europa Universalis III: Chronicles
  • Europa Universalis III Complete
  • Divine Wind
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • Hearts of Iron III
  • Heir to the Throne
  • Crusader Kings II
  • Magicka
  • Europa Universalis III Complete
  • Europa Universalis IV: Res Publica
  • Victoria: Revolutions
  • Rome Gold
  • Supreme Ruler 2020
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Rome: Vae Victis
Have you ever considered letting a machine learning AI go to town on EU4? Probably not for the entire AI behavior right at the start, but for, say, land warfare? There have been some impressive showings of a machine learning AI in other games like Dota 2 (where an AI, trained against itself in thousands of games, was able to defeat the best players in the world in a 1on1 setting).

I feel like the interface to such an AI should already be almost there (as you are probably already feeding a lot of input into some magic routine(TM) that then creates a decision out of all the inputs). Putting a black box machine learning AI between inputs and outputs and letting it play around in a lot of AI-only games might significantly improve AI behavior, far better than any programmer could ever hard code.

For land warfare, that would mean continuously feeding it all the numbers about armies, provinces, tech as well as an overall goal (which would still come from the conventional AI, like e.g. "I want to reach 50% war score to take provinces X, Y and Z in a peace deal"). You then give the learning AI the options to move, merge, divide armies, request transport fleets, whatever I forgot. At first it will do ridiculously stupid things, but after a few thousand games (and millions of AI-AI wars) I would expect it to become much more clever at deciding were to move armies, where to siege with how many troops and so on. You could then even take it a step further, roll the AI out into the game and let players play against it while it's still learning. That would allow it to understand how to avoid player cheese strats and maybe even teach it some of them.

Still, in the meanwhile, I'm happy about any AI improvements. Shit's hard, we all understand that although we might still flame when encountering weird stuff. Keep going!

Let's wait until Google makes Starcraft 2 AI first.
 

BjornB

★Community Manager★
Administrator
Super Moderator
Moderator
82 Badges
Apr 2, 2012
4.891
16.316
  • Majesty 2 Collection
  • For the Motherland
  • Hearts of Iron III
  • Hearts of Iron III: Their Finest Hour
  • Heir to the Throne
  • Impire
  • King Arthur II
  • Knights of Pen and Paper +1 Edition
  • Lead and Gold
  • Leviathan: Warships
  • The Kings Crusade
  • Magicka
  • Majesty 2
  • For The Glory
  • March of the Eagles
  • Europa Universalis III Complete
  • Naval War: Arctic Circle
  • Europa Universalis IV: Res Publica
  • Victoria: Revolutions
  • Rome Gold
  • Semper Fi
  • Ship Simulator Extremes
  • Sword of the Stars
  • Sword of the Stars II
  • Starvoid
  • Crusader Kings II: Sword of Islam
  • Ancient Space
  • Arsenal of Democracy
  • Cities in Motion
  • Cities in Motion 2
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • A Game of Dwarves
  • Commander: Conquest of the Americas
  • Darkest Hour
  • Deus Vult
  • Dungeonland
  • Europa Universalis III
  • Europa Universalis III Complete
  • Divine Wind
  • Teleglitch: Die More Edition
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
Don't miss today's Rule Britannia Feature Stream with DDRJake on our twitch channel at 15:00 CET - the stream will as usual be available on Youtube if you can't make the livestream
 

Chaingun

Field Marshal
47 Badges
Jul 15, 2002
3.797
2.509
  • Knights of Honor
  • 500k Club
  • Europa Universalis III: Collection
  • Europa Universalis IV: El Dorado
  • Magicka: Wizard Wars Founder Wizard
  • Mount & Blade: Warband
  • Mount & Blade: With Fire and Sword
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Rights of Man
  • Steel Division: Normandy 44
  • War of the Vikings
  • Europa Universalis IV: Third Rome
  • BATTLETECH
  • Surviving Mars
  • Age of Wonders III
  • Europa Universalis IV: Rule Britannia
  • Europa Universalis IV: Dharma
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome
  • Prison Architect
  • Imperator: Rome - Magna Graecia
  • Crusader Kings III
  • Europa Universalis III Complete
  • Europa Universalis III
  • Europa Universalis III: Chronicles
  • Europa Universalis III Complete
  • Divine Wind
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • Hearts of Iron III
  • Heir to the Throne
  • Crusader Kings II
  • Magicka
  • Europa Universalis III Complete
  • Europa Universalis IV: Res Publica
  • Victoria: Revolutions
  • Rome Gold
  • Supreme Ruler 2020
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Rome: Vae Victis
@Chaingun what is in your opinion the biggest (fixable) problem you would like to solve with respect to the EU4 AI?

Unit AI is hardly perfect.

Diplomacy AI is neither (though that ties a lot into game design and requires changing both).

Would I like to solve them? Yes. Do I have time to? Let's say the prospects are better working on a clean code base with the experiences from EU4 fresh in mind.
 

Chaingun

Field Marshal
47 Badges
Jul 15, 2002
3.797
2.509
  • Knights of Honor
  • 500k Club
  • Europa Universalis III: Collection
  • Europa Universalis IV: El Dorado
  • Magicka: Wizard Wars Founder Wizard
  • Mount & Blade: Warband
  • Mount & Blade: With Fire and Sword
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Rights of Man
  • Steel Division: Normandy 44
  • War of the Vikings
  • Europa Universalis IV: Third Rome
  • BATTLETECH
  • Surviving Mars
  • Age of Wonders III
  • Europa Universalis IV: Rule Britannia
  • Europa Universalis IV: Dharma
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome
  • Prison Architect
  • Imperator: Rome - Magna Graecia
  • Crusader Kings III
  • Europa Universalis III Complete
  • Europa Universalis III
  • Europa Universalis III: Chronicles
  • Europa Universalis III Complete
  • Divine Wind
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • Hearts of Iron III
  • Heir to the Throne
  • Crusader Kings II
  • Magicka
  • Europa Universalis III Complete
  • Europa Universalis IV: Res Publica
  • Victoria: Revolutions
  • Rome Gold
  • Supreme Ruler 2020
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Rome: Vae Victis
Cheers! But isn't Starcraft way more complicated for a learning AI, as in hundreds of units can move and attack each other or buildings on a non-discrete (or at least highly granular) map? EU4 on the other hand seems to have a very limited number of armies and possible moves in comparison. I'm not saying AI development for EU4 is trivial compared to starcraft. I just think the challenges are in different areas, and EU4 seems more suited for quick results out of a learning AI.

However, I'm an AI fan but certainly no expert. I just guessed you looked at this stuff and was curious about your thoughts on it. Thanks for your reply!

To be fair, many countries have 100+ regiments that be arranged in any number of ways. Provinces are nodes but it's not much different from SC as you need to discretize the search space in the SC case, and EU4 map far from anything you can search exhaustively regardless. Starcraft does not have e.g. attrition.

Dont you think it would become imposible to play vs AI

Yes and no. It's possible that some external constraints could be put on it (like e.g. APM cap), or it's possible to define the reward function in away that maximizes "entertainment for human" rather than "winning the game".
 

Chaingun

Field Marshal
47 Badges
Jul 15, 2002
3.797
2.509
  • Knights of Honor
  • 500k Club
  • Europa Universalis III: Collection
  • Europa Universalis IV: El Dorado
  • Magicka: Wizard Wars Founder Wizard
  • Mount & Blade: Warband
  • Mount & Blade: With Fire and Sword
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Rights of Man
  • Steel Division: Normandy 44
  • War of the Vikings
  • Europa Universalis IV: Third Rome
  • BATTLETECH
  • Surviving Mars
  • Age of Wonders III
  • Europa Universalis IV: Rule Britannia
  • Europa Universalis IV: Dharma
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome
  • Prison Architect
  • Imperator: Rome - Magna Graecia
  • Crusader Kings III
  • Europa Universalis III Complete
  • Europa Universalis III
  • Europa Universalis III: Chronicles
  • Europa Universalis III Complete
  • Divine Wind
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • Hearts of Iron III
  • Heir to the Throne
  • Crusader Kings II
  • Magicka
  • Europa Universalis III Complete
  • Europa Universalis IV: Res Publica
  • Victoria: Revolutions
  • Rome Gold
  • Supreme Ruler 2020
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Rome: Vae Victis
Overall good news, although I was hoping for better AI sieging priorities.



So we can still expect to see Ming do this while colonizing Taiwan? That's about 70% of their army in Taiwan. It's nowhere near as bad as the French, but hopefully we can get a better fix in the future. Would it be possible to add a limit to how many troops the AI is willing to send to unfinished colonies?
View attachment 339604


If it works, that sounds like a good solution. That's assuming it doesn't lead to situations where the AI is building ridiculously large navies (as in many times larger than in 1.24).


@Chaingun could you please say something about how far 'far from the home coast' means? Can England for example be willing to take their fleet to Denmark? Can Spain be willing to blockade Constantinople or Trebizond?

Preventing the AI's heavy ships from following transports could improve the AI's combat ability at sea as well, since bringing transports in to combat with heavies is generally bad. I can however imagine it being a bit too easy to get rid of the AI transport fleet. I'm willing to give it a try before juding either way though.



I realize that 1.25 and this dev diary is focused on the naval AI, and that time is a limited resource, but is this getting any attention in 1.25? As 1.24 didn't address the actual attrition issue, where the AI gathers all their troops in one single stack, in my opinion the siege 'fix' made the AI much worse than pre 1.24. The AI is still very much willing to take attrition for armies not actually sieging. In 1.24 this leads to situations like this:
View attachment 339605

At the moment the AI seems to be putting too much weight on troop numbers before engaging in battles. The AI can have a huge morale and discipline advantage, but simply refuse to engage in combat against equally sized stacks, or stacks with 1-2 more regiments. It's certainly better than the previous situation where the AI kept sending in suicide squads, but it's far from ideal. Have you considered tweaking whatever was done in fixing the suicidal behaviour?

To answer your question on naval range; my guess is players are going to learn the (currently fixed) range fast. Yeah, England has sent their fleet to Denmark, but I don't think they go much further than northern Iberia. Ideally, home fleet range should be further tweaked based on to what extent the fleet is actually needed to defend the coast... Yeah, guess Ming will still send too much troops to Taiwan.

The reason why I mentioned the siege example is because we reverted the lower attrition change for 1.25. There's some round off error that I haven't localized which makes it use 1 regiment too little. Besides, there's the cannon issue...
 

Chaingun

Field Marshal
47 Badges
Jul 15, 2002
3.797
2.509
  • Knights of Honor
  • 500k Club
  • Europa Universalis III: Collection
  • Europa Universalis IV: El Dorado
  • Magicka: Wizard Wars Founder Wizard
  • Mount & Blade: Warband
  • Mount & Blade: With Fire and Sword
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Rights of Man
  • Steel Division: Normandy 44
  • War of the Vikings
  • Europa Universalis IV: Third Rome
  • BATTLETECH
  • Surviving Mars
  • Age of Wonders III
  • Europa Universalis IV: Rule Britannia
  • Europa Universalis IV: Dharma
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome
  • Prison Architect
  • Imperator: Rome - Magna Graecia
  • Crusader Kings III
  • Europa Universalis III Complete
  • Europa Universalis III
  • Europa Universalis III: Chronicles
  • Europa Universalis III Complete
  • Divine Wind
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • Hearts of Iron III
  • Heir to the Throne
  • Crusader Kings II
  • Magicka
  • Europa Universalis III Complete
  • Europa Universalis IV: Res Publica
  • Victoria: Revolutions
  • Rome Gold
  • Supreme Ruler 2020
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Rome: Vae Victis
What about making AI behaviour modable to the most extent possible and profit from modders work?
I mean for example the AI for Total War Games from modders is so much superior than everything created by devs. And it was like this for every Total War Title I played since Rome I.
(People for example might remember that bug where the AI would just stand in range of archers and towers and sieges and got shot to pieces that even still existed in Medieval TW; never ever had this problem again with AI mods.)

While basically I agree modders are great at making AI (having the necessary amount of time available), making moddable AI in a game that does not otherwise expose a detailed modding API used by open AI code isn't great for developer made AI, because AI-centric APIs weigh on the ability of devs to change the AI. Very commonly, the reason the AI sucks is that the fundamental code structure is flawed and could use a complete rewrite. Exposing a public AI API prevents that.

E.g. we do have parts of the AI moddable via modifiers. The problem is, quite often modifiers are quite insufficient for writing good AI. So when e.g. Gnivom dared to circumvent modifier based building AI there was a massive improvement. Although in that case, he could still do it in a way that let modifiers still impact it.
 

Chaingun

Field Marshal
47 Badges
Jul 15, 2002
3.797
2.509
  • Knights of Honor
  • 500k Club
  • Europa Universalis III: Collection
  • Europa Universalis IV: El Dorado
  • Magicka: Wizard Wars Founder Wizard
  • Mount & Blade: Warband
  • Mount & Blade: With Fire and Sword
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Rights of Man
  • Steel Division: Normandy 44
  • War of the Vikings
  • Europa Universalis IV: Third Rome
  • BATTLETECH
  • Surviving Mars
  • Age of Wonders III
  • Europa Universalis IV: Rule Britannia
  • Europa Universalis IV: Dharma
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome
  • Prison Architect
  • Imperator: Rome - Magna Graecia
  • Crusader Kings III
  • Europa Universalis III Complete
  • Europa Universalis III
  • Europa Universalis III: Chronicles
  • Europa Universalis III Complete
  • Divine Wind
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • Hearts of Iron III
  • Heir to the Throne
  • Crusader Kings II
  • Magicka
  • Europa Universalis III Complete
  • Europa Universalis IV: Res Publica
  • Victoria: Revolutions
  • Rome Gold
  • Supreme Ruler 2020
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Rome: Vae Victis
I don't really think that's a realistic problem. If he managed to create an AI smarter than a human at playing a grand strategy game like EU4 he would probably win a Nobel prize and be recruited as chief software engineer by Google.

Pretty much. Also, the time for research and testing stuff without results is pretty limited.
 

Chaingun

Field Marshal
47 Badges
Jul 15, 2002
3.797
2.509
  • Knights of Honor
  • 500k Club
  • Europa Universalis III: Collection
  • Europa Universalis IV: El Dorado
  • Magicka: Wizard Wars Founder Wizard
  • Mount & Blade: Warband
  • Mount & Blade: With Fire and Sword
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Rights of Man
  • Steel Division: Normandy 44
  • War of the Vikings
  • Europa Universalis IV: Third Rome
  • BATTLETECH
  • Surviving Mars
  • Age of Wonders III
  • Europa Universalis IV: Rule Britannia
  • Europa Universalis IV: Dharma
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome
  • Prison Architect
  • Imperator: Rome - Magna Graecia
  • Crusader Kings III
  • Europa Universalis III Complete
  • Europa Universalis III
  • Europa Universalis III: Chronicles
  • Europa Universalis III Complete
  • Divine Wind
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • Hearts of Iron III
  • Heir to the Throne
  • Crusader Kings II
  • Magicka
  • Europa Universalis III Complete
  • Europa Universalis IV: Res Publica
  • Victoria: Revolutions
  • Rome Gold
  • Supreme Ruler 2020
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Rome: Vae Victis
you are overestimating the problem, as many knobs as it may have, as far as i can see, the game is very simple, even more simple if you decide to destroy the player and make them ragequit. War is a graph problem, big graph, but graph problem, ai already shows its potential by dodging you to the day and knowing the shortest path everytime, its main problem is when it splits forces really. "oh but attrition and stack size this is so diffcult waaah", bullshit, the ai puts 200k on a single tile everytime it can already, splits, into 70k zones, realizes thats bad too, merges again into 200k, and so on, solving attrition is irrelevant atm. Stack size, mirror the player or fill CW, whatever is greatest. Goals: wargoal, forts, scaring/wiping player off siege if they have inferior forces, capital, player stack, pick goal that is the closest/even possible to be completed, key change: never overextend forces, when leaving fort for an opportunity goal, leave 1 to 10 stack to hold progress, fully abort if all troops needed/cant ensure safety, wait for NERF OTTOMANS, done.

trade can be mazimized already since it is not even a graph but a tree, buildings can be maximized, player rules for building buildings is baby level, so all you need to do is write that in code and cross fingers that you will also fix all other expenses so the money doesnt get mismanaged overall

army composition can be, if not maximized, balanced so it always is at least good enough (no russian 50k stack with 6 cannons)

alliances are already a pita for players so I dont see a need to modify that code

monarch point expenses seem fine unless some ais are lagging on military tech due to other expenses, no need to change otherwise

i cant/dont see estates or states so i dont care so long as they pick offensive options enough and without falling to disaster (mostly cossacks), basically using the same rules as a player already does and arent overcomplicated NP crap

ideas can be maximized to murder the player but the current "random" is fine

naval is a pita, the best i can think of is mirroring the player, and if inferior, avoiding them, which it already does, ai could always save their inferior navy by getting fleet basing on neutral ground just like it saves its army by getting exiled (and then it can save both when transporting and getting trapped). AI cheats on sailors yet sends troops to defend colonies, what, mark that land as impassable unless captured, and when captured mark it as low priority, to be recaptured by single stacks when nobody's around and only if it is causing exhaustion, and use the cheat that natives wont attack, or if you want to not cheat, just murder the natives. Thats what a player does, when in doubt, mirror the player.

You're forgetting the little detail of dealing with legacy code and not having infinite time. If I could rewrite the EU4 AI I could, not going to get time time allocated for that for good reasons.
 

Chaingun

Field Marshal
47 Badges
Jul 15, 2002
3.797
2.509
  • Knights of Honor
  • 500k Club
  • Europa Universalis III: Collection
  • Europa Universalis IV: El Dorado
  • Magicka: Wizard Wars Founder Wizard
  • Mount & Blade: Warband
  • Mount & Blade: With Fire and Sword
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Rights of Man
  • Steel Division: Normandy 44
  • War of the Vikings
  • Europa Universalis IV: Third Rome
  • BATTLETECH
  • Surviving Mars
  • Age of Wonders III
  • Europa Universalis IV: Rule Britannia
  • Europa Universalis IV: Dharma
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome
  • Prison Architect
  • Imperator: Rome - Magna Graecia
  • Crusader Kings III
  • Europa Universalis III Complete
  • Europa Universalis III
  • Europa Universalis III: Chronicles
  • Europa Universalis III Complete
  • Divine Wind
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • Hearts of Iron III
  • Heir to the Throne
  • Crusader Kings II
  • Magicka
  • Europa Universalis III Complete
  • Europa Universalis IV: Res Publica
  • Victoria: Revolutions
  • Rome Gold
  • Supreme Ruler 2020
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Rome: Vae Victis
I was mainly pointing that out due to your attrition remark. Attrition handling never working without merge split loops is a consequence of the code structure as it is. It for sure could be better when written from scratch, though even then I suspect the weighting issues of attrition versus force concentration would remain.
 

Chaingun

Field Marshal
47 Badges
Jul 15, 2002
3.797
2.509
  • Knights of Honor
  • 500k Club
  • Europa Universalis III: Collection
  • Europa Universalis IV: El Dorado
  • Magicka: Wizard Wars Founder Wizard
  • Mount & Blade: Warband
  • Mount & Blade: With Fire and Sword
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Rights of Man
  • Steel Division: Normandy 44
  • War of the Vikings
  • Europa Universalis IV: Third Rome
  • BATTLETECH
  • Surviving Mars
  • Age of Wonders III
  • Europa Universalis IV: Rule Britannia
  • Europa Universalis IV: Dharma
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome
  • Prison Architect
  • Imperator: Rome - Magna Graecia
  • Crusader Kings III
  • Europa Universalis III Complete
  • Europa Universalis III
  • Europa Universalis III: Chronicles
  • Europa Universalis III Complete
  • Divine Wind
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • Hearts of Iron III
  • Heir to the Throne
  • Crusader Kings II
  • Magicka
  • Europa Universalis III Complete
  • Europa Universalis IV: Res Publica
  • Victoria: Revolutions
  • Rome Gold
  • Supreme Ruler 2020
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Rome: Vae Victis
Because I get some questions on PM like this and I don't want to reply several times:


Hi Petter,

I just read the last Dev Diary... (the question has nothing to do with that). And seeing you talking about AI behavior made a interesting question pop into my head.

I recently started studding machine learning and self learning ai. Nothing professional... just as a hobby. And I realized that a game like paradox would be perfect to implement such systems to develop the AI for the game, isn't?

So my question is... is this viable, if not why, and if it is... why not do it?

I think you guys could have a huge set of data if you collect what the players are doing. So basically you would take the data on how the players are playing the game and input that into a machine learning algorithm. Or create several self learning ai playing against each other with the goal of getting the highest score or something. Or a combination of both.

Wouldn't this work?

Thanks... I appreciate you taking your time to read this...

Hello,

typically, what we learn in deep learning courses is still supervised learning. It works for some sub-problems but is not sufficient for e.g. unit movement. If we always do what looks like the highest value action, the agent will not explore the world. Aside from this problem, we also have the temporal credit assignment problem which can be really complicated for gameplay.

Now some deep reinforcement learning algorithms do actually have an approach to solve these things... but they are currently unfeasible when they make necessary to input the full game state space. IIRC AlphaGo is relying on providing the explicit state representation of Go (which is very simple compared to PC strategy games).

Yet other approaches teach the agents to play with available screen information only, nonetheless building an in-memory representation of the game from that is very computationally intensive for a large game.

Now, there is hope of course, e.g. look at progress made by a German company (can't remember the name) to play Freeciv. In that case, they're deriving high level rules and operating on the existing game structure in code, AFAIK rather than attempting end to end (black box) modelling.

Yes, these games are probably interesting from a research point, the trouble is they keep changing under strict time pressure and it's not ideal to do research at Paradox for this and other reasons.
 
Last edited:

Chaingun

Field Marshal
47 Badges
Jul 15, 2002
3.797
2.509
  • Knights of Honor
  • 500k Club
  • Europa Universalis III: Collection
  • Europa Universalis IV: El Dorado
  • Magicka: Wizard Wars Founder Wizard
  • Mount & Blade: Warband
  • Mount & Blade: With Fire and Sword
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Rights of Man
  • Steel Division: Normandy 44
  • War of the Vikings
  • Europa Universalis IV: Third Rome
  • BATTLETECH
  • Surviving Mars
  • Age of Wonders III
  • Europa Universalis IV: Rule Britannia
  • Europa Universalis IV: Dharma
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome
  • Prison Architect
  • Imperator: Rome - Magna Graecia
  • Crusader Kings III
  • Europa Universalis III Complete
  • Europa Universalis III
  • Europa Universalis III: Chronicles
  • Europa Universalis III Complete
  • Divine Wind
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • Hearts of Iron III
  • Heir to the Throne
  • Crusader Kings II
  • Magicka
  • Europa Universalis III Complete
  • Europa Universalis IV: Res Publica
  • Victoria: Revolutions
  • Rome Gold
  • Supreme Ruler 2020
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Rome: Vae Victis
That civilization AI which learns from the game manual was from research at MIT:

https://www.extremetech.com/extreme...ivilization-by-reading-the-instruction-manual

Nah, it's this one I was thinking of (Freeciv, not Civ): https://forum.paradoxplaza.com/forum/index.php?threads/to-the-ai-programmers.1069863/ unless I'm somehow confusing them

Interesting results from MIT nonetheless (I would have thought it impossible to transfer knowledge from manual into gameplay TBH before that)
 
Last edited:

Chaingun

Field Marshal
47 Badges
Jul 15, 2002
3.797
2.509
  • Knights of Honor
  • 500k Club
  • Europa Universalis III: Collection
  • Europa Universalis IV: El Dorado
  • Magicka: Wizard Wars Founder Wizard
  • Mount & Blade: Warband
  • Mount & Blade: With Fire and Sword
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Rights of Man
  • Steel Division: Normandy 44
  • War of the Vikings
  • Europa Universalis IV: Third Rome
  • BATTLETECH
  • Surviving Mars
  • Age of Wonders III
  • Europa Universalis IV: Rule Britannia
  • Europa Universalis IV: Dharma
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome
  • Prison Architect
  • Imperator: Rome - Magna Graecia
  • Crusader Kings III
  • Europa Universalis III Complete
  • Europa Universalis III
  • Europa Universalis III: Chronicles
  • Europa Universalis III Complete
  • Divine Wind
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • Hearts of Iron III
  • Heir to the Throne
  • Crusader Kings II
  • Magicka
  • Europa Universalis III Complete
  • Europa Universalis IV: Res Publica
  • Victoria: Revolutions
  • Rome Gold
  • Supreme Ruler 2020
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Rome: Vae Victis
^ The AI has a couple of hundred "priority systems" roughly speaking, many overlapping and with conflicting priorities. For example, unit AI has prioritization for army province value (several subsystems; best province to avoid attrition in, battle to join, province to siege, siege to support), navy province value, navy to transport, army to invade with, unit to attach to, unit to merge with, province to land in, army region assignment, focal point assignment, threat avoidance, etc.

Lazy is being a matter of definition. I admit that when you're not working 168 hours per week, you could be working more!