• 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.
Current game rule - you can't build a habitat/megastructure in orbit around an object where another station is.

Now a Habitat can earn 200 minerals, whereas a really good Gas Giant can generate 12. So the AI should demolish the mining station to build a Habitat.

The problem in the current Stellaris is that it doesn't plan. It doesn't know that demolish Mining Station allows it to build a Habitat and earn more in the future. So demolish/rebuild probably won't do anything at all unless the AI is "thinking" a couple of steps ahead.

Likewise for Ecumenopolis.

The problem is not that the AI is getting rid of a building or station that is a net negative, it is the opportunity cost that matters.


The current AI does however? So what did you change?
Oh you mean the planetary decision to stop growing pops? Well, I haven't actually touched any of that so, they will probably still do that if they cant build more buildings, unless someone else changed that. Sorry for the confusion!
 
I meant added "dynamically" : e.g. there is a secondary plan (a sub-plan) that does not invalidate the base one, but sets additional income goal for new resources and is activated upon researching tech. Or we need to overwrite existing plan / substitute it in its entirety with our own that includes these modded in resources.
Ah, no. That was actually an improvement brought up but I didn't have time to do that. You would have to write a new plan that contains those resources and trigger a switch.
 
More than arbitrary dates like ''early'', doesn't it make more sense to tie the economic plans the geopolitical situation? Like having a ''wide expansion'' plan that focuses on pop growth and minerals to build stuff if there is little danger and plenty of space, a 'tall expansion'' if there is little danger but few colonization options, or a ''military buildup'' plan that focuses on alloys if the AI predicts an war in the near future.
That those make more sense, and you can do that as well in script! I didn't have time to do a lot of fancy scripted plans but that is for sure something I hope modders do and that maybe we can do in the future
 
Ah, technical dev diaries, the best kind when this meaty and lengthy :D
Please, sir(s), may I have some more?

On a more serious note - excellent write-up, I have high hopes for the AI actually not being braindead ... well, at least on the economy side, and possibly on the military side (I suspect it's the economy killing everything else right now). I'm still going to observe my "no pre-order" rule, but don't tempt me like this ... actually, please, do :D

A few things remain unclear for me, however:
A) Will the AI be able to plan in building megastructures to integrate into the economy? What about Ascension Perks? As in, if their empire is locked in and pacifist, will the overall country AI prioritize furthering internal development via demolishing mining stations in favor of habitats, and increase priority on picking up Galactic Wonders and/or Ecus? Because if not I foresee a future where an AI is locked in due to military might or federation blocks, and it has capped out all the planets it has and thus cannot grow more. What will it do? (Admittedly this is an edge case scenario, but still)

B) What about planetary/sector AI? The automation feature that is sorely needed (when you have a large empire) - is there any way for it to benefit from all the work done here? If not, would it be possible to enable economy country AI for the player when automation is turned on, and limit it based on planet designations, as well as let the player edit The Plan™? Please, I've stopped playing conquering empires for this very reason - managing 100 planets manually is no fun at all :(
These are all good points, unfortunately the sector/megastructure/perks AI were not within the scope of this rework. I had a very limited timespan and I really wanted to focus on making the core economy AI ( resources, planet buildings etc. ) work better and be more robust. Lategame "high performance" and more special fixes ( like destroying mining stations to build something else ) I just didnt have time to do, I tried to do a general fix of the core economy that would benefit the AI throughout the entire game.
 
Just to verify a point.... in your post, you specifically mentioned demolishing BUILDINGS, but didn't explicitly mention demolishing DISTRICTS. Its the failure to do the latter that prevents AI players from developing ecumenopolis planets. Have you made certain to specifically allow the AI to demolish districts too?

Is there currently a desire in the later-game plans to create ecumenoplis planets if available (which would encourage demolition + replacement to make particular planets all city)? If not currently, will there likely be in the future?

Additionally, just to confirm how the resource targets in the plans work - naturally, I'd assume that if we have a very successful AI that's colonized or conquered a lot of planets it would be aiming to produce more resources than the amounts specified in the plans - it would naturally want as much as possible to be produced. So, just to confirm, it won't just "give up" on producing alloys or consumer goods or research or unity once it reaches the plan targets, right? If it has the productive capacity to produce more, it would, right?

Thanks. Really looking forward to seeing these changes in 2.6 and 2.6.1.
Districts also have destroy trigger so yes, should also work. I have not made any changes to ecumenopolis-building though so I honestly don't know, it was outside the scope of this particular rework.

No, they will never just "stop", they will try to find another plan and if they don't find one they will fallback to the old system and just keep building stuff anyways.
 
You missed the question.

Planet A has zero free specialist jobs and 20 worker jobs.

The AI upgrades an alloy foundry. Now there are 3 free specialist jobs.

The pop allocation system will automatically upgrade 3 miners to be specialists.

Does the AI know that this will occur, and will it plan ahead?

Particularly a problem with Ecumenopolis, where 10 clerks may all be promoted to specialists.
Ah, sorry. No, the AI cannot plan ahead for this, which is a technical limitation unfortunately, you cannot truly beforehand know what jobs pops will switch to since all of those weights are scripted all over the place. You can only really know by doing those calculations and pre-calculating that when creating a build plan would be WAAAAAY too expensive performance wise :(
 
Can any of the plan values be changed in-game, for an ongoing campaign (via events or decisions)? I understand the goal would be to have several plans for different occasions, and it is a significant improvement over the old system, however, I see a missed opportunity to actually incorporate the plan system into the gameplay. I think it would be nice for the player to devise his own plan (on its own dedicated tab/GUI in-game), see how it plays out and tweak it if necessary. At least it would be a good way of reducing micromanagement for those who want it.
Perhaps this is technically quite difficult to implement, but it could be something worth considering in the future?

Very nice DD and thank you for talking about the inner workings of the AI!
Unfortunately not, that would be nice to do but I wanted to keep the plans as simple as possible for now and focus more on how the AI tries to reach those planned goals.
 
What I want to know is what was stopping the AI from colonising all those habitats?
The AI treats building a habitat the same as building a megastructure. Once the habitat is there, it should consider it a colonization opportunity. (Whenever they get around to it.)

We did end up adding a check so they won't build any more habitats in a system that already has an uncolonized one.
 
@sidestep This is great news! and it looks like a much less messy system! I have 3 questions:
  • How does the new economic AI / Economic plan factor in the galactic market or internal market?
    • Does the AI aim to be totally self sufficient now,
    • Or will it happily just buy in Food, or Volatile gasses (for example), for a long term, instead of laying down refinery worlds.
  • Have there been any changes to the slave market/how decisions there will work?
    • The Slave market is quite binary (depending on the empires in the galaxy at the time) - it'll either be mostly empty with slaves being immediately bought up, or itll have hundreds of slaves up for sale (to the point that the slave market UI literally lags out).
  • After something like synthetic ascension, will the AI be loaded on to a new economic plan (i.e. no more building farms, weight generators very highly).
    • More generally, will food/mineral/energy weights shift dynamically if an empire has more Bio Pops/Lithoid Pops/Robo pops in it?
* The AI does aim to be self-sufficient but it will buy resources if needed, more specifically it will allow a deficit of for example Volatile Motes to upgrade an Alloy Foundry if it can buy motes without issue.
* I did not touch the slave market.
* If the AI starts/stops needing a certain resource they will switch plans, yes.
 
@sidestep My apologies if thi is considered spamming and I hate to re-ask, but as you're currently active in this thread I'm trying anyway. Can I get a response to these percieved issues from a couple pages ago?:

1. What happens to a lithoid empire if it aquires a non-lithoid minority? Do the normal pops starve because the AI remains in a non-food-producing plan? Or does the AI switch to a plan that does produce a food surplus but is completely inadequate to produce the mineral surplus the lithoid population requires? Similar problems I can see for synthetically ascended empires while assimilating new pops, normal empires conquering lithoid planets and any machine empire with organic pops -pampered, enslaved or otherwise- .

2. I hate that there still are no planetary plans. Sure the AI can see a need for an alloy foundry and order one one the planet most suited, but the human player is still stuck with dozens of planets that the AI can't be trusted to take care of when we have no ability to assign an AI-plan specifically to a single world.

3. How well does the AI handle big numbers of pops switching jobs? If it upgrades an Alloy foundry and then all the former mining workers flock to the new improved jobs there is a sudden demand in minerals and CGs as well as a sudden drop in mineral production.

4.Does the AI take buildings under construction into account? Otherwise a mineral deficit will cause minign districts to be ordered en masse until the first ones are actually finished.
I think I answered this but im bad at forums so ill do it again, quickly this time.
1. They will switch plan and produce food etc.
2. No planet-specific plans no, not enough time to rework together with this
3. They will still switch, did not touch the job system directly
 
So in other words, the AI is more competitive to such an extent that it needed nerfing?
Haha, I will stick to no such claims.
I like all of the informations in the DD. Will anything of this influence the sector AI or is this a completely different field? And what about special goals like megastructures. Are they part of The Plan or are they handled by other "ministries" or in a totally different way?
You basically hit the nail on the head here, the sector AI is something completely different in code as well as megastructures. Different ministers indeed and a different system.
 
Last edited:
Would it be possible to do something like "if all plans fulfilled, adjust building weights for basic construction so that alloys, science and unity keep getting spammed in this designated proportion to each other"?
This was actually brought up as one possible improvement when I presented it to some other devs, would definitely be super-nice to have but is not supported right now.
 
I mean, as players what we probably often do, when you fulfill your plan; you just build Research/Alloys and construct a bigger fleet.
So late game plan+ would just be the classic late game plan but with like +100k income in sciences and +10k alloys (maybe Unity also), no?
You could script early/mid/lategame+ plans, so that if you fulfill the initial plan the AI would then move on to the earlygame+ plan that just has the same goals except more in science/alloys. Then when you hit midgame you would start the midgame plan and so on :)
 
Thanks for the clarification!

I assume that when it defaults to the old plans, it won't try to get rid of buildings if it say had more than amount of that building (like foundries) that were allowed in the old plans? Rather, just when its expanding beyond the plan with the old-plan defaults it will just limit what it builds to those restrictions until a new plan becomes valid?
No, the old scripts usually just disallow the AI from building more than a certain number of a building or weight them much lower, it does not destroy buildings if it has more than that. For that to happen the destroy = {} trigger would need to be triggered.
 
It would be a reasonable simplification to do what a sane player does - ensure that any job deficit resulting from pop promotion doesn't cripple your economy, i.e. that the "focus" goals are exceeded by x amount of output before doing things that trigger a pop promotion. Edit: with a special consideration for clerks in regular empires, since clerks are the buffer job in almost all cases that aren't merchant-focused.
Sure, good point, but we also don't know which jobs will be left when pops promote. They could leave 4 mineral jobs behind or 4 farming jobs behind so it's all just guesswork at that point. As a human you can do that guesswork and kind of "wing it" but the AI just can't think that way, it needs numbers and that means expensive calculations and then we're back to the original issue unfortunately
 
Could you elaborate on what changes will come in 2.6.1? Will we miss out on a lot in the mean time or is it technical stuff?
As any minor patch, 2.6.1 will be about bugfixes. The military AI changes in it were mostly done in reaction to behaviours observed in the 2.6.0 release candidate that couldn't be added in time. Speaking of which, maybe one day we should elaborate a bit on our release process and why we sometime ship with bugs that are already known and fixed internally (spoiler: it's not _only_ because we are evil).
As far as my observations go in over 2500 hours of this game (probably more than your average QA :)), the worst enemy of AI fleets is subsequent reinforcements.

A meatbag player tends to doomstack always (human nature, as well generic military strategy - hit it hard, hit where it hurts, instead of matching forces hit with overwhelming advantage to reduce your casualties).
That's the conclusion I came to after trying a bunch of various "clever" fleet divisions. At the end of the day, making sure each of your stacks can safely take anything your enemy can throw at you is the safest bet.
But maybe not the most entertaining one? Something I'll definitely monitor post release (but is hard to measure), how is the AI fun to play against...
Have any special values been assigned to certain systems?
There are several factors yes. The AI considers things like "is this a good chokepoint?", "is this a claim?" and "is this fleet more of a distraction than a real danger?".
Additionally, which AI module controls claims decisions? The military one? Does it also use this scoring system?
They both use a scoring system but it's not the same one. A system may be important to take to win the war, but not so much as a conquest goal.
Would the team consider adding these AI values (simplified like a 4500 score system could have "✦45" next to it in war) to the normal UI for humans?
This is a thought that has been running in my head for quite some time. For example on EU4 there's a mapmode hidden somewhere that tells you which provinces each nation wants (even if not how much/why it wants it) but it's not super usable. If we can figure out a good UX design for it... maybe? ;)
Also, how do AIs value neutral systems (e.g. Sanctuary, or marauder systems or systems filled with space amoeba etc) - they leave them undisturbed well into the late 2200s sometimes. Would there be some special evaluation to attack those too? (as they're neutral I assume usual wartime calculations don't apply?)
Funny you ask, this was a bug in the beta that we fixed. The ignored systems outside of its borders and the enemies (if at war), which made it super shy and unwilling to disturb even the smallest spaceborn alien next door. Even the Priki-ti-ki could not hurt them (unless a military objective made them cross the system by chance).
 
If I understood correctly, the AI should be able to use the market in cases where it is hit with a deficit it needs to fix. Does it realize when a deficit is caused by a loss of pops working on it, rather than a lack of buildings or districts and it needs to either shuffle pops around or just weather the storm? For example, if an ecumenopolis constructs a new districts and 10 clerks disappear, leaving it with badly lacking amenities and trade value, does it realize that it doesn't need to construct anything new, but instead that it needs to get some new pops working there?
Unfortunately not, it doesn't really know why there is a deficit, only that there is. This is another one of those things that we humans are so good at understanding because we can make that logical "leap" and figure out what went wrong. The AI needs numbers and in this case the numbers just say -50 EC / month and so it tries to fix it. But job weights should be balanced such that the AI doesn't heap ALL pops into one type of job, avoiding this extreme case in the first place.

edit: also it wont build new buildings on planets with lots of free jobs, so at least it wont add to it
 
Last edited:
Then I won't have to wait for 2.6.1 and can straight away jump into 2.6.
So technically the AI is feature complete (as of 2.6) and anything extra is tweaking values and fixing bugs. That is good to know!
Don't get me wrong, you might experience some quirks in 2.6.0. But fear not, 2.6.1 should be available quite early, possibly on same day as opt-in.
 
Thanks for the quick reply!



Would it be possible to make it consider the effect of unfulfilled pop jobs, like calculating whether the pop jobs would reach its target once fulfilled, so better resettle some pops / prioritize growth? Or would that be too costly or finicky for the AI to calculate and take into consideration?
Hmmmmmmmmmmmmm, it could probably do that, or at least try to approximate it. That's a good improvement suggestion, thank you!