Another close look at how the AI builds up its worlds: 1.6 edition

  • 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.

GamerSteve

First Lieutenant
51 Badges
Dec 16, 2016
273
151
  • 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: Sword of Islam
  • Crusader Kings II
  • Stellaris: Synthetic Dawn
  • Stellaris - Path to Destruction bundle
  • Europa Universalis IV: Mare Nostrum
  • Cities: Skylines - Green Cities
  • Cities: Skylines - Natural Disasters
  • Surviving Mars
  • Europa Universalis IV: Third Rome
  • Europa Universalis IV: Mandate of Heaven
  • Cities: Skylines - Mass Transit
  • Crusader Kings II: Monks and Mystics
  • Europa Universalis IV: Golden Century
  • Crusader Kings II: Jade Dragon
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Europa Universalis IV: Rule Britannia
  • Cities: Skylines - Parklife Pre-Order
  • Cities: Skylines - Parklife
  • Stellaris: Distant Stars
  • Europa Universalis IV: Dharma
  • Stellaris: Megacorp
  • Crusader Kings II: Holy Fury
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Res Publica
  • Cities: Skylines
  • Europa Universalis IV: El Dorado
  • Crusader Kings II: Way of Life
  • Pillars of Eternity
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Horse Lords
  • Cities: Skylines - After Dark
  • Crusader Kings II: Conclave
  • Cities: Skylines - Snowfall
  • Hearts of Iron IV: Cadet
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Rights of Man
  • Stellaris: Leviathans Story Pack
  • Europa Universalis IV: Cradle of Civilization
  • Europa Universalis IV: Cossacks
  • Stellaris
This is why I always get driven away from Stellaris. I come back every few months to check but I always quit over the frustration of having to micro 5, 10, 15, 20, etc. worlds because there's no way I'm letting the past or current AI build my worlds. Once I get past about planet 5 in a game I'm done enjoying the micro. I want to move on to managing things on a more galactic level for conquest o liberation or whatever I'm up do. Instead I'm stuck constantly going from top to bottom on the outliner checking each planet to see what it needs built next.

But your top worlds, i.e. the first colonized, after a while should be built out, no? After that, there is effectively no micro, other than maybe when you get the next level of a building like Physics Lab, you have to eventually remember to go back and hit the yellow arrow symbol to upgrade them. And if you wait a little while to do that well, it may not be min-maxish but it is not going to be the end of your empire.
 

Weedes

First Lieutenant
30 Badges
Feb 11, 2017
253
7
  • Stellaris: Synthetic Dawn
  • 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
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Pre-order
  • Crusader Kings III: Royal Edition
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Crusader Kings III
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Necroids
  • Stellaris: Nemesis
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II
  • Europa Universalis IV: Rights of Man
  • Stellaris
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Common Sense
  • Mount & Blade: Warband
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV
@Weedes; Your Code will probably help. There's a mod somewhere on Da Staem that implements some changes to that building file, and initial reports I've seen is that it does improve the AI's ability to construct the correct buildings. There's also the Shanty Town mod which helps by auto-placing 'shanty' versions of buildings which the AI will upgrade instead of redeveloping, usually.

The thing that may cause problems is that there's nothing in the buildings file which deals with priorities, indicating that some AI Logic is either in another file, or hard-coded into the Engine, probably the latter. That's something you might not be able to fix.

Now that I have some code to look at, the quick check to slightly increase weighting of an existing building should look like the following, replacing the has_building entry with the name of the building in question;

Code:
modifier = {
    factor = 1.1
    has_building = building_mining_network_1
}

You could probably just implement this for the first tier, since you've also got a scaling weight for later Tiers. The risk might be that your scaling weight might prevent the AI from ever re-developing, even when it should, and when it wants to. But in my personal experience I don't think I've ever actually changed a building once it was there except for gradually replacing existing buildings with newly-unlocked Empire-Wide Modifier Buildings and The Power Hub.

Speaking of the Power-Hub, it should probably have a blanket increase for any tile with power, combined with a factor = 0 modifier if the planet already has one, which should be the following code;

Code:
modifier = { factor = 2 has_resource = { type = energy amount > 0 } }
modifier = {
    factor = 0
    OR = {
        planet = { has_building = "power_hub_1" }
        planet = { has_building = "power_hub_2" }
    }
}

There are almost assuredly ways that you could make the AI smarter just by modifying this file.

Those are definitely useful additional modifiers that could certainly cut into this issue.

The power hubs are planet unique though so that should force them not to build it more than once.

And for them never redeveloping that would be a 'dumb' decision, which I think is fine, as it is an improvement on the 'irrational' decisions being made previously, as in redeveloping the same tile several times in a row with a different building each time or even the previous building on the tile before the last redevelopment ad nauseum.

Also with the increased factors if the building's resource type is present on the tile it could definitely help them build a bit more evenly based on how the planet is laid out, more like a player would.

Ultimately they will still need the default/vanilla 50/100% material bonuses from difficulty settings to fill in the gaps in their decision making process with tiles and buildings on planets but they shouldn't be so reckless with minerals and might actually keep a decent stock to rebuild a fleet in an emergency.

Alternatively we could just give them a whopping reduction to their build costs and build times, it would be the CPU friendly approach, but also lazy.

I personally use a mod that allows base tile resources to still be used no matter the building on it. I found this helps the AI manage itself quite a bit and also incentivizes me to use buildings I would never use in a million years because a mine or a plant would just be a better use of the tile.

It also makes sense that a tile would have more than one building, an area would have more than one use. I think a 'building' on a tile is more representative of several buildings, whole districts and cities dedicated to the production of a certain thing... but not necessarily at the expense of other things which are strategic to that area.
 
Last edited:

GamerSteve

First Lieutenant
51 Badges
Dec 16, 2016
273
151
  • 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: Sword of Islam
  • Crusader Kings II
  • Stellaris: Synthetic Dawn
  • Stellaris - Path to Destruction bundle
  • Europa Universalis IV: Mare Nostrum
  • Cities: Skylines - Green Cities
  • Cities: Skylines - Natural Disasters
  • Surviving Mars
  • Europa Universalis IV: Third Rome
  • Europa Universalis IV: Mandate of Heaven
  • Cities: Skylines - Mass Transit
  • Crusader Kings II: Monks and Mystics
  • Europa Universalis IV: Golden Century
  • Crusader Kings II: Jade Dragon
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Europa Universalis IV: Rule Britannia
  • Cities: Skylines - Parklife Pre-Order
  • Cities: Skylines - Parklife
  • Stellaris: Distant Stars
  • Europa Universalis IV: Dharma
  • Stellaris: Megacorp
  • Crusader Kings II: Holy Fury
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Res Publica
  • Cities: Skylines
  • Europa Universalis IV: El Dorado
  • Crusader Kings II: Way of Life
  • Pillars of Eternity
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Horse Lords
  • Cities: Skylines - After Dark
  • Crusader Kings II: Conclave
  • Cities: Skylines - Snowfall
  • Hearts of Iron IV: Cadet
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Rights of Man
  • Stellaris: Leviathans Story Pack
  • Europa Universalis IV: Cradle of Civilization
  • Europa Universalis IV: Cossacks
  • Stellaris
If you set your sector to force respect of tile resources and ban it from redevelopment you should be okay; at that point there's little that the AI can do to mess things up.

Sure it can.

The AI seems to have a hard time figuring out when to clear blockers -- clearing them when there are tons of blank tiles to build on, NOT clearing them when there is almost no room left.

The AI built a regular energy building on top of a Betharian resource instead of the Betharian one. And yes, I had the tech at the time.

The AI consistently built orbital hydroponic farms to add food when every single sector was at +50, +65, +80 food, and the empire as a whole was at over +200. I remember I bumped the max food from 200 to 1000 late in the game (never needed to before that) and like I blinked and I was at 1000 because I had so much +food. And eventually I capped to whatever the 3rd max is, what is it 5K, 10K? Anyway, I capped it, I was at +a couple hundred, and the sectors were still building orbital farms on my space bases. This, when I have the AI set to energy focus because the one thing I need in my empire at this point is not food, not minerals, but energy. So it is spending energy to farm food from space, when I have tons of food but an energy shortage.

Yes, the AI can stiill do things to mess you up.
 

Vishaing

