• 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 #24 - AI

Hello everyone and welcome to yet another development diary for Stellaris! Today, I'll be talking about AI, and not of the robotic kind. I'm talking of course, of the game AI, which is currently being developed by myself and @merni who is the dedicated Stellaris AI programmer, while I'm just temporarily on the project to flesh out certain aspects of the AI before launch.

Artificial Personalities
A major challenge when making the Stellaris AI has been the randomized nature of the game. With thousands of different combinations of ethoses and traits, there's a risk that every AI Empire ends up feeling the same to the player, or fall into a very basic categorization of 'aggressive aliens' and 'peaceful aliens'. I as the AI programmer might know that an AI with Fanatic Collectivism makes their decisions differently from with plain old vanilla Collectivism, but it might all look the same to a player who doesn't have this foreknowledge.

In order to address this problem, we've implemented a system of AI Personalities that govern almost every aspect of how they behave, such as who they'll pick a fight with, which trade deals they are interested in and how they budget and utilize the resources available to them. This personality is determined by their ethos, government form and traits, and will be shown to the player when diplomatically interacting with that Empire. To feel recognizeable to the player, all of the personalities are rooted in sci-fi tropes, so that you'll immediately know who the Klingons are to your United Federation of Planets.
6ZK8UQS.png


Personalities naturally have a bigger impact on diplomacy than anything else - if your goal is to form a Federation, it'll be much easier to do so with an Empire of Federation Builders than a bunch of Ruthless Capitalists, and forget getting Xenophobic Isolationists to agree to any such proposal unless they have a very pressing reason. You can tell how an Empire feels about you from their Attitude, which is primarily driven by opinion, and affects factors such as what diplomatic offers they'll consider and how fair a shake they will give you in trade deals.
h76nTL1.png


In addition to the regular personalities, there is also a special set of personalities for Fallen Empires. Instead of the usual mix of Ethoses, each Fallen Empire has only a single Fanatic Ethos - the single remaining ideal they hold to after centuries of seeing what the galaxy has to offer. This Ethos determines their personality, which in turn affects how they view your actions. For example, a Xenophobic Fallen Empire will want nothing to do with you or anyone else and will be very upset if you start encroaching on their borders, while a Spiritualist Fallen Empire will consider themselves the protectors of the galaxy's holy sites, and will not look kindly on your colonists trampling all over their sacred planets. If you think angering a Fallen Empire is harmless because they won't conquer you - think again. Fallen Empires get a special wargoal to force you to abandon planets, and will be more than happy to cut your upstart species down to size if you don't show sufficient respect for your elders.
KViqQD9.png


Threats and Rivals
So what then, is a pressing reason for an AI to go against their personality? Well, one such reason is Threat. Threat is a mechanic somewhat similar to Aggressive Expansion in Europa Universalis 4. Conquering planets, subjugating other Empires and destroying space installations will generate Threat towards other Empires. The amount of Threat generated depends both on how far away the Empire is from what's happening and on their Personality. Xenophobic Isolationists won't care if you're purging aliens half a galaxy away, but if all the planets around them being swallowed up by an expanionistic Empire, they'll definitely take note. Empires that are threatened by the same aggressor will get an opinion boost towards each other, and will be more likely to join in Alliances and Federations - if you go on a rampage, you may find the rest of the Galaxy uniting to take you down, and while Threat decays naturally over time, there's no guarantee that the alliances formed by your imperialism will break up even if you take a timeout from conquering... so expand with care.

Another feature borrowed from EU4 to drive AI behaviour is Rivals. Any independent Empire that are you not allied to can be declared a Rival, up to a maximum of 3 Rivals at the same time. Having an Empire as a Rival will give you a monthly increase of Influence, with the amount gained based on how powerful they are relative to yourself - having a far weaker Empire as your antagonist will not overly impress your population. It is further modified by Ethos, with Militarist Empires benefitting significantly more from Rivalries than Pacifist ones (but paying more influence to be part of an Alliance). Naturally, Empires won't be particularly happy about being declared a Rival, and are pretty likely to rival you right back. Having a Rival will improve relations with their enemies and worsen relations with their friends, so the Rivalry system will act as a primary driver of conflict and alliance in the galaxy.
pEIgTBV.png


AI Economics
Finally, I wanted to cover the topic of the AI's bookkeeping. While it may be far less exciting and far less visible to the player than its diplomatic behaviour, having solid economics is one of our biggest priorities for the Stellaris AI, for multiple reasons. Firstly, so that the AI is able to compete reasonably with the player without resorting to outright cheating. True, the AI will never be as good as an experienced player, but there is a big difference between the player being able to outproduce one AI Empire and the player being able to outproduce five of them together. Secondly, because of the Sector mechanic that was covered in DD 21, the AI will actively be making construction and management decisions on the player's planets, and while - again - it will never be as good as an experienced player making the decisions themselves, it needs to be good enough that the player doesn't feel like the AI is actively sabotaging their Empire.

In order to accomplish all this, a huge amount of time has been put into the AI's budgeting system. Every single mineral and energy credit that the AI takes in is earmarked for a particular budget post such as navies or new colonies, with the division between the posts being set according to the AI's personality and what it needs at the time. The AI is only permitted to spend appropriately budgeted resources, so it'll never fail to establish new colonies because it's too busy constructing buildings on its planet, or miss building a navy because mining stations are eating up its entire mineral income. In times of dire need, it can move resources from one budget post to another - if it's at war and its navy gets destroyed, expect it to pour every last mineral into building a new one.

When making decisions about what to construct, the AI looks primarily at what resources it has a critical need for (such as Energy if it's running a deficit), secondarily at what resources it's not producing a lot of compared to what it expects an Empire of its size to produce, and lastly at whatever it deems useful enough for the mineral investment. Sectors have additional logic to ensure they produce more of the resource you've set them to focus on, so an Energy sector will naturally overproduce Energy - you told it to, after all.
12eo2mu.png


Alright, that's all for today. Next week we'll be talking about debris and the fine art of reverse engineering.
 
Last edited by a moderator:
  • 156
  • 128
Reactions:
What do the building-with-flag and lightning-bolt symbols on the diplomatic interface mean?

Edit: Also, how late does Wiz answer questions? It's got to be getting on in Sweden.
 
  • 3
Reactions:
Was it intentional to mention Klingons and the Federation then show a screenshot of the Romulans? :cool:

What is that final section at the bottom-left of the interface, directly under the AI's mood, with the two buildings and the lightning bolts? Apparently sometimes everything can be gray, just the buildings, or just the lightning bolts.
 
I've read that the AI governors don't have a personality (cf the empire-level AI personalities).
It might be a nice idea (for a dlc/expansion) to actually give them personalities, but who's traits are partially hidden to the player.
Imagine picking a sector-governor who is a resource-extraction magnate (visible trait) but also a backstabbing rogue (invisible trait). So while it's expanding the resource-economy (yay!) it's also plotting to take away the sector from you through diplomatic or military means (like getting other empires to support it's independence).
Would open up a significant amount of internal diplomacy for the player.
 
  • 1
Reactions:
Currently, only Xenophile/Xenophobe Materialist/Spiritualist are valid FE traits. More may be added.

The FE personalties are:
Xenophile: Benevolent Observers
Xenophobe: Militant Isolationists
Spiritualist: Holy Guardians
Materialist: Keepers of Knowledge

Is it likely (in your opinion) that there will exist more than one personality for each ethic, either on release or as part of a patch? It would be a shame if fallen empires all felt the same (though probably less than the regular AI - you aren't meant to meet as many fallen empires right?)
 
It is with great hope that I anticipate this being my new favorite PDS game ... until V3 is (hopefully) released.
 
  • 1
Reactions:
The cap is -1000/+1000, so effectively uncapped. The Confederacy of Penkor *really* doesn't like me.

They are probably disgruntled EU4 players.
 
  • 4
Reactions:
You don't think there's an ever so slight chance they might get a feeling of betrayal instead, at least in some circumstances? I know if my best mate slept with my spouse, I'd be pretty angry at him, even though I've been great friends with him for over 30 years. In fact, I'd be more angry with him than some random.

Seriously, if you had a 1000 opinion of your friend, you probably like him better than your wife and would happily tell him to have at it.
 
  • 6
Reactions:
Why did you hardcode the AI behaviour?
Or how difficult would it be to make it modable (e.g. lua?)
I bet we would have hundreds of AI personalities around after some weeks
 
Oh i so want this game, i get more and more excited with each dev diary, and this one was especially cool to read.
 
  • 5
Reactions:
This actually puts to rest a lot of my concerns for the game, so thanks Wiz :)

I'd like to ask: if I decline a trade deal the AI offers (e.g. swap charts) will they hate me for it? And if so, will they be repeatedly asking, or will the AI get the signal that I'm really not interested in their offers. Can we set attitudes towards the AI or even set how likely we are to accept any deals they offer, besides rivalries?

As much as I like Civ 5 (as well as paradox games of course), that's one thing that irritates me about it - the AI asking you repeatedly for, e.g., open borders turn after turn and not getting the hint....

Comet sighted.
Nothing happens.

"Comet Sighted! In ongoing AI experiments, our scientists have bestowed sight and maneuvering thrusters on a passing comet, allowing it to avoid obstacles (like planets) in its way."

"Comet Cited! The controversial Dr Comet, well known for his highly unorthodox research in xenobiology, has been cited by government officials explaining the new "no-contact" regulations regarding interactions with alien species."

"Comet Sited! Space engineers have harnessed a mineral-rich comet into orbit around our colony on Bogus IV, providing it with ready access to many rare minerals."

There's a personality type called 'Fanatic Purifiers', whose primary goal is to purge the galaxy of all aliens. They're not the most diplomatic people around.

I call these personalities "other players".
 
  • 10
  • 2
Reactions:
Will we be able to see AI personalities/ethoses/government type upon first contact, or does it take some investigation?

I seem to recall hearing that there are small research projects triggered upon first contact in order to allow for translation -- if so, it seems to me that those research projects unlocking knowledge of the AI's personality etc. would also make sense.
 
There's a personality type called 'Fanatic Purifiers', whose primary goal is to purge the galaxy of all aliens. They're not the most diplomatic people around.
Well, that's settles it whom I am going to role-play in my first playthrough as.
Death to xeno scum!
 
I've read that the AI governors don't have a personality (cf the empire-level AI personalities).
It might be a nice idea (for a dlc/expansion) to actually give them personalities, but who's traits are partially hidden to the player.
Imagine picking a sector-governor who is a resource-extraction magnate (visible trait) but also a backstabbing rogue (invisible trait). So while it's expanding the resource-economy (yay!) it's also plotting to take away the sector from you through diplomatic or military means (like getting other empires to support it's independence).
Would open up a significant amount of internal diplomacy for the player.

That might be a good way to put pressure on big empires and give the game more character, but that sounds like it could be pretty frustrating for the player if you didn't have a robust system of dealing with such inefficiency. People were already complaining about the sector governors building suboptimally; I can only imagine the outcry if you had some crooked subordinate kleptocrat was pocketing half of a sector's income while building space granaries on all your research worlds. As if millions of micromanagers suddenly cried out in terror and were suddenly silenced...
 
  • 1
Reactions:
Why is it even possible to get 1000+ opinion? xD
 
  • 1
Reactions:
Hey Wiz, is this a question you can answer?: How many Fallen Empires can you expect to see in your standard 700-star galaxy?
 
There's a personality type called 'Fanatic Purifiers', whose primary goal is to purge the galaxy of all aliens. They're not the most diplomatic people around.
This will be perfect for my glorious Terran Empire. I will "purify" the galaxy of all of those annoying aliens.
 
Last edited:
  • 1
Reactions: