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:
- Always work on AI-related topics, regardless of what else is going on
- Move the AI towards being challenging to players in an entertaining way, rather than be optimized to min-max its way to victory
- Move the AI towards being more distinctive, so that not all empires feel strong in the same way
- Support future DLCs from the get-go
- Constantly make small improvements to the AI
- React quicker to player feedback
- 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.
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:
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.
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.
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.
Further down we activate the plans for prioritizing research and all the higher-level resources
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:
Apart from this, there were some small, but significant code changes that helped the AI in running the show.
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.
EDIT: Fixed cropping on a few images.
- None Found
More about StellarisPost: "Stellaris Dev Diary #227 – Looking after the AI" specifically for the game Stellaris. Other useful information about this game:
- Truces desperately need to be reworked. 10-year long forced open borders is WAY too long.
- After 50 hours and 2 failed attempts, I have finished a campaign. I’m addicted now.
- System Control: a feature suggestion
- Stellaris, galactic geography and biomes, more exciting mid-game experiences, and the galactic core.
- [Preview] Project “DeadSpace”