• 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:
It doesn't sound like it. Wiz says, here, what Influence is mainly used for and it sounds like it's a domestic stat (getting your people to accept alliances, edicts, and stuff like that). Remember, when he said a weak rival wouldn't generate much Influence it was because your people wouldn't be impressed by them.
That sounds to me like Vicky influence where you gained more influence as a larger nation. It doesn't sound like power projection at all (in terms of uses). I thought it was a stat for influencing other nations though.
 
If you successfully invite races/factions to a federation and it surrounds a xenophobic AI entirely, will the AI be more likely to join the federation, or more likely to get pissed and try fighting its way out or making buddies with the federations enemies?
I want to know if your population would suddenly turn xenophobic when an alien Fed president does something bad and you had a secession movement on your hands.

Please show us demo or something of the game :(
I believe they said they would do something similar to World War Wednesday. I don't know when that happened along the HOI4 development path but if you match Stellaris dev diaries to eu4 we will see Stellaris release probably around September this year. So I would imagine a longer video demo isn't too far out
 
  • 1
Reactions:
I believe they said they would do something similar to World War Wednesday. I don't know when that happened along the HOI4 development path but if you match Stellaris dev diaries to eu4 we will see Stellaris release probably around September this year. So I would imagine a longer video demo isn't too far out

Didn't they reveal Stellaris was further along in development to hoi4?
 
  • 1
Reactions:
I refuse to acknowledge this statement
EU4 released August 13th. By counting the dev diaries from where they started to the end, I came to sometime around August. I said September to give room for (hopefully) more development prior to release than EU4 had.

Considering how Victoria 2 Influence is you sphering other countries and the uses of Influence in Stellaris all sound domestic, I don't see the similarity you're seeing.
I see the similarity to it being a sort of mana pool that is then spent on actions. You could use influence to perform those actions that in EU4 were performed by diplomats. That was the distinction I was seeing.

Didn't they reveal Stellaris was further along in development to hoi4?
I could have sworn HOI4 was announced for Q2 2016
 
  • 1
Reactions:
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...
hehe.
The outcry would - I think- be dependent on how the personality of the governors was presented. After all, if the leaders in CK2 do things they have their AI-reasons for this. Now if a governor would end up in the extreme scenario you proposed I'd be expecting to find a personality (i.e. modifiers that lay at the basis for this behaviour. Things like: kleptocrat -for the corruption-, pol pot -for the building of stupid things-, incompetent -for getting into a position where the kleptocraziness doesn't pay of for him personally as I find him out and bring the full weight of the empire down on him...).
So maybe the building should be seen not as suboptimal but as "optimal" given the governor personality. Meaning that a governor that has excellent stats should build close to optimal, or at least better than the vanilla suboptimal that'll be present in the govenors-at-launch.
Much depends on execution of the concept and the way it's explained in character.
 
  • 2
Reactions:
hehe.
The outcry would - I think- be dependent on how the personality of the governors was presented. After all, if the leaders in CK2 do things they have their AI-reasons for this. Now if a governor would end up in the extreme scenario you proposed I'd be expecting to find a personality (i.e. modifiers that lay at the basis for this behaviour. Things like: kleptocrat -for the corruption-, pol pot -for the building of stupid things-, incompetent -for getting into a position where the kleptocraziness doesn't pay of for him personally as I find him out and bring the full weight of the empire down on him...).
So maybe the building should be seen not as suboptimal but as "optimal" given the governor personality. Meaning that a governor that has excellent stats should build close to optimal, or at least better than the vanilla suboptimal that'll be present in the govenors-at-launch.
Much depends on execution of the concept and the way it's explained in character.
Isn't this partially covered by the ability of appointed characters to acquire negative characteristics (I believe the example given in the early dev diary was a lunatic scientist)? I would like to see an expansion on sector-governors based on government type, i.e. a democratic nation requires elections (you have little control), republic allows appointments from a party, monarchical governments are hereditary, dictatorial governments are picked personally, juntas require military service, etc.
 
  • 1
Reactions:
How is that different from only being allowed to have 2 free leaders in EU4?
At no point did I say that this isn't also stupid.

I would look at it in more abstract terms. Just think of the game mechanic of embassies as a way of representing the increased diplomatic skill of pacifist races instead of a building that houses your diplomats.
Because Jains are known for their manipulation of global politics. Pacifism does not beget diplomatic skill.
 
  • 2
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.

It's a balance thing. In EU terms you chose a diplomatic idea group instead of a military one.

In real life pacifism just means you won't fight, not really a way for a non isolated civilization to survive realistically.
 
  • 3
  • 2
Reactions:
So maybe the building should be seen not as suboptimal but as "optimal" given the governor personality. Meaning that a governor that has excellent stats should build close to optimal, or at least better than the vanilla suboptimal that'll be present in the govenors-at-launch.
Much depends on execution of the concept and the way it's explained in character.

I think that would help. You could always create an outer rim sector for the total incompetents and stick them there if the game requires you to give them a place. Yet compared to MoO2, all of the governors were at least marginally helpful. Granted, some were significantly better than others, but at least you didn't have something that would totally destroy any semblance of a symmetrical start. What if my neighbor gets three inbred, lunatic, slothful Pakleds for governors and I get the sons of Space Age Lodbrok? Can we at least dismiss the total incompetents, or pay to get a reroll (i.e., "Invite a Noble Alien to My Space Court")?
 
At no point did I say that this isn't also stupid.

I think it's stupid from the perspective you take as well, seeing as there is no justifiable reason a country with a population in the hundreds of millions could only field a few generals, or that an interstellar civilization could only maintain a few embassies. That is ridiculous.

But it's justified in context by game balancing. Why is this a bad thing IYO?
 
  • 3
Reactions:
It's a balance thing. In EU terms you chose a diplomatic idea group instead of a military one.

In real life pacifism just means you won't fight, not really a way for a non isolated civilization to survive realistically.
No sweden has not gone to war in 200 years. Tell me again how pacifism does not work.
Granted in less technological times you may have a point but stellaris is set in more technological times.
 
  • 2
  • 2
Reactions:
No sweden has not gone to war in 200 years. Tell me again how pacifism does not work.
Granted in less technological times you may have a point but stellaris is set in more technological times.

https://en.wikipedia.org/wiki/Moriori_people

Sweden has been in a very useful political climate for the past 200 years. Don't expect the galaxy, which your species encounters to be just the same. If Space Nazis decides that Space Sweden is worth invading, you can't just shout "don't! We're pacifist! You're wasting your time!" and expect it to work.

Also, if another country invaded, Say Denmark claimed their less union partner restored to loyalty, would your army just refuse to shoot and surrender right away? I think you're confusing pacifism with neutrality. Even then, it doesn't matter much, your "neutrality" only works as far as those around you will abide by it.
 
  • 3
  • 2
Reactions:
I'd wager "pacifism" in Stellaris, or at least non-fanatic pacifism, isn't supposed to actually be pacifistic in the literal, "avoid violence at all costs", sense. More about speaking softly, and not starting wars, but willing to carry big sticks and likely to be found making alliances with others who share this philosophy.

So the "pacifist" civs are trusted because they are less likely to support a war of choice. But they need not be helpless.
 
  • 7
  • 1
Reactions:
https://en.wikipedia.org/wiki/Moriori_people

Sweden has been in a very useful political climate for the past 200 years. Don't expect the galaxy, which your species encounters to be just the same. If Space Nazis decides that Space Sweden is worth invading, you can't just shout "don't! We're pacifist! You're wasting your time!" and expect it to work.

Also, if another country invaded, Say Denmark claimed their less union partner restored to loyalty, would your army just refuse to shoot and surrender right away? I think you're confusing pacifism with neutrality. Even then, it doesn't matter much, your "neutrality" only works as far as those around you will abide by it.
Well who says it's absolute pacifism in the game? I am assuming we're talking technical pacifism.Where you try to avoid conflict, not where you won't even defend your own life.
Also even an absolute pacifist may be willing to disable enemy vessels as long as they don't destroy them. Refusing to kill is not refusing to resist. Ask the British, I think Gandhi taught them a similiar lesson.