Stellaris Dev Diary #24 - AI

  • 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.
Showing developer posts only. Show all posts in this thread.

Wizzington

Game Director (Victoria 3)
Paradox Staff
41 Badges
Nov 15, 2007
12.588
142.099
  • Hearts of Iron II: Armageddon
  • Rome: Vae Victis
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Sword of the Stars II
  • Sengoku
  • Europa Universalis: Rome
  • Victoria: Revolutions
  • Europa Universalis III Complete
  • March of the Eagles
  • Majesty 2
  • Magicka
  • Heir to the Throne
  • Arsenal of Democracy
  • Crusader Kings II
  • Darkest Hour
  • Europa Universalis III Complete
  • Deus Vult
  • East India Company
  • Europa Universalis III
  • Divine Wind
  • For The Glory
  • Hearts of Iron III: Their Finest Hour
  • Hearts of Iron III Collection
  • Prison Architect
  • Shadowrun: Hong Kong
  • Shadowrun: Dragonfall
  • Shadowrun Returns
  • Stellaris: Humanoids Species Pack
  • Stellaris: Synthetic Dawn
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Stellaris Sign-up
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Mount & Blade: Warband
  • Magicka: Wizard Wars Founder Wizard
  • Crusader Kings II: Holy Knight (pre-order)
  • 500k Club
  • Victoria 2
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:
does the rival system work similarry to EUIV's rival systemw here every nation pretty much always has 3 rivals? because that doesnt sound like too great a situatioin if everyone has only met a handfull of other empires but is almost automatically hostile to all of them due to all the AI wanting to maximize their influence.

No. AIs won't rival someone just to have more rivals, and there's no penalties for having less than 3 except missing out on some influence.
 
  • 72
  • 12
  • 1
Reactions:
Also a casus belli to force you to abandon planets, could they force you out of your homeworld with that? Or is it strictly limited to colonies or specific planets that empire cares about?

They can't force you off your homeworld.

So without outright cheating, it's a good bet that you can hamper an enemy by a war of economic attrition ?

<3

Yes, but other Empires will generally take a dim view of such behaviour.
 
  • 52
  • 1
Reactions:
Do sector governors all have an identical AI matched to the civilization, or will they vary? Especially in the case of a player-civilization where they have multiple sectors, how is the AI type selected?

Sector AI acts according to the priority set for it. It will not try to guess a personality for you.
 
  • 45
  • 3
Reactions:
And can the fallen empires be fanatics in any trait? Like a fanatic pacifist fallen empire? Or is it only select ones?

Sorry for the spam posts just dont want the questions overlooked in edits as they occur to me

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
 
  • 85
  • 2
Reactions:
How does opinion work in Stellaris? Is there a cap as I notice that its at -284 for the Avians in the first screenshot or can it forever decrease and increase?

The cap is -1000/+1000, so effectively uncapped. The Confederacy of Penkor *really* doesn't like me.
 
  • 53
  • 6
Reactions:
Are there any differences gameplay wise between someone having +100 and +1000 opinion of you or is it more of a way to just to illustrate someone who kind of likes you and someone who really, really likes you?

Well, it means you can tick them off a lot more before they start disliking you, otherwise no real difference.
 
  • 41
Reactions:
Will there be some sort of slider for the player to influence The sector ai spending? E.g. I want an older sector to spend more money on a larger fleet but a newer sector on developing colonies.

Not at present. Note that Sectors don't maintain fleets (besides construction ships), so generally they'll sink their minerals into developing planets.
 
  • 34
  • 1
Reactions:
Since I can go up to 1000 am I going to be able to get dragged into a war against someone I like via my or their respective allies, fight them and still maintain good relations with them? Or are there going to be modifiers that just plummet the relations all the way down?

Going to 1000 is really not possible, but if you actually got that level somehow you could probably murder half their population and they'd still love you.
 
  • 66
  • 4
  • 1
Reactions:
Has it ever been explained what Influence actually is? I remember some DD announcing that you would talk about it in the future, but I can't remember any DD actually explaining what Influence does and what is good for. May be usefull to know in order to guess how rivalries influence the game and whether or not it may be usefull to rival strong empires or small ones.

Influence is primarily used for:
- Alliances
- Edicts
- Outpost Stations (the only way besides colonies to claim space)
- Certain Buildings
 
  • 44
Reactions:
very cool. and thanks for the insights. i am not a modder myself but i see that these AI personalities could be created by the community to add even more variety. is that possible?

also do we know already what kind of resource influence is?

AI personalities are 99% moddable. The only thing you can't do is create new archetypes, but it's possible to make very different personalities within the same archetype.
 
  • 40
  • 2
Reactions:
Does this mean I can change how the archetype behaves?

Or does it mean I can have a multitude of different personality potentials under one archetype?

Archetype determines some core behaviours, for example a 'Propagator' AI will focus on population growth. This can't be modded, but you can make very different kinds of Propagators.
 
  • 37
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?

The AI does not hate you just for declining trades, but for instance if they're boxed in by you and you refuse access they might consider that a reason to go to war.
 
  • 50
  • 1
Reactions:
this sounds amazing :)
but is it like that the sectors control how much army and navy you have? or is it possible to say to the sectors that it is important to get a new navy up and running and it needs to get to this planet. Then the sectors find the way its quickest place to build and transport the ships and apply a budget accordingly?

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.
 
  • 29
  • 2
Reactions:
If I understood correctly, the AI behavior is mostly dictated by their personality, which is defined by a combination of ethos. But the same personality can be formed by multiple combination of ethos, right? So 'Federation Builders' won't be all 'individualistic, xenophile pacifist', so maybe they would be spiritual instead of individualistic, but still be a 'Federation Builder', is that correct?

My question is, will this effect how they behave? I understand the difference won't be as pronounced as if they have different personalities, but will still there be subtle differences between factions of the same personality?

Correct. Ethos variations of the same personality can have some minor variations (such as which laws they pass) but it probably won't be on the level noticeable to the player.
 
  • 33
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.

You won't be able to get +1000 opinion without modding the game. Seriously.
 
  • 40
Reactions:
Will militant empires be more drawn to other militant empires in terms of alliance and federation, or will they be attracted to pacifist empires to complement each another, or will they just be more independent/solitary of nature?

Militarist Empires prefer to form alliances with other Militarists, since Pacifists would just vote down their wars. Some personalities go it alone, but most can form alliances under the right circumstances.
 
  • 45
Reactions:
Do you guys see the danger of limited possibility for 'building tall' due to the A.I.? I mean, once empires split into sectors, it will basically be the same code handling most of the development of the galaxy. This leaves no room for smart investments of the Player or specialized A.I.s. So in the end, the development of these empires might be largely proportional to their size...?

A few points that could stop that:
-special resources - I do not know how much they matter
-focused research - I don't know how diverse empires can get through their technology
-Overall budget - Dev Diary 21 mentioned 'Infusion of Minerals' and 'Taxing'; so maybe I can just turn of taxes to give it a boost in the short term?


In the same vein: Are sectors 'finished' developing at some stage and what does the sector A.I. do then?

Honestly, all AIs are going to have more or less the same strategy when it comes to (peacefully) securing basic resources anyway. What really differs is how they spend it.
 
  • 38
  • 1
Reactions:
will fallen empires let you know ehn you are pissing them off? i'd think even most fallen empires would prefer not to have to bother to send out a fleer or something and instead just tell a race to go bother someone else OR ELSE.

Yeah, you'll get a warning from them first as long as you don't do something obviously very stupid like insult them.
 
  • 45
  • 4
  • 1
Reactions: