Stellaris

Stellaris Dev Diary #227 – Looking after the AI

Originally Posted here

Only Dev Replies

written by Guido

https://preview.redd.it/1icbm89001s71.jpg?width=215&format=pjpg&auto=webp&s=3c73bae005b88e533fadd1ad06ac4632b91d82e5

Hello and welcome to a new Dev Diary,

My name is Guido and today I’m here in my role as a Principal Designer on Stellaris to talk about AI in a bit more detail.

You probably have heard about the Custodian Initiative by now which has been created to keep improving the game on a more regular basis and in order to be quicker when reacting to player feedback. A part of this initiative is also to put some more love and attention to the AI of the game going forward – an AI initiative inside the Custodians, basically.

For this, we have set some goals for ourselves going forward:

  1. Always work on AI-related topics, regardless of what else is going on
  2. Move the AI towards being challenging to players in an entertaining way, rather than be optimized to min-max its way to victory
  3. Move the AI towards being more distinctive, so that not all empires feel strong in the same way
  4. Support future DLCs from the get-go
  5. Constantly make small improvements to the AI
  6. React quicker to player feedback
  7. Occasionally make a push for more significant improvements

Speaking of which, for the upcoming patch in November, we have some significant updates in store.

Economic Script Update

First of all, the biggest change you will notice is how we have changed the economic plans script. This script is the core of the economic behavior of our empires. It defines what resources they strive to get when building districts and buildings. How much population growth they should go for and how much research and unity they want.

The functionality of the script hasn’t changed much, but how we are using it has changed.

Previously the script was divided into early-, mid-and late-game. Depending on the phase of the game, empires would prioritize resources differently. For example, focus on research was lower in the early game than in the later stages of the game. However, this approach didn’t take into account the various situations an empire can find itself in. Especially after a war or when a new empire breaks off an existing one. In those cases, even if the game phase was in the late game, for the respective empires it meant that they were in a much more ‘early game’ position.

https://preview.redd.it/fm4kcks701s71.jpg?width=410&format=pjpg&auto=webp&s=aa023db83b8d813ae94c8aef0d3307d3d8fce23d

https://preview.redd.it/3byomv3801s71.jpg?width=455&format=pjpg&auto=webp&s=666a0c1281410bc6e9d6e2b33f3e503c8f0e35ec

Instead of having 3 different economic plans, we feature 1 base plan instead. In order to get more flexibility and to react to the empire’s situation, we’re relying much more on the ‘subplans’ inside that base plan.

Improved economic subplans

Subplans can be turned on or off, depending on the situation the empire finds itself in. Our main rationale was to ensure that an empire would be economically stable before it spends resources on ‘bonus’ things like research, population growth, defensive modules on starbases, and unity buildings.

Previously those things were prioritized too early and without enough respect to the basic income of energy and minerals, leading to empires that produced alloys, but had big deficits in energy and mineral production. And this deficit would be the start of an economic death spiral, where the resource debuffs would further reduce production and everything just escalated to the point where an empire was bankrupt on all resources. This became especially problematic after the economic system has been rebalanced to focus resource production more on the districts, rather than the buildings of a planet.

Here’s an example of what the economic situation generally looked for empires in a game that went on for around 80 years:

These are screenshots from Stellaris version 3.0.3

Our updated economic script prioritizes basic income first and takes the new economic rebalance into account. Energy and minerals are most important.

The difference between the ‘income’ and ‘focus’ block is that if the monthly income is below what is defined in the ‘focus’ block – districts and buildings which produce those resources get an extra bonus in weight, when deciding what to build.

https://preview.redd.it/a18joln271s71.jpg?width=207&format=pjpg&auto=webp&s=8731709ac5185f2c5a73d6be18aa91e3eaef3281

Then the first subplan kicks in. If a country uses food (therefore, Machine empires will have this subplan turned off) it will prioritize food production.

https://preview.redd.it/r4f6p84471s71.jpg?width=321&format=pjpg&auto=webp&s=868c9df3f8382c0e04325d06c144adeca8b00ac9

The next subplan will check conditions for focusing on consumer goods. Again, checking if the empire actually uses them or not – and then only focus on producing them if the empire has at least a monthly income of minerals of 30.

Based on the fact that in order to create consumer goods you require minerals.

https://preview.redd.it/jn63zbz471s71.jpg?width=703&format=pjpg&auto=webp&s=ecbf6f77cd3b7968c46f89fef8b0a176e6c136e7

Further down we activate the plans for prioritizing research and all the higher-level resources

https://preview.redd.it/mk75fp7f01s71.jpg?width=737&format=pjpg&auto=webp&s=940c104937dd9f90879e38b426dd50fb2abcc167

Resulting behavior improvements

So, the script can check for various situations in AI empires – from the fact if they are a Gestalt Empire, using food to monthly income of specific resources.

This gives the AI a lot more flexibility in managing its economy.

As an example, here we have a 100-year old Galaxy with 13 AIs and every empire is able to manage its economy in a decent enough way. Notice the resource tab at the top – almost all empires have positive income in all resources; the ones with a negative income only have a small deficit:

https://i.redd.it/9t76xoih01s71.gif

Apart from this, there were some small, but significant code changes that helped the AI in running the show.

Conclusion

The code for the AI has been optimized heavily in the past in order to improve performance a lot. However, this has led to some unforeseen and unintended behaviors which have now been corrected. Some of the districts and buildings weren’t considered at all and city districts were weighted way too high. The AI is also now able to build temples and holo theaters, for example.

Finally, the AI has also been given a bit of support in how it will set up its starbases, especially in conjunction with the hydroponics starbase building, which can play a larger role in how you provide food for your empire. The AIs can now use more varied setups when building their starbases, making use of Curator Think Tanks, Nebula Refineries, and other special buildings where it makes sense.

And all of this was built on the foundation of the last major rework of the economic AI, so kudos to @sidestep for making this evolutionary step possible.

With your help, we’re looking forward to giving the AI the attention it deserves and making it even better in the future.

Cheers,

Guido

EDIT: Fixed cropping on a few images.

Source

Similar Guides

    None Found


More about Stellaris

Post: "Stellaris Dev Diary #227 – Looking after the AI" specifically for the game Stellaris. Other useful information about this game:





Top 20 NEW Medieval Games of 2021

Swords, dragons, knights, castles - if you love any of this stuff, you might like these games throughout 2021.



10 NEW Shooter Games of 2021 With Over The Top Action

We've been keeping our eye on these crazy action oriented first and third person shooter games releasing this year. What's on your personal list? Let us know!



Top 10 NEW Survival Games of 2021

Survival video games are still going strong in 2021. Here's everything to look forward to on PC, PS5, Xbox Series X, Nintendo Switch, and beyond.



You Might Also Like

Leave a Reply

Your email address will not be published. Required fields are marked *