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

Stellaris Dev Diary #252 - Artificial and Automated Intelligence


ai_5.png


Hello everyone, it is me Offe, one of the Humans working on Stellaris. Today I will bring you an update from the Custodian AI initiative. Before we dive into today’s dev diary let’s do a quick recap of the AI work that went into the 3.3 patch.


If you have been following the AI dev diaries you probably know that our main objectives for the 3.3 Libra patch was to improve the economy management of the AI, especially with a mid and late game perspective in mInd. The reason for this was to establish the AI empires as relevant actors beyond the early game and give their interactions with the player more impact.

Following some of the discussions here on our own forums and also on Reddit, my favorite topic has been seeing people react to AI empires suddenly being much stronger in the Galactic Community where they are passing resolutions against the players' will.

While the AI economy management still has areas which can be improved, we felt satisfied with the changes made in 3.3 to the point where we wanted to move our focus to other areas of the AI.


Goals for 3.4

As the AI economy improved other areas of the AI started to become more obvious targets for improvement, namely the AI military fleet management and their diplomacy interactions with the player.

Military AI behavior changes

First I would like to say that the changes coming to military fleet behavior in 3.4 are mostly bug fixes rAther than improvements on their decision making, so while there should be a very noticeable difference, the work made so far on the fleet behavior will not be as encompassing as the work made for the economy.

Let’s start with the Elephant in the room: AI splitting their fleets into tiny pieces.

split_fleets.png



While there were issues where AI would split their fleets too much, fundamentally this behavior of AI splitting fleets was by design. The AI would allocate just enough fleet power (with a +25% margin) to their objective in order to carry out as many objectives as possible. The main issue came from the amount of low fleet power targets such as unupgraded starbases which caused the AI to frequently split their fleets into 1000~ fleet power pieces.

In theory this approach is quite good, however, the main two main issues with this approach are that the player can easily just take one of their bigger fleets to go around and defeat the AI’s smaller fleets one by one which makes the AI somewhat incompetent, as well as that this playstyle from the AI can be quite frustrating to play against.

In 3.4 the AI will aim to have full fleets as their smallest unit to carry out military objectives, AI will actively try and merge all possible fleets during peacetime and the AI will during a war try and merge two nearby fleets when possible.

Cycling Fleet Orders

After having made the AI fill up their fleets, the next issue to tackle was AI fleet order cycling where the fleets get stuck alternating between two orders indefinitely. One coMmon cause for this was when the AI assigned several fleets to carry out an objective together, the fleets would try and regroup with each other by moving to the system of the other fleets causing them to switch places over and over.

GIF 19-02-2020 15-58-03.gif


Take Point

In 3.3 we made the AI obey the Take Point behavior again, but it didn’t work quite as well as we wanted. For example allied AI fleets would sometimes follow the players fleets when they shouldn’t. There were also issues where the AI would suddenly change their mind and stop following the player, and they would also not always follow the player with all their fleets.

AI Allied Wars

During a war with several involved AI Empires on the same side, one of the AIs will be considered leading the war (may be different from diplomatic war leader) and the other AIs will put their fleets to follow the “AI warleader”. This suffered from a similar issue as previously mentioned where the AI fleets which were supposed to follow would change their mind too often and never reach their intended target.

AI Outside Diplomatic War

In 3.4 we are adding an AI war state which becomes activated when the AI fights a mid or late game crisis, this state of war will continue until the crisis has been defeated. This means that AI will now enable their normal war beHavior against targets like the Great Khan even though they do not have a diplomatic war if they or any of their allies get attacked.

This has many side effects, for example:
- AI empires should now obey the players Take Point if the player is fighting a crisis
- Allied AI empires should now help each other fight crises when one of them are attacked
- AI empires will now seek out and destroy systems controlled by crisis empires et cetera.

We also addressed the issue where an AI empire would fight a neutral target such as a leviathan during an ongoing war.

AI War Preparation

In 3.4 we are adding a state of war preparation for the AI which they will enter when they would have immediately declared war in 3.3. During this phase the AI will gather their available fleets and move them towards the border of their target.

If you have enough military intel you will be notified via an alert that hell is about to break loose and depending on how much intel you have you will get a more accurate estimation on when the AI will strike.

alert.png



AI Diplomacy

Now that we have covered military changes coming in 3.4 lets go over the diplomacy changes

Federation AI changes

