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

In terms of human culture, American culture is rather individualistic on a global scale, but national diplomacy is still as much negotiations with the central government as it is with more collectivist countries such as China. Internal collectivism does not mean a nation is externally extroverted or vice versa.

The Xenophilia/xenophobia and Pacifism/Militarism axis are far more related to degree of external relations and the nature thereof. A collectivist may communicate better with another collectivist and an individualist better with an individualist, sure as being very spiritual probably helps communication with other spiritual nations and put you at odds with materialists.

The nature of stagnated empires seem very much to be the same as on Earth historically: Complete isolation and a spurred desire to continue evolving with no external pressure to do so.
The diffrence is that as individuals american citizens aren't that much more powerful than individuals elsewhere where they travel while a sufficiently powerful alien is in fact ona demi god level. Oh you can probably interact with what passes for 'centralised government' for them too, but if you border a individualistic FE then you will from time to time be affected by individuals of their kind.
Also america isn't that individualistic. Humans are by their very nature social beings. Consider a species which is totally unable to grasp the conscept of altruism.

My point is either seeing only 4 diffrent kinds of ethoses in FE, or seeing more but half of them having a general AI running them is fairly boring. It took me less than ten minutes to think up one kind of fallen empire for collectivists and find similiar ones in fiction (in fact it took me less than ten minutes to provide an example for each of all the 4 missing ones). There are probaly plenty of other, better, solutions. The point is that it's something that should be in there.

I can make examples of these kinds of fallen empires in pieces of fiction:
Collectivist: The Ancient Collective (Basically a direct democracy where every decision is made by a majority vote, bordering on a hive mind since they all exist outside space and time, the Ori are even more thus no Ori individuals are ever mentioned) (Also the Q continuum, and the travelers species)
Individualist: Time lords (ok the doctor may be the odd one out but then again it seems that venturing out amongst the lesser beings seems to have been something they did even before)(also Kryptonians seems to have taken a pilgrimage like this as a rite de passage).
Pacifists: The Organians (From star trek, watch the episode TOS:errand of mercy, they basically take out the entire federation and klingon fleets without harming a single individual)(also the Nox).
Militarist: The eldar (warhammer 40k, they are basically a biological weapon created to fight for their creators, and thus have had to struggle with this legacy for millions of years even if they culturally have surpassed their bloodhtirst they cannot physically rid themselves of it).

Also what stagnated empires on earth? On earth a empire that stagnaes is usually overthrown by another one that while less powerful is not stagnant in the same way. For an example the Byzantines and the ottomans. The persians and the seljuks the egyptians and hyksos. FE the way they are in this game does not exist in reality, the closest example would be china in it's realtions with the europeans, except it actually had relations to outsiders, it traded with them.
 
Last edited:
Debatable. Surely militarists can have equally many embassies or even more, they just employ a bit more aggressive diplomacy when they arrive on a foreign planet, and the embassy's new domain is all of it.

The realism argument isn't relevant, the point is to make pacifist a little more attractive.
 
  • 51
  • 11
  • 4
Reactions:
I added the images to the image gallery. :)

though Wiz, I got a question: can the Ai list you the player as a rival without you first rivialing them?

For sure.
 
  • 27
  • 3
Reactions:
Wow 5 screenshots!
Threat seems like a natural mechanic I guess, but we have peace treaties and now rivals ripped from EU4? Please try not to make Stellaris too much like EU4 in space.
 
  • 1
Reactions:
The realism argument isn't relevant, the point is to make pacifist a little more attractive.

Was just joking about the real militaristic ambassadors being generals there to conduct ground invasion.
 
  • 2
Reactions:
The diffrence is that as individuals american citizens aren't that much more powerful than individuals elsewhere where they travel while a sufficiently powerful alien is in fact ona demi god level. Oh you can probably interact with what passes for 'centralised government' for them too, but if you border a individualistic FE then you will from time to time be affected by individuals of their kind.
Also america isn't that individualistic. Humans are by their very nature social beings. Consider a species which is totally unable to grasp the conscept of altruism.

My point is either seeing only 4 diffrent kinds of ethoses in FE, or seeing more but half of them having a general AI running them is fairly boring. It took me less than ten minutes to think up one kind of fallen empire for collectivists and find similiar ones in fiction (in fact it took me less than ten minutes to provide an example for each of all the 4 missing ones). There are probaly plenty of other, better, solutions. The point is that it's something that should be in there.

I can make examples of these kinds of fallen empires in pieces of fiction:
Collectivist: The Ancient Collective (Basically a direct democracy where every decision is made by a majority vote, bordering on a hive mind since they all exist outside space and time, the Ori are even more thus no Ori individuals are ever mentioned)
Individualist: Time lords (ok the doctor may be the odd one out but then again it seems that venturing out amongst the lesser beings seems to have been something they did even before).
Pacifists: The Organians (From star trek, watch the episode TOS:errand of mercy, they basically take out the entire federation and klingon fleets without harming a single individual).
Militarist: The eldar (warhammer 40k, they are basically a biological weapon created to fight for their creators, and thus have had to struggle with this legacy for millions of years even if they culturally have surpassed their bloodhtirst they cannot physically rid themselves of it).

Also what stagnated empires on earth? On earth a empire that stagnaes is usually overthrown by another one that while less powerful is not stagnant in the same way. For an example the Byzantines and the ottomans. The persians and the seljuks the egyptians and hyksos. FE the way they are in this game does not exist in reality, the closest example would be china in it's realtions with the europeans, except it actually had relations to outsiders, it traded with them.

Eventually overthrown, yes. But could exist for centuries. Example being China.

Imagine space China or Japan in isolationist times, but technologically superior. That's what we're dealing with, as I understand it.
 
You will be able to control the spaceports in your sectors, which means that you can build navies on any planet including the ones belonging to a sector. The same with armies, they won't be controlled by the sectors.

thanks, it was just because it said in the DD that when you lost your navy the sectors would focus more resources on the navy
 
Eventually overthrown, yes. But could exist for centuries. Example being China.

Imagine space China or Japan in isolationist times, but technologically superior. That's what we're dealing with, as I understand it.
Yeah but that's the thing technoligcally superior empires don't just sit around. Even China was busy trying to suck up as much of the worlds precious metals as they could. And none of these were nearly as superior in tehcnology as the fallen empires are. As sufficiently advanced aliens generally are in fiction.

The fallen empires aren't just sitting around they are just pursuing objectives to long term of complex for lesser species to fathom. And this is true for collectivists individualists (though they proably have plans each on their own) pacifists and militarists as much as any of the others.

If paradox chooses not to add these to fallen empires it should be for one reason and one reason alone, they don't feel that they have the time to get it right before release. That I can respect, and hope that they add them in as they start releasing DLC. But suggesting that there are no good ideas for such fallen empires is preposterous.

I have mentioned 8 or 9 exampels above.
 
Last edited:
  • 5
Reactions:
I can't even begin to comprehend the magnitude of trying to design a competent and believable AI based on the multitude of different trait and government combinations that will be possible in this game, while still making them appear different. You'll get high praise from me if they turn out as well as this DD makes them sound. I also really like the economic AI, sounds like a system that will really work within the game and allow for a competent but still varied range of AI opponents.

Have to talk about threat though. I have yet to see a game that handles this mechanic in a way that makes the game more fun. More often than not, you either don't notice it at all or you notice it so much that it becomes the central aspect behind every decision you make and for me that detracts from the game, it doesn't make it more enjoyable. Hopefully Stellaris is able to find the right balance since it is apparently going to be included, but I also hope it will be easily moddable just in case.
 
  • 2
Reactions:
You send an embassy, which improves relations mutually. You are limited in how many embassies you can have at a time (pacifists can have more), and they decay faster than they work.
I really like this. It eliminates one of the more boring parts of EU4 for me: rotating your diplomats around to try and keep relations high with everyone when you had nothing better for them to do. I really like the idea that you can only have truly high relations with as many nations as you can set up embassies for, and pacifist nations have a tangible benefit over militarists in this regard.
 
AI personalities are mostly static but if a country changes so radically that the old personality would not be a possible pick for it anymore, it will pick a new one. IE: If they're Despotic Slavers who stop wanting to have slaves, they won't remain Despotic Slavers.

Because they've finally seen the violence inherent in the system that Dennis the peasant warned us about? ;)

Seriously, this is good to know. I was afraid that some sort of massive change would happen, and the AI would keep trying to work through its scripts regardless of the domestic political situation.
 
Have to talk about threat though. I have yet to see a game that handles this mechanic in a way that makes the game more fun. More often than not, you either don't notice it at all or you notice it so much that it becomes the central aspect behind every decision you make and for me that detracts from the game, it doesn't make it more enjoyable. Hopefully Stellaris is able to find the right balance since it is apparently going to be included, but I also hope it will be easily moddable just in case.

I'd personally love to see AI response to threat be more of a gradual continuum than the "grim trigger" approach in Vicky or EUIV where you cross an arbitrary threshold and every country in the world switches over instantly to hating you/aligning against you/declaring war on you. I'd love it if as threat crept higher, peaceful activities like trade and alliances became strained and harder to negotiate. Economic pressure started being applied to you and your friends were more likely to start falling away, etc. rather than the AI just jumping straight for the massive coalition war button.

I'm optimistic on this front for Stellaris since it seems opinion will have a much bigger impact on AI diplomatic behavior and it is much easier to work something like that into a more nuanced sliding scale.
 
  • 6
Reactions:
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.
Fanatic pacifist = Peacekeeper (Sots 1)? He does not like the war on its borders.
 
  • 2
Reactions:
The neighbouring empires won't like it if I go on militaristic rampages?

Damn.

Okay, parlament. We'll need to change our national anthem.


Never actually played GTA 5 myself. Just love this guy's music. :)
 
  • 5
Reactions:
Fanatic pacifist = Peacekeeper (Sots 1)? He does not like the war on its borders.
I would actually consider the Liir to be fanatic pacifists. Their soldiers/fleet crew actually become socially "dead" and are isolated from the civilian populace because they are now tainted by their violent profession, and they basically are content to keep to themselves and quietly research stuff. Until you cross them, at which point they declare total war to purge the galaxy of your indelible evil using advanced biological weapons.
 
  • 2
  • 1
Reactions:
Good stuff, looking forward to seeing how all the personalities play out....
 
  • 1
Reactions: