To tame an AI

A lot of the work we have been doing on STNH since the release of 2.2. has been focused on trying to get the AI to perform as it should – and specifically, to be as aggressive, difficult and challenging as we want it to be.

There is a lot that can be said on the subject in general, but for the most part, it has little to do with the focus of the last few blog posts. I still want to continue talking about our upcoming economic changes, but as some of them are driven by AI considerations, I feel I need to go into some details here as well.

In the last three years, we received thousands of suggestions on how to improve STNH. Many of them had been interesting, but we had to decline because it is simply not possible to make them work properly in the Clausewitz engine. In other cases, the issue was the AI – we know there is simply no way for the AI to properly use the suggested feature, gimping it and giving the player an advantage.

For example, when discussing the economic overhaul with another member of the team, he suggested a superb idea – to have different types of economies gated behind ‘living standards’. Empires like the Cardassian could be labor-intensive, their buildings requiring a lot of pops but capable of massive production of crew and alloys, while others like the Federation will be fairly automatic, less reliant on pops, limited only by their access to energy.

It was a really great suggestion and far more detailed than I just outlaid here. But in the end, I knew we can’t possibly hope to include this overhaul. The AI will simply never ‘understand’ it.

In the first month after releasing the Great Material Continuum, our AI greatly underperformed, even on the highest difficulty levels. This has not gone unnoticed by our dedicated players. Many of those players thought the issue was that STNH was simply ‘too complex’ for the AI, or that the AI simply couldn’t obtain the new strategic resources needed to build ships, such as Dilithium or Magnesite.

Those players will probably be surprised to know that the Stellaris 2.2 AI not only does not have any problems with STNH economic changes or resources, but it even performed better than before. For example, see how, for the first time, the STNH AI expands properly as the Suliban or Hirogen. This was simply not the case before – where we were lucky if the AI ever built a single habitat. Previously, the AI simply couldn’t ‘understand’ it needed to build habitats to expand as a nomadic species.

The STNH AI also has no significant shortage of resources and no death spirals. The poor ship construction problem, in the end, stemmed from issues that had nothing to do with our economic changes. From all regards, the economic AI performs adequately (which is NOT to say that there is no more a lot of fine-tuning work we have to do).

As we have to adapt STNH to the AI, the key thing is to understand is that you can not expect the AI to make any intelligent decisions. Obvious jokes about strategic-games AI aside… when working on a mod, without ANY access to the code or ability to program AI behavior (which no mod has, not even Glavius’s wonderful work), we have to work in the constraints of the existing system.

So the above suggestion, from the other team member, will simply not work because we will never be able to get the AI to understand to make the CHOICE between the various economic paradigms and to know when to switch.

Of course, we do want choices in STNH. We want interesting decisions between, for example, different types of shields or weapons. We want those to matter and to reward careful planning.

But you can’t expect the AI to know what they are doing, so all the decisions have to be equivalent in value and strength. So the AI can randomly focus on covariant shields or regenerative shields, and while the player does have the edge of being able to see the pattern and react to it, the AI won’t be gimped if they selected A over B. Both are still good in different cases.

A way to mitigate issues is to streamline. That’s the reason megastructures now cost neutronium instead of alloys. Having strategic resources be used for only one specific goal ensures the AI handles it properly – it knows (sort of) on what to spend it, it knows when it needs to increase it, and not to go into deficit.

Most importantly, we need to ensure the core experience is as accessible as possible. Ship construction is a key part of what the AI does, which is why Dilithium, which is required for all ships, can be obtained in so many different ways, ensuring the AI never gets ‘stuck’.

Taking all of this into consideration, it led to one of the core tenants and principles of the upcoming economic overhaul: it must keep the core gameplay as accessible and similar to vanilla as possible. The AI or player should always be able to mass-spam alloy factories or farms or power plants, for example. It must always be able to build ships or upgrade them.
Any interesting decisions, mechanics, resources or layers we add on top must be optional, giving the players flexibility and bonuses but not unlocking key features or options.

This leads us into the new planet specialization mechanics that I hope to start introducing in the next few blog posts.

I like science. – Lieutenant Spock

Scroll to Top