• 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!
 
@Guraan I'm so glad to hear this. I think if you guys have time you should put such functionality in. But as long as I can play Ironman with a mod of it I'll be more than happy!

I feel like sometimes this game hides a lot of things inside menu's but it's looking really adjustable recently.
 
I'm positively impressed by how far you guys are willing to go, rewriting whole swathes of the base game's code as part of basically free patches. It's amazing to watch Stellaris grow like this, even though this dev diary basically sealed the deal that I will suffer from Stellaris withdrawal for a couple months now...
 
This is... woah. What kind of passion for making a better game does it take to go for such radical changes this far in development cycle? First Apocalypse, and now this?! I don't think i've seen other companies go this far.

Really intrigued in where this update will end up when it gets done :)
 
Seeing all this, maybe "food" should be renamed as it seems to have a different and broader meaning (including crops and animals but also hive minds biological production, and probably many other things). Maybe "Biological resources" or something similar. I don't know what are the future ideas that you are considering for "food", but it could have many possibilities.
 
Seeing all this, maybe "food" should be renamed as it seems to have a different and broader meaning (including crops and animals but also hive minds biological production, and probably many other things). Maybe "Biological resources" or something similar. I don't know what are the future ideas that you are considering for "food", but it could have many possibilities.

How about Biomass.

"Biomass is the mass of living biological organisms in a given area or ecosystem at a given time."

That includes all plants, animals and microorganisms. Pretty much all organic life.

For devouring swarms that would also include all sentient species found on a planet as well.
 
Last edited:
Is the new system a risk for mods of being incompatible of each other because the file is edited? Or is it like a tag system for the single things, so that a mod can change the normal army, and another edit the clone troops?
Btw, can we have a better mod list with load order, search bar, sorting, maybe with a list of collections with single click for easier multiplayer games? I hate it when I have to change my modlist 1/2 h.
 
Great work! I am really looking forward to it. Meanwhile I bought all the dlcs, and even the second copy of the game, to support the devs, while they got tons of negative replies on steam, cause people disliked the hyperlane system. :(

Regardless I have two questions, will it ever be a thing, that if your empire is cutted in two (after a war for example), your pool of resources will be somehow separated? Or maybe we get the "trade ships", destroying which, would mean lossage of resources?

And this has been already asked, but I wanted to express my own interest in having the barbaric despoilers with special raiding mechanics. I already tried to post a thread upon how unpopular they currently are. If you tried to google them, you would find maybe like one or two posts, with few comments. This makes very hard for new players to google things about what the barbaric despoilers thing is and what it gives. I also understand, that not all the civics are meant to be "balanced in means of warfare", but since barbaric despilers is a warfare civic, i feel like it should a be a decent pick for warmongering empires. Giving raiding armies some energy surplus is a neat option, but since battles last so short, even fortress world raiding would give few resources with +3 (i know that those are just examples). So unless we get some longer ground battles, I would prefer to see some raiding loot from bombardment as well. :D


In the current version barbaric despoilers are great at war for a civic that does not start with total war.
You can stack authoritarian, caste system and adaptability without the need for pacifism. You can swim in minerals while getting a huge food surplus boost to pop growth pretty early. The civic is not weak if you leave the total war civics and maybe Rogue Servitors/Machinists out of the picture(early game snowballing is pretty good with those two).
 
I really think it's time to replace Dark Matter with something else.

It's a silly notion that will never be proven. When the actual phenomena in the standard model is found responsible for it, those who suggested dark matter are going to feel quite embarrassed.

It's still a pretty standard Sci-fi trope, so it should probably be in game. Stellaris isn't exactly the hardest of sci fi after all.

But I totally agree "dark matter" IRL this time around will probably go the same way it did last time (when it was about the orbit of mercury - someone will update the model with a groundbreaking new idea which ruins everything in the best way possible).
 
While i don't mind economic changes i must remind you, that the military AI still garbage. Also when rewriting the economy please adjust the AI as well. Right now AI has a bunch of mistakes.

1. It almost complitely neglects energy on spaceport. Planets filled with power plants, and spaceports have tons of anorchage, but it has not enough minerals to even get close to it's fleet limit. Kinda sad, and funny to see that overwhelming fleet limit, and pathetic fleet power.

2. AI often keeps fleet above it's own planet... Must be something from before 2.0 where spaceports were on planets, and fleets went to there for repair.

3. AI often forgets to repair it's ships. By often i mean like over 90% of the times.

4. AI almost always try backdoor when possible. Even if all backdoor protected by bastion spaceport, and it takes dozens of years to take, and the wort part. It could defeat me head on, if wouldn't send part of it's fleet to backdoor me.
 
In the current version barbaric despoilers are great at war for a civic that does not start with total war.
You can stack authoritarian, caste system and adaptability without the need for pacifism. You can swim in minerals while getting a huge food surplus boost to pop growth pretty early. The civic is not weak if you leave the total war civics and maybe Rogue Servitors/Machinists out of the picture(early game snowballing is pretty good with those two).

Is that damn raiding bombardment so good? I prefer just conquer the enemy, and get both their race, and their planet.
 
Is that damn raiding bombardment so good? I prefer just conquer the enemy, and get both their race, and their planet.

It seems like the main argument is nothing to do with raiding or despoliation, but the fact that you get Adaptability without being a pacifist or hive mind.

Which, to be honest, has some good stuff for conquerors in. Easy to build up that unity bonus per planet class, you get that juicy mineral per farm finisher, and you get big fat food surpluses to get a big empire growing fast.
 
This looks quite interesting. It should make Food a more valuable resource in general, and for some armies like Xenomorphs or Titans it just makes sense that they'd consume organic material rather than EC. Most notably, the examples listed for the modding potential offered by the new economic system (can we call it NES?) sound exciting.

The possibility for Strategic Resources to (in very limited amounts) accumulate over time rather than a simple yes/no, together with the rework of ship production in terms of consumed resources, could open up a lot of super-interesting possibilities for ship-building, in that there might be special weapons or modules that require a Strategic Resource to build.

I just hope that none of the Strategic Resources will be dropped; I'd rather see them expanded instead of downscaled. If there's a risk of cluttering, how about making it so that they only have a *chance* to be used for galaxy generation for the purpose of replayability, meaning that there'd be no game where all available Strategic Resources are actually collectable? And, of course, SR not collected could just be removed from the tooltip; there's no point in being reminded you have 0 Zro if the same information can be conveyed by Zro just not showing up in the ledger, unless you either have some (>0) or are at least mining it (+X).
 
Is that damn raiding bombardment so good? I prefer just conquer the enemy, and get both their race, and their planet.

It seems like the main argument is nothing to do with raiding or despoliation, but the fact that you get Adaptability without being a pacifist or hive mind.

Which, to be honest, has some good stuff for conquerors in. Easy to build up that unity bonus per planet class, you get that juicy mineral per farm finisher, and you get big fat food surpluses to get a big empire growing fast.

What GloatingSwine said. Raiding is more of a bonus thing which has only limited uses. The only good thing about the despoliation CB is that you can end such wars quick(only -25) and you will always have it on all neighbors but that is pretty situational. If you want open borders to colonize on the other side of an empire for example. But as I said that is just a bonus adaptability is the main good thing. You can even use fanatic authoritarian and adaptability. No other civic & ethos combination gets more out of slaves.
Edit: Lets put it that way. Imagine a civic which replaces diplomacy with adaptability. That is more or less what it is.
 
This isn't CK2; in Stellaris you've already got multiple CBs for unlimited conquest against everyone you could possibly want to fight. We don't need MORE.

this CB would be useable by pacifists, because economy faction. in fact I think it should even be usable if you have defensive war only policy. all it would do is force the nation to pay a specific amount of money over a specific time frame. (and maybe allow the claim of some trade ports)
 
The old system was also quite performance-intensive.
How performance-intensive was the old system? Twitter teasers reveal that you've completely redone not only the resource system, but entire economy and population - do you have any idea if the rework will have a noticeable impact on game performance, especially late game lag?
 
ATM this can be achieved with simple UI mod but who knows it might be added functionality to do it in game.
To let mods get more control over the resources in the topbar there is additional script possibilities to setup the behavior of the gui elements through name matching ex:

(single_resource_groups.txt)
Code:
...
alloys_group = {
    resources = {
        alloys
    }
    localization = {
        "RESOURCE_GROUP_DEFAULT" = default
        "RESOURCE_GROUP_DEFAULT_NEG" = { balance < 0 }
        "RESOURCE_GROUP_DEFAULT_MAX" = { stored >= max }
    }
    onclick = government
}
...

(research_resource_groups.txt)
Code:
research_group = {
   resources = {
       physics_research
       society_research
       engineering_research
   }
   localization = {
       "RESOURCE_GROUP_RESEARCH" = default
   }
   onclick = technology
}

(main.gui)
Code:
...
containerWindowType = {
    name = "alloys_group"
    background = { ... }
    ...
    instantTextBoxType={
        name = "amount"
        ...
    }
}
...
dropDownBoxType = {
    name = "research_group"
    ....

    instantTextBoxType={
        name = "amount"
        ...
    }
    expandedWindow = {
        ...
        gridBoxType = {
            name = "resources"
            ...
        }
    }
}
...

Is it possible to do mathematics operations on the values?

The use case for me is for Unity - i am totally not interested how much raw unity I make per month, because how much 10k of unity is worth varies vastly depending on whatever i am playing tall or wide. I would much more prefer to see some normalized value, e.g. how much % per month my empire makes till the next tradition unlock. So I would need be able to do something like this: value = monthly_increase/cost_of_next_tradition point*100
 
Is it possible to do mathematics operations on the values?

The use case for me is for Unity - i am totally not interested how much raw unity I make per month, because how much 10k of unity is worth varies vastly depending on whatever i am playing tall or wide. I would much more prefer to see some normalized value, e.g. how much % per month my empire makes till the next tradition unlock. So I would need be able to do something like this: value = monthly_increase/cost_of_next_tradition point*100
No there is currently no support for modifying the value itself more than what you can do with the format in the localization files.
I might have some spare time somewhere that i can use to investigate.
 
I guess my point is that there SHOULD NOT BE an alternative to war. Wars of necessity should be a thing and missing resources is a good way to force them.
Why?

It is not hard to make a system where wars will be the best way to gain these resources, as you can deal with this by giving them a price. Is it better to constantly have to trade for a resource, or gain them through an one-time investment that also grants other benefits. A warmonger could move towards monopolizing resources and then reap the trade benefits alone, or stop trading and keep them to themselves.

It makes diplomatic empires much more fun without worsening the enjoyment in the conqueror playstyle. It actually makes warfare better since you can't count on every less aggressive empire being a total pushover. If they include embargoes now or in the future, that could be a dynamic deterrent to the conqueror as well, utilizing the trade system. Wars of necessity could still be a thing regardless. It isn't exactly convenient to constantly pay for a resource you need, from a potentially unreliable source. Especially if you actually go to war and make enemies of those who would be willing to sell. That is not even mentioning purifier-types who cannot trade to begin with.

If we go by reality it makes a lot of sense to make resources available in other ways than conquest. Very few nations actually go to war for every resource they need. I just hope the system lives up to my hopes.
 
Well, while I'm reluctant to leverage the pro-tiler's argument of "Without tile micro there's nothing to do in the game!", I think that "Without war there's nothing to do in the game!" has kind of a better philosophical grounding for this strategy sci-fi war game.
I guess my point is that there SHOULD NOT BE an alternative to war. Wars of necessity should be a thing and missing resources is a good way to force them.

I'm going to point to the ethics wheel for a moment and note the shiny little pacifism option.
Straight up "Never go to war, ever, under any circumstances" is stated to be a valid thing to do before you ever actually play the game.

So yeah, as long as pacifism is an ethic. War CAN NOT BE required or without alternatives.