One of the biggest complaints regarding being in a Federation with the AI has been the unrelenting bombardment of proposals of changing the same federation law over and over again. Often resUlting in AI empires stacking the negative opinion modifier on themselves and eventually leaving the federation altogether.

In 3.4 we are introducing a 10 year AI vote cooldown for each law category. So let’s randomly select a federation law to use as an example: Free Migration. When an AI proposes to change the law of Free Migration then it will add a 10 year AI only cooldown which is shared between all AI federation members. This means that each time Free Migration gets voted down it will now take at least 10 years before it is proposed again.

Coincidentally this also fixes an exploit that the player could use against AI federations where the player would repeatedly ask to initiate a vote to invite the player into the AI federation. This allowed the player to repeatedly stack the negative opinion modifiers between the AI federation members causing their federation to break apart.

Envoys

Another common complaint regarding AI federations is how the AI would often not put any envoys into the federation. This was a symptom of a bigger problem which was the overall AI envoy usage.

The AI empires would frequently reassign their envoys to the same task, knocking out the envoy who was already assigned to it and starting the reassign cooldown. As a result the AI would often have all but one of their envoys on cooldown and not assigned to any task.

In 3.4 the AIs should be able to handle their envoys in a much more appropriate manner, both in terms of Federation and Galactic Community assignment as well as other diplomatic actions and espionage operations.

Galactic Community Changes

While AI voting for seemingly completely irrelevant resolutions in the Galactic Community gave it a sense of uncomfortable realism there were a few issues that stood out to us:

AI would sometimes propose resolutions that were completely against their core beliefs, for example, a slaver empire would sometimes propose to ban organic slave trading. This was due to a missing willingness check when AI would propose resolutions, so they AI would propose the resolution they liked the most but wouldn’t check if they liked it enough to be worth proposing in the first place.

The AI was explicitly forbidden to withdraw their proposed resolution, while most of the time this does not make sense, there are situations where this may be the best course of action. For example, the AI may propose to reduce the council size but by the time the resolution is about to enter the floor their diplomatic weight has been reduced to the point where they would propose themselves out of the council.

Similarly the AI was also forbidden from opposing their own resolution, but the above situation could happen in a similar way where, for example, the player would enact the Emergency Measure to move the resolution to the floor before the AI has time to withdraw their resolution. In that situation it would make sense for the AI to oppose their own proposed resolution.

Additionally if you have enough intel on the AI you will now be able to see why they are voting the way they do in the Galactic Community. While this tooltip was already quite big, I knew I could make it even bigger.


ai_vote.png


Planet and Sector Automation

While planet and sector automation isn’t necessarily AI, we have seen a lot of requests for previous AI iMprovements to also be available for the player. And even though the planet/sector automation uses a different system than the AI’s economy system we still felt that improving this would hopefully add a lot of quality of life value to our players.

The design philosophy for the new automation system is that “most players will be able to use some parts of it”. So the intention is not that all players will always use this and that it will be able to satisfy all players, rather that hopefully everyone will find something that they feel is worth using.


automation.png


So how does it work? In 3.4 the planet automation will have an additional settings UI where players can toggle components on/off for each planet individually as well as setting default values for newly colonized planets.

The most impactful setting is this one, the Designation

designation.png


This will cause the planet to build new jobs in accordance with the designation when there are no free jobs available. This setting is now much more restrictive in regards to what is considered to be in accordance with the designation, for example, enabling this for a mining designation will only construct the mining districts and the mineral purification plant and nothing else.

The other settings are:
  • Amenities: Build new amenities buildings and also micromanage the priority of amenity producing jobs to minimize unnecessary amenity jobs by using the same system as the AI has been using since 3.3.
  • Rare resources: Build new rare resource producing buildings to target a +3 monthly income of all rare resources. Additionally this will now take into consideration empire wide buildings in the building queue and only build one building at a time.
  • Pop assembly: Build spawning pools, cloning vats, robot assembly et cetera.
  • Housing: Construct additional housing, either districts or building when needed.
  • Building slots: Automatically build a new housing district for the +1 building slot whenever there are no free building slots, especially useful to enable on automated planets like Science designation since they require many building slots.
  • Crime: Build new crime prevention buildings when crime reaches dangerous levels.
  • Clear blockers: Automatically clear blockers when it is preventing construction of new districts.
  • Posthumous Employment: Builds the Posthumous Employment Center on planets with raw resource focus.
  • Psi Corps: Build the Psi Corps building on all planets when possible.
The Designation automation setting is extra careful to not overbuild buildings whereas the other settings will build buildings even when there is no need for additional jobs.

All the automations except the Amenity automation (uses AI behavior in code) are fully scriptable for anyone interested in making their own automation mod, the files are found in:
Code:
game\common\colony_automation
game\common\colony_automation_exceptions

Sector Automation

Sector automation is now a system built on top of the planet automation. Setting the sector focus will now change which designAtions planets will select when they are using the “automatic designation selection” in order to make them respect the sector automation.


sector.png

Additionally there is now a Unity focus available for sector automation since Unity is now more important after the 3.3 patch, together with new Unity automation for planets to go along with it.


sector_setting.png



The requirement to have an upgraded capital building in order to construct Research labs and rare resource producing buildings has now been removed in order to make the planet automatioNs function properly for newly founded colonies with these designations.

We have also added several missing designations to different planet types in order to allow for more automation, for example, Ring World can now use factory/forge world designation and Hive Worlds can now use the fortress designation.

And that’s it for today’s dev diary. As always if you have any questions feel free to post them below and I will do my best to answer them all.

Lastly, I am sad to say that my designated time on the Custodian team has already been over for a while now, which means that this will be the last AI dev diary from me. But the AI initiative lives on and next time there is an AI update you may get the chance to meet a new Human. Again I want to say a special thank you to all the community members who have engaged in meaningful discussions regarding the AI improvements in the past months and tirelessly reporting the AI issues on the bug forum.

Thank you!

PS. Do not try to find me, I am safe, do not go here ptfwm://bdkqnf.hn/3XohUOb

Subterranean​

Hi! Eladrin tagging back in for a bit.

1650893978744.png

This week Nivarias revealed the Subterranean origin. Tunneling underground is a bit more expensive than building on the surface, but has its advantages, especially when a hostile force attempts to bombard your cities.

1651130977986.png

Lithoids are unaffected by the growth speed penalty.

The primary species of a Subterranean empire gains the Cave Dweller trait, granting additional mineral production at the cost of pop growth and empire size from pops, as well as a new Minimum Habitability trait. Cave-Dwelling pops are well sheltered from the environment on the surface, and treat any habitable planets below 50% habitability as if they were 50%.

1650893995630.png

I am a dwarf and I’m digging a hole.

Living underground, Subterranean empires have a unique city set that replaces the normal view on planets.

1650894002640.png

Are you the king of the mountain?

One of the achievements revealed last week, named Underlord, has to do with answering the question “Is it possible to dig too deep?”

Next Week​

Well look at the time, we’re coming right up to the release of Overlord, aren’t we?

The Stellaris 3.4 “Cepheus” patch notes will be coming next week, alongside details of the Progenitor Hive origin. After the patch notes, join us on the Official Stellaris Discord for a Dev Q&A, starting Thursday at 1700 CEST!

See you there!
 
  • 121Like
  • 71Love
  • 5
  • 3
  • 1Haha
Reactions:
So still no auto-building of mining and science stations?
This should be a setting on individual construction ships tbh. Devs mentioned adding automatic construction of mining and science stations to construction ships a long time ago, I really don't get why this wasn't implemented yet.
 
  • 4Like
  • 3
Reactions:
No idea how you are managing to put so much into this update, but please keep it coming! The new planet automation and the AI actually gearing up for war before it declares are a gifts from the Worm. I'm looking forward to not needing to go through all my planets every couple of years to build stuff. Quick question: If I tic the designation automation box for a agricultural planet, will it only automatically build farming districts and a food processing building, or will it also automatically build hydroponics buildings once it runs out of districts?
 
  • 2Like
Reactions:
This is a very very welcome change. A few random questions on AI logic and priorities:
  • How do other AIs respond to this notification of mobilisation, if at all?
    • For example AI1 moves their fleets to Ovastivum, as in your screenshot.
    • What happens if the blue empire ("AI2") is not a player? Does it decide to mobilise its forces to Krant? (or more generally the nearest star to the mobilising fleets?)
    • IF AIs do act on neighbours' mobilisation events, what happens when There are 2 neighbours mobilising against a 3rd empire.
      • Lets say on opposite sides of their nation (think WW2 Germany - poland - russia, as a crude analogy)
      • Will the Middle AI, "Space poland", if they respond to these mobilisation events, split its forces in 2 (or even or weighted) to face both mobilising enemies?
      • Or will it attempt to fight one AI or the other, win and move from there (this i suppose feeds in to a broader question about AI mission priority in wars in stellaris).
  • What will AIs do to mobilise vs an enemy, if there is no clear path to the enemy? (e.g. some 3rd party is blocking the way with its borders)
    • Will they proactively stack up on gateways/q-catapults/hyper-relays, or jump drive, and try to "get close as possible"?
  • Will AIs (if 1 is mobilising against, say, a common ground start federation) split their forces to mobilise against "all war participants"? or will they focus on the nearest? Or weight higher the "enemy war leader"?
Bonus question, more content than AI focussed (though it touches on spoofing AIs decisionmaking in Singleplayer):
  • Will there be potential in the future for an espionage operation/situation to "fake a war mobilisation"/"false flag operation" and maybe trigger a war between two powers? (e.g. assuming they already have poor relations).


But wouldnt this still be possible, to a lesser degree, in sufficiently large federations, like some galactic unions? If I approach member I ~ N and ask to join in sequence (being rejected each time), with enough candidate states I should still stack some large net modifiers.


I've not looked at GC resolutions much, are the Support/Abstain/Opposition thresholds scriptable? Or are they dynamic (e.g. set by/scaling with country ethics somehow)



This is real nice. The only thing that jumps out at me is that there is no list of what each designation will/could actually build if you turn it on? Like A dynamic Localisation string under "Control-click" above saying "Current designation [Mining] can build [whatever districts and buildings]" would be a very helpful way to centrally show what this can do - alternatively sticking such a string in the designation tooltip itself could work?.



So still no auto-building of mining and science stations, auto-colonisation or auto-terraforming options [budget permitting]? (a la "old" sector functionality)?
:(

If you ask one of the AI federation members to initiate a vote for you to join, it will cause the 10 year cooldown for all AI federation memebers such that no one will propose it again during this period even if you ask a different federation member.

The numbers needed for Support/Abstain/Oppose are moddable defines such as "RESOLUTION_VOTE_PROPOSE_THRESHOLD = 8.0", both these thresholds as well as the AI logic for how much they would like to vote on resolutions are fully scriptable/moddable

Being able to see what a designation automation would build would be nice. In general it is now extremely restrictive and much more predictable.
 
  • 15
Reactions:
If you ask one of the AI federation members to initiate a vote for you to join, it will cause the 10 year cooldown for all AI federation memebers such that no one will propose it again during this period even if you ask a different federation member.
Isn't this too much? I feel like the join request cooldown should be an exception, maybe 4 years instead of 10.
 
  • 2
Reactions:
Right now it is only for attacking AI, it would be natural to extend this support such that defending AI would be able to react to this if they have enough intel in the future
i can see the attacking AI empires being way more successfull in 3.4 then :D ... well, how they use the fleet changed too, so we will see i guess.
 
  • 1
Reactions:
No idea how you are managing to put so much into this update, but please keep it coming! The new planet automation and the AI actually gearing up for war before it declares are a gifts from the Worm. I'm looking forward to not needing to go through all my planets every couple of years to build stuff. Quick question: If I tic the designation automation box for a agricultural planet, will it only automatically build farming districts and a food processing building, or will it also automatically build hydroponics buildings once it runs out of districts?


Code:
automate_farming_planet = {
    category = "planet_automation_designation_construction"
    
    available = {
        OR = {
            has_designation = col_farming
            has_designation = col_ring_farming
        }
    }

    prio_districts = {
        district_farming
        district_rw_farming
        district_farming_uncapped
    }

    buildings = {
        1 = {
            building = building_capital
        }

        2 = {
            building = building_food_processing_facility
        }

        3 = {
            building = building_hydroponics_farm
        }
    }
}

The designation automation scripts follow this pattern. It will try to build any combination of available farming districts and then build the buildings in the priority order. So it will build the food processing facility first if you have researched it and then continue with hydroponics. The automation will try to build something like 2:1 districts and buildings as well so you should see a mix of farming districts and hydroponics farms.

If you enable the "building slot" automation and the farming designation automation on a planet without any available farming districts then it would build 1:1 city districts followed by hydroponics farms.
 
  • 9
  • 6Like
Reactions:
The designation automation scripts follow this pattern. It will try to build any combination of available farming districts and then build the buildings in the priority order. So it will build the food processing facility first if you have researched it and then continue with hydroponics. The automation will try to build something like 2:1 districts and buildings as well so you should see a mix of farming districts and hydroponics farms.
Shouldn't it not build hydroponic farms at all if there are agricultural districts available?
 
  • 2Like
Reactions:
Is the planet automation system aware of things such as Mining Districts unlocking building slots and providing extra housing for Subterranean empires?
 
  • 5Like
Reactions:
Wow excellent news, great job. Can't wait to try this out.

As someone already said it would also be great to be able to customize sectors instead of the 4-jumps rule. Can you comment if this is something that's being discussed?
 
  • 3Like
Reactions:
i wonder if custodian initiative will fix the rebellion of some of your subsidiary planet, since your subsidiary empire were unable to declare war against the rebel empire of the same main species with different ethics (weird how machine uprising is different from typical same main species rebellion on single planet) because they were my vassal and i hate the cheese like map on the galaxy and you can't really transfer system with colonized planet as well.

also is it possible for normal planet (not ring world, habitat and ecumenopolies) to have administrative, research and trade district since its tad annoying to build tons of administrative office, research lab and commercial zones building, i'd really appreciate it if these three district will receive same treatment like industrial district and the three building i mention receive same treatment like civilian industry and alloy foundries.


also its really rare to have betharian and isolated valley that it really make me feel speechless since even in one of my game where i own 60 colony i only have around 2 planet with these building just show you how rare it's.
 
  • 2
Reactions:
Shouldn't it not build hydroponic farms at all if there are agricultural districts available?

Maybe. Like written in the dev diary it will be impossible to make an automation system that everyone will think is 10/10 perfect.

If you enable designation automation but disable building slot automation it will continue to build farming districts and as long as there are no free building slots then it won't build any hydroponics.
 
  • 18Like
  • 6
  • 1
Reactions:
Is the planet automation system aware of things such as Mining Districts unlocking building slots and providing extra housing for Subterranean empires?

Both yes and no, depends on what you mean.

The building slot automation will make sure that there is always 1 free building slot on the planet. If you enable this on a planet with the mining designation then it will make fewer city districts as a result since sometimes it will get a building slot for free.

The same is true for the housing automation which will only build extra housing districts when needed, so if the mining automation always have a healthy surplus of housing from the mining districts then it will never have the need to make extra housing
 
  • 19
  • 2
  • 1Like
Reactions:
On the topic of the origin. Will it be able to go together with the Aquatic trait? Underwater caves do exist so will it be a possibility? And if so, will the city look different by having a blue filter over it? And how will it affect the look of Ecumenopolis worlds?
What I'm more entertained by is an arid world subterranean empire will have 50% habitability on an Ocean world.

*stamping around at the bottom of the Mariana Trench* Well it's not ideal
 
  • 4Haha
  • 1Like
Reactions:
Yes please fix fleet splitting, whenever I loose control of my fed for a few years to my lessers....valued Federation allies and then get it back I have to deal with like 650 fleet capacity that is now all broken into 1-3 ships :D Takes so long THEN I have to go manually delete all those 'new fleets' with 0 ships in them in the fleet manager. I like micro but that is actually the bad kind :D
 
Last edited:
  • 4Haha
Reactions:
@Offe So the length of time of AI preparation of war is usually just how long it takes for the AI fleets to move from their docked station (usually their capital) to the system adjacent to the war preparation target? So therefore for a set distance, and increasing tech of ship thrusters, the time taken for war preparation will decrease as tech increases? (assuming no border changes which is obviously a large assumption)

Additionally, does the war prep system mess with the frequency of wars declared by AI? I.e, is it likely that by the time the AI has spent X amount of time "preparing" and moving their fleets, is the AI fickle enough to call off the war and change their mind? Does the immediate "fire when ready" of AI war declarations of 3.3 increase the wars occurring on average?

Btw thanks for the great DD
 
  • 1
Reactions:
What I'm more entertained by is an arid world subterranean empire will have 50% habitability on an Ocean world.

*stamping around at the bottom of the Mariana Trench* Well it's not ideal
The better question is how a non aquatic ocean world species managed to get out of the cave without flooding it in the process.
 
  • 2Like
Reactions: