• 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:
I'm guessing it won't just be ethics that determines AI personality -- the government type might also come into play. A materialist 2, xenophile 1, corporate state is going to see the world very differently than an indirect democracy with the same set of ethics. (Although it might go the other way, with personality chosen first for the AI and an appropriate government type dropped in after.)

There could also be other aspects that come into play, various advantages or physical quirks or whatever that we haven't yet seen in detail.

As well as technologies they unlock or discover.
 
There are not that many, if there were they would become indistinct to player.

You say that like it would be a bad thing! :) Is there something wrong with having the player aware of the general tenor of an AI entity, but not being aware of some subtle difference that they can't see, but that might influence its actions? That actually sounds like a good thing to me.
 
You say that like it would be a bad thing! :) Is there something wrong with having the player aware of the general tenor of an AI entity, but not being aware of some subtle difference that they can't see, but that might influence its actions? That actually sounds like a good thing to me.

I would think that even if the different combinations of choices were grouped into a smaller number of AI behavior patterns, each choice would still be valid, because each choice gives different bonuses.
 
Well I must admit some part of me is sad knowing that not all ethos combinations are valid choices for the AI. I am, however, sympathetic to the design concerns that make it this way though, and am fully aware that this isn't something that I'm likely to notice in play.

There will be fanatically xenophobic pacifist AI empires in the game though, right? Because I think cutting them would be a deal breaker for a lot of people. :p

You misunderstand - the AI can have every ethos combo but most personalities are valid for more than one combo.
 
  • 19
Reactions:
You misunderstand - the AI can have every ethos combo but most personalities are valid for more than one combo.
Ah, thank you so much for clarifying! Since @HarryB922 was taking about the ethos combinations I thought that's what you were talking about as well.

Everything is making more sense now. :)
 
PNTCaFX.png


If the federation president declares war to the Fallen Empire.. will the FE pursue only the president's native race or all races of the federation?

For example, military dictators can build a bigger, badder ship
https://forum.paradoxplaza.com/foru...laris-dev-diary-5-empires-and-species.887487/
Currently, only Xenophile/Xenophobe Materialist/Spiritualist are valid FE traits. More may be added.
It would be great if Militarist Fanatic Fallen Empire had a more powerful unit, bigger, badder ship, something like on the level of Orion's Guardian from MoO2. It would add more variety and tension to the game.
 
You know what I (and probably no one else) want? A 1 in 1000 chance that an AI goes berserk and attempts a wor-eh, universal conquest, pushing itself to the limit and maybe even being successful, just like some players. :D*cough*Ryukyu*cough*

I also want :rofl: back, but that probably won't happen either. :p
 
  • 2
  • 1
Reactions:
At no point did I say that this isn't also stupid.


Because Jains are known for their manipulation of global politics. Pacifism does not beget diplomatic skill.
In this game it does.

Think of it like this: A Militaristic Society will, by its very nature, promote civil service through the military. It is a society that venerates soldiers and martial accomplishments. As a result of this fewer individuals will be drawn toward the diplomatic branches of government, as it will be seen as less prestigious.
A Pacifistic society, on the other hand, will venerate being understanding and accepting of other beliefs, in short promoting the belief in diplomacy and thus Diplomats become a more prestigious career path, and one more people are willing to enter.

This is represented in the game (in part at least) by granting bonus Embassy slots to Pacifists, while a Militaristic society might have a higher Admiral/General limit (the latter bit is supposition).

The very nature of a game like this means such details are represented by abstractions, as involving actual details would end up being too complicated (ie a system where you actually had a 10k person bureaucracy to manage and the people in that bureaucracy tended to go through these different paths as the society type would encourage).
 
you are aware that Ghandi got Lucky that his opponents were the British and not some other group with less qualms about making rivers run red with blood.
The USSR collapsed due to internal, peaceful, protests after the August Coup. The Red Army commander purportedly informed his superiors that he would not order his men (nor would they follow the order) to open fire on peaceful protestors. This lead to the Coup failing and a general collapse of Russian internal government.

If the freakin' Red Army would have hesitations about shooting unarmed civies then it is safe to say peaceful protest is effective.

Note: Peaceful protests will not instantly change policy, it took decades of internal disruption for the Red Empire to collapse, and Ghandi did not liberate India over night. However, armed demonstrations would almost certainly have done much less for their respective causes than peaceful protest did.
 
  • 1
Reactions:
Or it could just be isolationist.
And I'm sure Xenophobes (tier 1 is pretty much isolationist) will have an Embassy malus as one of its characteristics, so a Pacifistic Xenophobic empire might have the standard amount of Embassies (as Pacifist and Xenophobe cancel each other out). There are tons of different combos in Stellaris and I'm looking forward to exploring them :)
 
Collectivist-Individualist Ethos

¿Individualist will represent Isolationist empires and Collectivist represent intervencionist empires?

I dont undertands exaclty what represents these ethos.
 
Collectivist-Individualist Ethos

¿Individualist will represent Isolationist empires and Collectivist represent intervencionist empires?

I dont undertands exaclty what represents these ethos.

From all evidence, it refers to how the government feels, internally, about the rights of its citizens. So individualists consider the rights of people the most important thing, collectivists think the goals of the group are more important.

It likely has no bearing on foreign policy, save perhaps that individualist empires will tend to band together with other individualist empires, and collectivist empires will band together with other collectivist empires, due to shared views on fundamental rights.
 
  • 1
Reactions:
And I'm sure Xenophobes (tier 1 is pretty much isolationist) will have an Embassy malus as one of its characteristics, so a Pacifistic Xenophobic empire might have the standard amount of Embassies (as Pacifist and Xenophobe cancel each other out).
Which is dumb. Why would a xenophobe have a greater diplomatic outreach just because they're not interested in conquering people?
 
Which is dumb. Why would a xenophobe have a greater diplomatic outreach just because they're not interested in conquering people?
Well the alternative is no-one gets a bonus and everyone is identical. I honestly don't know why you would prefer that so perhaps I am misunderstanding you.

It seems like most bonuses make sense (Militarists focus on military at the expense of diplomacy, Xenophiles are more willing to accept other cultures, Spiritualists will interpret events in a more religious fashion, etc). There will always be the possibility to make an example that is an outlier (a militarist that does have a great deal of diplomacy, as they use them as spies to assist their military efforts), but if modifiers are made so small that any possible militarist society could fit within it then it ends up being meaningless. The modability of this game seems to be pretty high, so it should be possible to tweak things so they work exactly as you like them, also.
 
A militarist society's diplomacy is more of a fear radius. It would make sense that they would affect people farther away, but not positively. And it should cost them more to get diplo deals and other stuff.

These stats reminds me of Pillars trying to balance six stats. Although here the strategic layer makes it more complicated. Hence why you can only take 3 points, not 6.