MM Prime Minister in Exile
12 Badges
Jan 25, 2008
1.420
723
  • Crusader Kings II
  • Europa Universalis III
  • Europa Universalis IV
  • Heir to the Throne
  • Europa Universalis III Complete
  • March of the Eagles
  • Europa Universalis III Complete
  • Victoria 2: A House Divided
  • Victoria 2
  • 500k Club
  • Crusader Kings II: Holy Knight (pre-order)
  • Europa Universalis IV: Pre-order
You're probably right that the Power Hub check isn't needed. I had gotten it into my head that without this check the AI might, because we would always want the Power Hub to evaluate higher than a normal Power Plant because its always good to have, that the AI might build a Power Hub, evaluate a second tile, then start building a new Power Hub which would auto-demolish the old one. But that's not how Planet Unique Buildings work in Stellaris so we probably don't need to worry.

And yo dude what kinda mod makes Tile Resources always apply because I wanna get me some of those. I hate building on two-resource tiles, to the point that I literally made my own building, a "Great City" which produced 1 of each and applied Adjacency Bonuses. Is that what the mod does, just make it so every building produces at least 1 of each resource?

Also thinking about that mod, we can definitely get the AI to place buildings where we want with the ai_* entries in the buildings.txt file, because when I first made that building the AI NEVER Built it, but then I added an AI weight of 9000 so the AI would always build it on a multi-resource tile and the AI did start building them. That was the only change I made to the AI.
 

Weedes

First Lieutenant
30 Badges
Feb 11, 2017
253
7
  • Stellaris: Synthetic Dawn
  • 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
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Pre-order
  • Crusader Kings III: Royal Edition
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Crusader Kings III
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Necroids
  • Stellaris: Nemesis
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II
  • Europa Universalis IV: Rights of Man
  • Stellaris
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Common Sense
  • Mount & Blade: Warband
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV
And yo dude what kinda mod makes Tile Resources always apply because I wanna get me some of those. I hate building on two-resource tiles, to the point that I literally made my own building, a "Great City" which produced 1 of each and applied Adjacency Bonuses. Is that what the mod does, just make it so every building produces at least 1 of each resource
I forget the name of the mod on Steam, I just stole the idea and put into my own personal Stellaris overhaul that is not on Steam at all. It just lets you keep the resource bonus on the tile, so when the tile was generated it has 1 energy and 1 mineral you still get those even if you build say, a lab on it.

It is a very small change in the strategic_resources file:

Code:
energy = {
   accumulative = yes
   collect_if_wrong_building = yes                           #was no, this was changed to yes mostly to help the AI, but also to allow more buildings you normally never use because of not wanting to waste tile enhancements
   accumulated_by_sectors = yes
   tradable = yes
   AI_category = energy
   max = 5000
   base_income = 0
   capital_building_resource = yes # When placing colony, AI should want to place on this resource
}
"collect_if_wrong_building = yes" is what you want to look at in that file and just repeat the small change for each resource with that an entry for that which reads 'no' at the end.

I do this weird thing where I just edit the files in the base game and back them up to a secondary folder (right alongside a backup of the default game) so I do not have to deal with Steam mod shenanigans.

When a patch lands I just look at which files have different dates than my backups and merge them with the aid of a compare tool.

Alternatively you could sift through Steam mods for it. I did just now and could not relocate it, I searched for anything with 'tile' in the name or description but did not locate it. Only a similar one that is very out-dated.

I recall the name seeming to not have anything to do with what it did. Which I hate it when modders do that.

Also thinking about that mod, we can definitely get the AI to place buildings where we want with the ai_* entries in the buildings.txt file, because when I first made that building the AI NEVER Built it, but then I added an AI weight of 9000 so the AI would always build it on a multi-resource tile and the AI did start building them. That was the only change I made to the AI.
Well that is good to know. I am anxious to try this out after I finish making my mod collection compatible with 1.6, although this will quickly turn to annoyance when I come face to face with the wall of buildings these will needed to be put on it haha.
 

Weedes

First Lieutenant
30 Badges
Feb 11, 2017
253
7
  • Stellaris: Synthetic Dawn
  • 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
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Pre-order
  • Crusader Kings III: Royal Edition
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Crusader Kings III
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Necroids
  • Stellaris: Nemesis
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II
  • Europa Universalis IV: Rights of Man
  • Stellaris
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Common Sense
  • Mount & Blade: Warband
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV
Just realized we could also just put this on buildings:

Code:
ai_replace = no

It is what PDS puts on capitol buildings so the AI does not redevelop them.

:rolleyes:

But our modifiers on each tier might let them redevelop, maybe, if they want it enough via other modifiers from defines/deeper in the engine. So perhaps making the factors not jump so much, like instead of 1 to 2 to 3 and such each tier, it might just be 1 to 1.1 to 1.2 and so on and so forth.

A nudge instead of a strong push off a cliff.

At that point it will come down to if the AI goes with something that is higher every time or if it just makes it more likely to choose that thing but not a guarantee. If it is the former it would not matter if it was 0.1 higher or 1.0 higher, it would be the same result unfortunately.
 
Last edited:

Vishaing

MM Prime Minister in Exile
12 Badges
Jan 25, 2008
1.420
723
  • Crusader Kings II
  • Europa Universalis III
  • Europa Universalis IV
  • Heir to the Throne
  • Europa Universalis III Complete
  • March of the Eagles
  • Europa Universalis III Complete
  • Victoria 2: A House Divided
  • Victoria 2
  • 500k Club
  • Crusader Kings II: Holy Knight (pre-order)
  • Europa Universalis IV: Pre-order
"collect_if_wrong_building = yes" Man I don't think I even looked to see if there were files for the resources. I assumed they were Hard Coded. That's Beautiful.

Oh, for Mods, what I do is I have a personal mod that just uses the old Folder Structure like from EU3. I don't have the file structure right now, but when I get home soon I'll look for it, because with this you can have a local folder full of files that shows up in the Mod Window of the Launcher so you don't have to replace files. You can also more easily 'break' your mod into smaller more focused parts. I would still recommend comparing the contents of the files (I use Beyond Compare 3) when updating to a new version, you can also just force it to load a mod even when its marked incompatible and just whatever happens happens man.

This is also useful if you want to make a personal Mod-Mod. Like I used to use ISB but I modded the techs to basically stop the tree at Titans and not get any of the crazy shit.
 

Weedes

First Lieutenant
30 Badges
Feb 11, 2017
253
7
  • Stellaris: Synthetic Dawn
  • 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
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Pre-order
  • Crusader Kings III: Royal Edition
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Crusader Kings III
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Necroids
  • Stellaris: Nemesis
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II
  • Europa Universalis IV: Rights of Man
  • Stellaris
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Common Sense
  • Mount & Blade: Warband
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV
"collect_if_wrong_building = yes" Man I don't think I even looked to see if there were files for the resources. I assumed they were Hard Coded. That's Beautiful.

Oh, for Mods, what I do is I have a personal mod that just uses the old Folder Structure like from EU3. I don't have the file structure right now, but when I get home soon I'll look for it, because with this you can have a local folder full of files that shows up in the Mod Window of the Launcher so you don't have to replace files. You can also more easily 'break' your mod into smaller more focused parts. I would still recommend comparing the contents of the files (I use Beyond Compare 3) when updating to a new version, you can also just force it to load a mod even when its marked incompatible and just whatever happens happens man.

This is also useful if you want to make a personal Mod-Mod. Like I used to use ISB but I modded the techs to basically stop the tree at Titans and not get any of the crazy shit.
Yea my file system needs an update. It is just the way I have always done it since before Steam even existed and while aware of better emerging systems I was always 'too busy' to fix it.

I am using 'Compare It!' right now for merging, it's "meh".
 

PirateJack

Lt. General
69 Badges
Jun 1, 2009
1.388
630
  • Crusader Kings II
  • Cities: Skylines - After Dark
  • Victoria 2: A House Divided
  • Semper Fi
  • Europa Universalis IV: Res Publica
  • Magicka
  • Hearts of Iron III: Their Finest Hour
  • Hearts of Iron III
  • For the Motherland
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Art of War
  • Europa Universalis III: Chronicles
  • Crusader Kings II: Charlemagne
  • Arsenal of Democracy
  • 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
  • Crusader Kings II: Sword of Islam
  • Europa Universalis IV: Rights of Man
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Cities: Skylines - Natural Disasters
  • Hearts of Iron IV: Together for Victory
  • Hearts of Iron IV: Expansion Pass
  • Crusader Kings II: Monks and Mystics
  • Surviving Mars: First Colony Edition
  • Cities: Skylines - Mass Transit
  • Europa Universalis IV: Mandate of Heaven
  • Surviving Mars
  • Hearts of Iron IV: Death or Dishonor
  • Cities: Skylines - Green Cities
  • Stellaris: Humanoids Species Pack
  • Crusader Kings II: Reapers Due
  • Hearts of Iron IV: Cadet
  • Stellaris: Apocalypse
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Dharma
  • Cities: Skylines - Parklife
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: El Dorado
  • Stellaris: Distant Stars
  • Prison Architect
  • 500k Club
  • Warlock 2: The Exiled
  • Stellaris: Nemesis
  • Victoria 2
Looking at the video, I think the problem is that the AI always has to be doing something. In the mid-game it's limited by resources. In the late game by upgrades. In the early game, however, it's limited by POPs. So when the AI looks at what resources it has available and discovers it has nothing of a higher priority to do, it looks to its planets and determines which resource it could do with more of. In most cases this is energy, because the AI keeps fairly close to the fleet cap when it can, so it opts to build power plants to make sure it doesn't drop into negative income.

In cases like this, I'd try to have some sort of limiter in place so that the AI is willing to sit on the resources it has for a while if nothing of priority higher than value X is available to be built.
 

Vishaing

MM Prime Minister in Exile
12 Badges
Jan 25, 2008
1.420
723
  • Crusader Kings II
  • Europa Universalis III
  • Europa Universalis IV
  • Heir to the Throne
  • Europa Universalis III Complete
  • March of the Eagles
  • Europa Universalis III Complete
  • Victoria 2: A House Divided
  • Victoria 2
  • 500k Club
  • Crusader Kings II: Holy Knight (pre-order)
  • Europa Universalis IV: Pre-order
V's Quick Guide to Personal Mods;

Step 1: Find this Folder;

C:\Users\<USERNAME>\Documents\Paradox Interactive\Stellaris\mod\

Step 2: Create a Folder within it with your Mod name. Mine is just;

C:\Users\<USERNAME>\Documents\Paradox Interactive\Stellaris\mod\_V\

Step 3: Place any modified Files in this Folder. Reproduce the Main Stellaris File/Folder Structure exactly. So if you modify buildings the buildings.txt file should be here;

C:\Users\<USERNAME>\Documents\Paradox Interactive\Stellaris\mod\_V\common\buildings\

Step 4: Create .mod file in the mod folder, like so;

C:\Users\<USERNAME>\Documents\Paradox Interactive\Stellaris\mod\_V.mod

The Code of the .mod file should look kinda like this;

Code:
name="_V"
archive="mod/_V"
tags={
"Balance"
"Personal"
"Stuff"
"Tags can be Anything"
"Like...."
"The Entire Bee Movie Script"
"I'm not lying there's a mod on the Steam Network that does the above."
}
picture="thumb.jpg"
supported_version="1.6.*"

And It's Over!
 

Weedes

First Lieutenant
30 Badges
Feb 11, 2017
253
7
  • Stellaris: Synthetic Dawn
  • 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
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Pre-order
  • Crusader Kings III: Royal Edition
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Crusader Kings III
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Necroids
  • Stellaris: Nemesis
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II
  • Europa Universalis IV: Rights of Man
  • Stellaris
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Common Sense
  • Mount & Blade: Warband
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV
Right, I am aware of most of that, thanks for the detail, though, it just shows how lazy/ADHD I am, really.

That said, you were right, there was a mod created today on Steam that does a lot of what we talked about.

http://steamcommunity.com/sharedfiles/filedetails/?id=922445647&searchtext=AI+fix

It heavily leans on ai_allow to force the AI to respect tile resources and makes it never redevelop buildings with ai_replace = no.

So this should pretty much fix the original issue of this thread, the AI should build dumb but not irrationally with that mod. It should actually build a bit smarter than default, though, probably prioritize food and energy less as it goes with more what the planet tiles has going than what it thinks it needs but really does not.

