• 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.

Stellaris Dev Diary #120 - New Economy System

Hello and welcome back to the Stellaris dev diaries! Today we're going to start talking about the next major update, which we have dubbed 2.2 'Le Guin' after Ursula K. Le Guin. Right now we're not ready to reveal anything about the precise nature of the update or whether it is accompanied by any DLC, other than to say that the Le Guin will have focus on trade and the economy, and that its release date is far away. Today's dev diary is going to be a bit on the foundational side, going over the new economic back-end we've implemented for 2.2.

New Economy System
The original economy system for Stellaris has always been something of a limitation for us. It's a sort of hybrid system, with resources being both scripted (and thus accessible to modders) and hard-coded (and thus inaccessible) in about equal measures. For example, under the old system ships would always cost minerals, as the code was set up for them to always cost minerals, and the only thing you could change was the amount of minerals they cost. Similarly, most things in the game that had an upkeep were hard-coded to use energy for upkeep, and again, only the amounts were able to be changed. A few things (such as for example Resettlement or the precise resources produced by a building) were more open than this, but generally the system made it quite hard to introduce new resources or change the way a particular empire might use a particular resource. The old system was also quite performance-intensive.

When we decided that we wanted to make the next major update be about the economy, the first thing we knew that we needed to do was to rewrite this system entirely. For the new system, we set out a number of goals:
1: The new system should make it easy to add new resources and swap the way resources are used
2: The new system should be as open to modding as we possibly could make it
3: The new system should improve performance

From this, we've created a new system that we call Economic Templates. Where previously there would be a jumble of different systems for how cost, production and maintenance of the different features in the game would work, there is now one unified system. Any single object in the game that can be owned by an empire and have an impact on the economy is called an Economic Unit. In the database files, an Economic Unit looks like this:

Code:
resources = {
    category = armies
 
    # Normal empires pay for armies with minerals
    cost = {
        trigger = {
            owner = { is_hive_empire = no }
        } 
        minerals = 100
    }
 
    # Hive Minds pay for armies partially with food
    cost = {
        trigger = {
            owner = { is_hive_empire = yes }
        }     
        minerals = 50
        food = 50
    }     

    # If Barbaric Despoilers, produce Energy while on enemy planets
    produces = {
        trigger = {
            owner = { has_valid_civic = civic_barbaric_despoilers }
            planet = { owner = { is_at_war_with = root.owner } }
        }
        energy = 3
    }     
 
    # Normal empires pay army upkeep with energy
    upkeep = {
        trigger = {
            owner = { is_hive_empire = no }
        }     
        energy = 1
    }
 
    # Hive Minds pay army upkeep with food
    upkeep = {
        trigger = {
            owner = { is_hive_empire = yes }
        }     
        food = 1
    }     
}

For those who cannot read our scripting language, this is an example I just created of how the new system can be used. It's for a regular assault army, which normally costs 100 minerals to build and has an upkeep of 1 energy, just as before. However, if your empire is a Hive Mind, the army will instead cost 50 minerals and 50 food, and costs 1 food in upkeep instead of 1 energy. Additionally, if you have the Barbaric Despoilers civic, armies that are located on enemy planets will produce 3 energy/month, paying for themselves and then some through wide-scale looting. This isn't an actual example from the internal build, but something I just created while writing this dev diary to show the possibilities that the new economic system opens up for for both us and modders - we could have fully biological empires that use food instead of minerals to build infrastructure, ships that produce research while in certain systems, leaders that give Unity... the possibilities are endless.
2018_08_09_1.png


Advanced Resources
With this system in place, we've been able to add several new 'advanced' resources to the game. They are as follows: Alloys, Rare Crystals, Volatile Motes and Exotic Gases. These resources are either manufactured from basic resources or found in rare planetary deposits (or both!) and are used to construct more advanced things in the game, such as ship components, megastructures, certain buildings and so on. There is also still a number of strategic resources such as Dark Matter and Living Metal that provide unique benefits, though precisely how many of these we will keep and how they are used is something we're still in the process of figuring out.

As part of these changes we're also in the process of reworking the top bar. Since we will now have rather too many resources to show them all, the top bar will now only show individual entries for resources that are important for your empire to always keep track of, with the rest shown as a consolidated entry that can be tooltiped for greater detail. Science is also consolidated into a total output of all 3 sciences, with tooltip showing the individual production of each. We're going to ensure that only relevant resources are shown individually, so most Machine Empires wouldn't have Food appear as an individual entry in the top bar, for example. We're also considering letting the player manually override this and decide which precise resources they want to keep track of within the available topbar space.

(Please note that the new topbar is nowhere near final and will have some ugly graphical issues. This is not how it will look on release)
2018_08_09_2.png


That's all for today! I know this dev diary was rather technical and perhaps primarily of interest to modders, but I felt it was important to explain the fundamental changes that have taken place in the game's back-end, both in relation to the changes coming in 2.2, and the possibilities that this opens up in the future for having empire types with radically different approaches to resource production and consumption. Next week we're going to finally start talking about the new Planetary Management system. See you then!
 
Sorry if anyone already wrote it. But can you change science icon from current tree colbs to tree old science icons clumped together. It will look more... stelarisy? And less overused, as everybody in gaming industry uses colbs!
 
tumblr_ob503txD371snosjno2_540.gif


I LOVE IIIIIIIT!! @.@

This is a lot more than I expected just from the teasers! I was already on the hype train but now someone strapped FTL engines to it and it warped off the rails!

Also I'd like to say how much I and my team appreciate the insights into the code. I know you can't do it for every feature you announce but whenever possible, it would mean a lot to us if a technical overview like this became a more regular part of Dev Diaries ^^
With feature overhauls on this scale, updating mods can be an extremely frantic and chaotic process as we usually have to reverse-engineer the new code on the day of release while everything is on fire and users are breathing down our necks and we often have little time to even properly test the new functionality in game.
But knowing relevant structure and purpose of new code in advance like this would speed up the reverse-engineering process significantly.

Regardless, we appreciate even more that you continue to open up traditionally hardcoded systems! This makes us so excited for the future possibilities and... what am I even doing still typing? There's work to be done! ≧∇≦ *runs off to the plotting board*
 
Last edited:
Very good dev diary.
I have a suggestion which I know that it sounds hard, but something very cool would be to allow us modders to create new research type ressources and why not new research trees otherwise than Physics/Society/Engineering, if such a thing is possible it would really be awesome.
 
Hmm, so maybe in the future it is possible to play a"banker" empire, which controls the resource flow of the galaxy and fuels the warmachines of it.

Buy low, sell high and gain monopoly of some resources.

I have always wanted to make an empire which is spread across enclaves throughout the galaxy, where those enclaves are placed where there are resources to monopolize.

These changes may make it more viable, but the distance penalties still hinder it a lot.
 
I jusy very much hope you do choose to make the top bar customisable in-game like the outliner is.
 
So in the next version we will have to pay multiple resource in order to build a specific ship ? Or will it reduce the costs in the same way stuff like living metal give a bonus ? :3
 
All this sounds absolutely fantastic!
 
. . .this. . .so beautiful. . . *sniff*

If the new resources were the only new thing in the next patch, I would be jumping with joy. In fact, I hope that is the only thing in the next patch because if abstract planets. . .thing is implemented I might die from the shock of awesome.

Both of those things will go a LONG way to help with my personal mod.
 
I know it might be tough but please consider keeping in strategic resources. with the new economic system they might be able to find a nice spot in both it and the war/political areas of Stellaris. as nations move to try and gain control of assets that allow them to tip the balance in their favor.
 
K, so, let's say that you find and secure a source of some limited (but still somewhat available) resource, call it 'Rare Pollen Extract' or RPE for short. Let's say that this RPE has an effect on your empire's production of X resource (as they are adding new things that they haven't named, we will call it X for now). Let's say that your RPE source has 14 units in it available for use. That the RPE increases the production of X by 1% per Unit up to a maximum of 5 Units (for total of 5% overall increase) and that you can stipulate how much of the RPE that you want to use to increase your X output (although you will ALWAYS use one Unit if it is available). The rest you can sell to others, which in this case, you could sell up to 13 of the RPE units to others (because you need some or more of something that someone else has)...



Definitely has potential...
 
I really like the idea of advanced resources and I totally see the need for them: The industry needed to produce them would be something what separates developed worlds from raw material producing colonies.
 
My God. It's beautiful.

Stellaris over the last two years has gone from "decent 4X game" to "quite good Grand Strategy/4X game" to "very good Grand Strategy/4X game" and now that I've seen bits and pieces of the economy and population overhauls I think it's genuinely edging its way into "the definitive, top-of-the-genre space strategy game" territory.

Honestly, well done, Stellaris team. You guys have clearly sat down and thought long and hard about what this game should be and what it needs to get there. Good job.
 
My God. It's beautiful.

Stellaris over the last two years has gone from "decent 4X game" to "quite good Grand Strategy/4X game" to "very good Grand Strategy/4X game" and now that I've seen bits and pieces of the economy and population overhauls I think it's genuinely edging its way into "the definitive, top-of-the-genre space strategy game" territory.

Honestly, well done, Stellaris team. You guys have clearly sat down and thought long and hard about what this game should be and what it needs to get there. Good job.
And in two Years is Stellaris the best 4 X/Grand Startegy Game ever made. :)
 
Yeah. More on this in future DDs.

Fantastic. I've been hoping for unique resources to actually affect your empire and not just be a bland bonus to something. I want Lythuric Gas to revolutioniza farming for the whole empire! Or maybe give a unique support module to your ships that your enemies will actually have to take into account if they want to go to war. Stellaris is still feeling very raw in that it doesn't really make empires distinct enough (unless you play a handicap facction like despoilers or purifiers) I'm still hoping for the Lensman patch where I can shoot planets at light speed at my enemies. :)