• 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:
Realistic space battle: there is no battle, just flinging rocks at near light speed at enemy home planets.
So you say yet there has been no case of us predicting the technology of the far future accuratly.
 
  • 5
  • 2
Reactions:
Speaking of Space Emperor personalities, let’s get this out of the way: The plural of ethos is ethoi, not ethoses.

The standard plural ending for a Greek noun ending in os is oi. Dynatos (a mighty one, a lord, etc) and Dynatoi. Doruphoros (a spear carrier) and Doruphoroi. Akritos (a Byzantine border noble) and Akritoi. Kataphractos (an armored horseman) and Kataphractoi. Psilos (a skirmisher) and Psiloi.

The reason the plural of "ethos" doesn't show many entries in standard encyclopedias and dictionaries, is that it isn't used in common English. We speak of Billie the Bard's Ethos, or whatever. But, just like the idea of "One man, one vote!" we have the parallel concept of "One man, one Ethos!" And, therefore, "Many men, many votes", and "Many men, many Ethoi".

There is the argument that Ethos is an irregular (contracted) third declension ancient greek noun, neuter gender. Its nominative and accusative (used as a subject or normal object in the sentence) would be ethe, with a long final e. It sounds eeth-air. This argument is inelegant and we don’t have to adopt the entirety of greek grammar to arrive at an answer.

So when we need to use the plural of "ethos.", use "ethoi." If you want to discuss two or more different groups and compare or contrast the ethosoi of both (or all), that's the word you'd use.

Happy AI space conquering!

Start to use 'kindergärten' instead of 'kindergartens' because 'kindergärten' is the correct German plural of kindergarten!
 
  • 5
  • 1
Reactions:
Will the AI interpret aggression differently depending on the circumstances?

As in, will 100 aggression (my arbitrary measure of stuff taken) gained in a fight to the death (where you literally had to eliminate the other guy, like what the humans thought in Ender's Game) be less threatening than 100 aggression points from "I want a little from you ... and you ... and some from you, too"?

In more arbitrary terms:
A and B have exactly 0 relations both ways with all other empires and -1000 with eachother, and empire X has no vested interest in either party (for the fight to the search scenario). In the second scenario empires B is just another empire and empire A decides to take chunks out of B, D, and C. The question would be if empire X sees A as much more aggressive in one scenario (and if that perception potentially changes based on X's personality).

reread the topic on the DD again. Threat is context sensitive. Threat is between to empires. There don't seem to be a general 'threat value' but a 'threat value between empire x and empire y'.

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.
 
  • 1
  • 1
Reactions:
Is it possible for an AI's personality to change over time?
 
  • 1
Reactions:
Is it possible for an AI's personality to change over time?
I think they said that if an empire no longer is eligable for it's current personality it'll pick a new one. Remember that an empires ethos is depending on the ehtos of it's pops which can change over time.
 
  • 1
  • 1
Reactions:
Why would you not be able to pick your own ideology and policies so I would imagine that I can do the same. It is probably going to be something like expansionist, militarist and fanatically xenophobic empire.

Fanatic Purifiers is an AI personality. The only thing it does (unless Wiz held back something) is say which moves the AI are more likely to consider. It would be like choosing the "diplomatic/administrator/militarist/explorer/balanced" AI traits for yourself in EU4.
This has nothing to do with choosing your ethos (like Militarist or Xenophobic). You can do that. But the AI personality is not entirely determined by their ethos.
 
  • 3
Reactions:
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.

Do their wargoal is not limited?
Do my allies defend against rabies fallen empire?
 
Fanatic Purifiers is an AI personality. The only thing it does (unless Wiz held back something) is say which moves the AI are more likely to consider. It would be like choosing the "diplomatic/administrator/militarist/explorer/balanced" AI traits for yourself in EU4.
This has nothing to do with choosing your ethos (like Militarist or Xenophobic). You can do that. But the AI personality is not entirely determined by their ethos.
The monarch in my country had those same traits as the AI did. While I could not choose them freely, they were still there. I don't know if it will be only the AI who gets this personality but to me it really does seem like something that could be done with the ethics. Maybe the player can't have it since the player is limited to 3 points and maybe you would need to have fanatic in both xenophobia and militarist ethic(so 4 points) but that could easily be modded.
 
The monarch in my country had those same traits as the AI did. While I could not choose them freely, they were still there. I don't know if it will be only the AI who gets this personality but to me it really does seem like something that could be done with the ethics. Maybe the player can't have it since the player is limited to 3 points and maybe you would need to have fanatic in both xenophobia and militarist ethic(so 4 points) but that could easily be modded.

AI nations are working under the same conditions as player nations in terms of ethos limitations.

The "personality" is probably just chosen randomly from a list of possible ones, each one with ethos requirements, say there are 15 "personalities" and for an xenophobic, militarist, individualist faction that would block about 10-11 of them (can't be 'federation builder' because no xenophilia/pacifism, can't be 'religious nutjobs' because no spiritualism, can't be 'greedy resource hoarders' because no materialism... Can be 'Proud warrior race' because militarism, can be 'Slaver scum' because xenophobia, can be 'fanatical purifiers' because both fanatical xenophobia and militarism)
 
  • 1
  • 1
Reactions:
It's weighted random with emphasis on weighted (if one personality fits way more than another, the other has zero chance to be picked etc). Otherwise yes, pretty much.
 
  • 14
Reactions:
  • 2
Reactions:
Start to use 'kindergärten' instead of 'kindergartens' because 'kindergärten' is the correct German plural of kindergarten!

The English language is like the Borg... We will take your words, assimilate them into our collective, and then apply our grammar, pluralization, and in some cases even spelling to them. Resistance is futile. Your linguistic and syntactical distinctiveness will be added to our own.
 
  • 10
Reactions:
The English language is like the Borg... We will take your words, assimilate them into our collective, and then apply our grammar, pluralization, and in some cases even spelling to them. Resistance is futile. Your linguistic and syntactical distinctiveness will be added to our own.

Almost every language does this, coining English terms and localizing them.
 
  • 1
Reactions:
This sounds pretty good for sure, varied AI personalities are great. However, how about AIs adapting or changing over the course of the game? I loathe to think that the AI is so set in stone that it will act the same way turn 1 as turn 10000, or what have you. I would really like it if the AI changes over time, based on for example revolutions, changes of leadership, or whatever else that happens to them.
 
Please show us demo or something of the game :(
They've shown us many "somethings" about the game, including all the dev diaries like this one. There's even a little snippet of gameplay footage from the alpha floating around somewhere if I recall.

They have stated that once they are ready, they will almost surely stream some gameplay for us on their twitch channel.
 
  • 2
Reactions:
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?