I will likely build my own personal version with a number of tweaks.
 
Last edited:

GC13

The Last Emperor of Sol
90 Badges
Dec 30, 2010
3.181
3.060
  • Cities: Skylines - After Dark
  • Cities: Skylines - Green Cities
  • Cities: Skylines - Parklife
  • Cities: Skylines - Mass Transit
  • Cities: Skylines - Natural Disasters
  • Cities: Skylines Industries
  • Cities: Skylines - Snowfall
  • Cities: Skylines - Campus
  • Cities: Skylines Deluxe Edition
  • Cities: Skylines
  • Victoria 2
  • Europa Universalis IV
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Sengoku
  • Crusader Kings II: Sunset Invasion
  • Stellaris
  • Stellaris: Synthetic Dawn
  • Stellaris - Path to Destruction bundle
  • Stellaris: Apocalypse
  • Stellaris: Megacorp
  • Stellaris: Federations
  • Shadowrun Returns
  • Shadowrun: Dragonfall
  • Shadowrun: Hong Kong
  • Tyranny: Gold Edition
  • Tyranny - Bastards Wound
  • Pillars of Eternity
Looking at the video, I think the problem is that the AI always has to be doing something. In the mid-game it's limited by resources. In the late game by upgrades. In the early game, however, it's limited by POPs. So when the AI looks at what resources it has available and discovers it has nothing of a higher priority to do, it looks to its planets and determines which resource it could do with more of. In most cases this is energy, because the AI keeps fairly close to the fleet cap when it can, so it opts to build power plants to make sure it doesn't drop into negative income.

In cases like this, I'd try to have some sort of limiter in place so that the AI is willing to sit on the resources it has for a while if nothing of priority higher than value X is available to be built.
That wouldn't make sense even if that was the reason: there is zero reason for the AI to redevelop a tile when there is a functionally identical tile that hasn't been built yet. If the AI was desperate to use that stuff on something (and at 2215 it's unlikely to be glutted with minerals in the first place) it would use the other tile.

Then there's the weird stuff, like why it will build a mine on a blank tile and ignore the tile that gives minerals...
 

Ilushia

Captain
May 10, 2017
411
0
That wouldn't make sense even if that was the reason: there is zero reason for the AI to redevelop a tile when there is a functionally identical tile that hasn't been built yet. If the AI was desperate to use that stuff on something (and at 2215 it's unlikely to be glutted with minerals in the first place) it would use the other tile.

Then there's the weird stuff, like why it will build a mine on a blank tile and ignore the tile that gives minerals...

It's also odd because Sector AIs generally -don't- follow this trend. They're sub-optimal, but as long as you leave Respect Tile Yields on, they seem to do okay at building up colonies. Which makes me wonder why the empire AI doesn't just run with respect tile yields on all the time. It's like the devs really wanted the AI to have the ability to build all-food or all-energy or all-mining worlds the optimal way, but didn't have the ability to actually make the AI do that, so just made the AI not care about what it was building on without making it smart enough to actually specialize worlds.

The 'endlessly redevelop buildings' thing is also bizarre. This seems like it should be an easy fix by just weighting actions such that the AI won't redevelop a tile unless there's no other place to put a building it likes that doesn't suppress a resource. That shouldn't be a hard check to make, I'd think, and makes sense as a logic check since the times when redevelopment is better than expansion are pretty much only in that circumstance.
 

UberWaffe

Second Lieutenant
24 Badges
May 23, 2016
185
73
  • Magicka
  • Cities: Skylines Deluxe Edition
  • Cities in Motion 2
  • Stellaris: Synthetic Dawn
  • Stellaris: Federations
  • Age of Wonders: Planetfall - Revelations
  • Age of Wonders: Planetfall
  • Stellaris: Ancient Relics
  • Surviving Mars: First Colony Edition
  • Prison Architect
  • Surviving Mars: First Colony Edition
  • Stellaris: Distant Stars
  • Stellaris: Apocalypse
  • Hearts of Iron IV: Expansion Pass
  • Surviving Mars
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Cadet
  • Stellaris
  • Pillars of Eternity
  • Cities: Skylines
  • Teleglitch: Die More Edition
  • Crusader Kings II
  • Stellaris - Path to Destruction bundle
  • Stellaris: Megacorp
The added tile scope should not be needed in the buildings file as that is the default scope there.
Ah, good to know. Thanks.

...
"collect_if_wrong_building = yes" is what you want to look at in that file and just repeat the small change for each resource with that an entry for that which reads 'no' at the end.
...
Personally I don't think the 'match the shapes' mechanic adds fun or desired gameplay, and does add annoyance and AI complexity.
I say kill it with fire.
 

Ilushia

Captain
May 10, 2017
411
0
So I found something interesting digging around in the Defines file. There's this line in there:
  • NON_MINED_RESOURCES_ENERGY_WANT_FACTOR = 1 # If 100% of AI's resources in space are unmined increase desire for energy by this

It makes me wonder if your observation of the AI vastly over-producing energy resources in the early game is related to this or not.
 

Keltosh

Second Lieutenant
47 Badges
Jul 9, 2013
118
0
  • 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
  • Crusader Kings II: Sword of Islam
  • Pillars of Eternity
  • Crusader Kings II
  • Sword of the Stars
  • Stellaris - Path to Destruction bundle
  • Stellaris: Distant Stars
  • Stellaris: Apocalypse
  • Europa Universalis IV: Cradle of Civilization
  • Age of Wonders III
  • Europa Universalis IV: Third Rome
  • Europa Universalis IV: Mandate of Heaven
  • Shadowrun: Hong Kong
  • Crusader Kings II: Monks and Mystics
  • Europa Universalis IV: Dharma
  • Shadowrun Returns
  • Shadowrun: Dragonfall
  • Stellaris: Galaxy Edition
  • Stellaris: Megacorp
  • Crusader Kings II: Holy Fury
  • Europa Universalis IV: Golden Century
  • Stellaris: Ancient Relics
  • Stellaris: Federations
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Charlemagne
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV: Pre-order
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: Common Sense
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Conclave
  • Europa Universalis IV: Mare Nostrum
  • Stellaris
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Rights of Man
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Rule Britannia
  • Stellaris: Synthetic Dawn
GC13, I suppose you saw the opt-in beta patch changelog?
* Fixed AI nonsensically replacing buildings in a wasteful way, disregarding tile resources

I think I'm not the only one who would be interested in another lovely video like this, analyzing the AI behavior in building planets in 1.6.1 beta :)

In fact, maybe your video is how they noticed the problem! :p :p
 

GC13

The Last Emperor of Sol
90 Badges
Dec 30, 2010
3.181
3.060
  • Cities: Skylines - After Dark
  • Cities: Skylines - Green Cities
  • Cities: Skylines - Parklife
  • Cities: Skylines - Mass Transit
  • Cities: Skylines - Natural Disasters
  • Cities: Skylines Industries
  • Cities: Skylines - Snowfall
  • Cities: Skylines - Campus
  • Cities: Skylines Deluxe Edition
  • Cities: Skylines
  • Victoria 2
  • Europa Universalis IV
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Sengoku
  • Crusader Kings II: Sunset Invasion
  • Stellaris
  • Stellaris: Synthetic Dawn
  • Stellaris - Path to Destruction bundle
  • Stellaris: Apocalypse
  • Stellaris: Megacorp
  • Stellaris: Federations
  • Shadowrun Returns
  • Shadowrun: Dragonfall
  • Shadowrun: Hong Kong
  • Tyranny: Gold Edition
  • Tyranny - Bastards Wound
  • Pillars of Eternity
GC13, I suppose you saw the opt-in beta patch changelog?
* Fixed AI nonsensically replacing buildings in a wasteful way, disregarding tile resources

I think I'm not the only one who would be interested in another lovely video like this, analyzing the AI behavior in building planets in 1.6.1 beta :)

In fact, maybe your video is how they noticed the problem! :p :p
I saw that in the patch notes, and I am very happy that they want to improve the AI. Unfortunately, the test game I hopped into still has the AI making silly decisions about tearing down buildings. This time it perceived itself to be in a food crisis, despite having positive food income, and was doing a lot of redecorating to put new farms in. (Though it had still knocked down a power plant to put up a monument, which it tore down to put a farm on.)