• 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!
 
Oh my lord I can't wait to be able to play a fully biological devouring swarm that makes ships, infrastructures, and more out of the corpses of my enemies.
1) Make custom Determined Exterminators who's titans cost food and they Consume Purge organics
2) Play as Turians
3) Dismiss all your claims
4) ???
5) PROFIT
 
Yeah, this wouldn't even be hard to do now.

does the code currently allow for pops not requiring resources to grow? such as plants that actually use the air primarily to grow? (ultimately making them not have any way to boost their growth either)
 
I know they were a horrible clickfest, but I loved them anyway.

Presses "F" to pay respect.
S
The market will ensure that it's always possible to get your hands on fundamental resources that you need for things like ship building, though it might end up quite expensive. More on that in another DD though.
This is bad. If you can just camp in your bubble and still access all the resources you need, why would you go on an expansionist war ever, other than RP?

This is a recurring big problem with Stellaris: I have no strategic reason to go to war with anyone, aside from the vague Fully General Instrumental Convergance reasons of "Enemy intelligences can't oppose me if they're dead" and "Adding another +30 minerals / month to the pile is good".

Critically requisite un-tradeable resources have the opportunity to fix this problem (and simultaneously fix the independent problem of 95% of star systems being strategically indistinguishable from one another) by making strat-resource-mining systems a target for everyone.

So I urge you to reconsider.
 
I think it's available governors/politicians. None of the new planet screens we've seen have a governor but we have seen that palaces generate a new crown resource. I think we have to grow new leaders by employing ruling class pops and trade routes are grown by employing clerks with the new blue credits resource.

whatever it is, it's apparently more of direct focus than your core world count... (given it;s relative location)
 
This is a recurring big problem with Stellaris: I have no strategic reason to go to war with anyone, aside from the vague Fully General Instrumental Convergance reasons of "Enemy intelligences can't oppose me if they're dead" and "Adding another +30 minerals / month to the pile is good".

so... uh, those appear to be strategic reasons to me... basically any resource i own can;t be used against me.

i assume however, you mean you want situations where germany tries to dive headfirst into russia to get an oil supply, so i think you should clarify that there's never a specific location of space you would set your eyes on, for a specific use or advantage.

---

personally I hope the economy AI takes advantage of high market prices and will try to build more of that resource just to sell it, allowing for actual economic dependencies between nations. the AI could run a food deficit and cover it with the market now and not be completely an idiot for doing so. this would even allow you to leverage other countries as well.

If countries can gain debt and that debt can be bought and sold, i'd love it. you'd be able to absolutely destroy a nation's buying power if you own their debt and they're not paying their interest. maybe even get a free casus belli for them to repay their debt. also, allows for countries to go 'bankrupt' to get out of debt but allowing for a casus belli from all debtors.
 
S

This is bad. If you can just camp in your bubble and still access all the resources you need, why would you go on an expansionist war ever, other than RP?

This is a recurring big problem with Stellaris: I have no strategic reason to go to war with anyone, aside from the vague Fully General Instrumental Convergance reasons of "Enemy intelligences can't oppose me if they're dead" and "Adding another +30 minerals / month to the pile is good".

Critically requisite un-tradeable resources have the opportunity to fix this problem (and simultaneously fix the independent problem of 95% of star systems being strategically indistinguishable from one another) by making strat-resource-mining systems a target for everyone.

So I urge you to reconsider.

I'm comfortable with it because of the line "though it might end up quite expensive."

Done wrong, you're completely right. It just becomes a spamfest end-run around scarcity and drivers of conflict.

However if the market requires real gameplay, for example if it depends on wealth, diplomacy, trade routes and relationships, it could be a fantastic alternative to straight expansion. The answer to your question (in this case) would be "because it's not easy to rely on the market." An empire built around trade and diplomacy can do so, so they will finally have an alternative to war. An empire that doesn't play the economic and diplomatic game well, they'll still need their fleets.

At least hopefully.
 
i would never willingly put myself in a state of economic dependence in a game where your trading partners could get genocided by maniacal robots or eaten by extragalactic bugs or simply conquered by a species that considers trade a four-letter word
 
If countries can gain debt and that debt can be bought and sold, i'd love it. you'd be able to absolutely destroy a nation's buying power if you own their debt and they're not paying their interest. maybe even get a free casus belli for them to repay their debt.
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.
so... uh, those appear to be strategic reasons to me... basically any resource i own can;t be used against me.
i assume however, you mean you want situations where germany tries to dive headfirst into russia to get an oil supply, so i think you should clarify that there's never a specific location of space you would set your eyes on, for a specific use or advantage.
I assumed this was obvious, given that my complaint was on the Fully General nature of it all, but fair enough. You assess my complaint accurately.
I'm comfortable with it because of the line "though it might end up quite expensive."

Done wrong, you're completely right. It just becomes a spamfest end-run around scarcity and drivers of conflict.

However if the market requires real gameplay, for example if it depends on wealth, diplomacy, trade routes and relationships, it could be a fantastic alternative to straight expansion. The answer to your question (in this case) would be "because it's not easy to rely on the market." An empire built around trade and diplomacy can do so, so they will finally have an alternative to war.
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.
 
Last edited:
I assumed this was obvious, given that my complaint was on the Fully General nature of it all, but fair enough. You assess my complaint accurately.

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 think I mostly agree with you. Stellaris seems to have found its niche as a war game. Imho that's what it does best, and the design should lean into that. Further in this, as in all 4x games, the map absolutely should be a driver of conflict and resource scarcity is a very good way to do that.

Still... I'm not convinced this has to be a universal solution for two reasons.

First, for many (if not most) players on the board, war will remain the answer to resource scarcity. So the trading nations will still be forced into conflict by aggressors. Ideally, they will also be forced into conflict by having to plan for and around those aggressors, since ignoring a threat until it attacks is a good way to lose.

Second, the marketplace won't necessarily be an answer to all drivers of conflict. Again this is all predicated on the assumption that the mechanic works well, but even a trading empire may still struggle to secure enough of a given resource. What's more, there can be drivers of conflict beyond resource scarcity (map size, crises, fallen empires and the horde, etc.). By allowing empire types beyond expansionist conquerers, the game allows for different play styles that can respond to other mechanics that force conflict between players.

Stellaris does need to continue working on these other drivers of conflict, certainly, and once again I agree that resource scarcity is a classic for a reason. It just might not necessarily be a problem to let some players have an alternative solution. IF done well, of course.
 
Stellaris does need to continue working on these other drivers of conflict, certainly, and once again I agree that resource scarcity is a classic for a reason. It just might not necessarily be a problem to let some players have an alternative solution. IF done well, of course.
The IF is indeed a panacea to all things.
It's just I don't think I've ever played a strategy game where the marketplace didn't become a permanent, always-playable get-out-of-jail-free card for every empire except the MegaGenocide Hatemongers. Hence my skepticism.
 
The IF is indeed a panacea to all things.
It's just I don't think I've ever played a strategy game where the marketplace didn't become a permanent, always-playable get-out-of-jail-free card for every empire except the MegaGenocide Hatemongers. Hence my skepticism.

Or completely gimped, like the previously mentioned ES2 example.

My hope is that the marketplace is tied in to diplomacy for this reason. While it would take some thinking, I can see a situation where the resources available are based on the wealth of the empires on the board and the prices you pay are based on your relationships with those empires. The more friend you have and the wealthier they are, the better the marketplace works for you. In this case, a United Federation of Planets could grow rich without needing to take anyone's stuff. Meanwhile the Dominion, hated by all, would have no choice but to warm up the disruptors.

I think here we can discuss the all-important "if" because it can theoretically be done well. Certainly we'll wait and see if it is (my many rants on star lanes will show that I'm not shy about pointing out when I think development has missed the mark), but I don't think it's an unrealistic concept.
 
Last edited:
Cheers for the DD Wiz, and sounds great :D. More resources, better modding support and a focus on the economy and trade for the next expansion sound like a great thing for Stellaris - great work (to you and the rest of the team) on doing what you've had to do to lay the foundation, look forward to seeing what you've come/will come up with :).
 
Seeing as how we're overhauling the economic system, can we expect a diplomacy overhaul as well?

I want to be able to sow the seeds of civil conflict.

Or sell a piece of plastic as an artifact of great power to spiritualists.
 
@Wiz What do you think about having extra research from finished technologies and completed special projects overflow into an empire's stored research? It bothers me whenever I see the majority of the month's output going to waste. A while back I looked into trying to mod it in but couldn't see an easy way to do it.
 
If it’s moveable in game, thought, it might just be an adjustment I could make at each beginning of the game...

@Wiz If we have a big screen and more UI real estate will we be able to fill up the top bar with single resources?

I really can't stand hiding things behind tool tips when my version of stellaris has two more whole resource bars worth of blank space to fill.
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"
            ...
        }
    }
}
...
 
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