• 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, don't get me wrong. The tile system as it is right now isn't sustainable. I just wished for reform rather than revolution. I'd wish they would have tried to reduce the number of tiles by at last half, and then add more reactivity to the system. For one I used to dream about a rework where armies were placed on tiles - adding an entirely new dimension to planetary combat.
 
Does this mean species groups like plantoid and fungoid will have different resource requirements for some of their units? Would be cool if plantoids were less reliant on food and required more energy (ie special indoor lighting for photosynthesis).
 
Does this mean species groups like plantoid and fungoid will have different resource requirements for some of their units? Would be cool if plantoids were less reliant on food and required more energy (ie special indoor lighting for photosynthesis).
I'd rather that be a trait.

I mean there are animals that perform photosynthesis by a few methods (seaslugs that actually can manage it themselves like plants, coral that have symbiotic bacteria) also there are plants that don't get the majority of their food from photosynthesis.
 
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.

I really hope that the market allows you to trade any resource for any other resource, but the exchange rate is dynamic so you can't just spam the same trade over and over again. I think the Cossacks games did this very well.
 
I really hope that the market allows you to trade any resource for any other resource, but the exchange rate is dynamic so you can't just spam the same trade over and over again. I think the Cossacks games did this very well.

While, almost in contrast, hopefully at the same time those exchange rates allow you to buy meaningful amounts of any given resource.

I feel like it has to be a balance... you don't want it to be easy to just spam the same trade. On the other hand, someone mentioned ES2's marketplace, and in that you can't ever afford to buy enough of anything. Prices go up so fast that it never works as a reasonable substitute for any given product.
 
I'm so happy tiles are going away. Not only did they lead to clicker tedium, but also limited design space in my opinion. I've frankly never liked the abstraction of planets/planetoids as tiles, as it usually adds an annoying mini game that I don't like to bother with in a 4x game.
 
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 endeavor to make this dynamic enough that those of us with bigger monitors than the minimum supported aren't left with tons of unused space and still needing tool tips and dropdowns all the time. That's arguably the single worst bit of Stellaris UI right now.
 
Yeah, this wouldn't even be hard to do now.
Any chance a non-carbon based species might prefer other planet types, like molten worlds or specific types of toxic worlds?
 
Hell yeah!!!
With this, we will be able to completely detach Food from population growth, so excess Minerals or Energy will boost it for true Lithovores or Electrovores!
Or rework it more to allow for true Autotrophs!
Ahhhhhhhh so Excited!
 
I'm surprised no one has mentioned this yet. What's with the 2nd energy icon?
Nobody mentioned it because it's prima facie obvious that it's a Civ-V-style trade route?

And the pop icon as well... why is the number there a fraction?
Now that's an interesting question without a prima facie answer. I'm gonna go for slaves. There was certainly mention of new slave market mechanics some time ago. Bet it's that.
 
@Wiz WIZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ you and the boys are magical. Like the little Keebler elves and my brain is the tree they all live in. <3. Next step, strategic resource combos affect what kind of weapon research and weapon modules you can build to have specialized weapons and shields and armor. e.g. Hard point shields (yellow), comboing some gas and crystal, effective against missile weapons vs. Pulse shields (red), comboing some gas and crystal (betharian stone showing higher energy output/cost) more effective against lasers, giving more depth to planning war and role play.

The possibilities are endless. When the Stellaris dev team comes back and @Wiz showcases what the fam is cookin up.

Martin is a generous God.jpg
 
Now that's an interesting question without a prima facie answer. I'm gonna go for slaves. There was certainly mention of new slave market mechanics some time ago. Bet it's that.
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.
 
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.
Yeah, leaders, that's not a bad shout. I'm frequently running fewer leaders than I could be simply because I can't keep up with all the death notifications or technologically-expanded pool sizes. Having it on the top bar makes sense.
 
All looking good. I'm already thinking up some ideas for how I can make our various prescripted nations even more unique. This will absolutely help in that regard!! :D

Looks like I'd better start making some new resource icons!! :eek:
 
Interesting.

This has probably been covered before, but what if you want to produce a unique individual unit- say an army that has a unity upkeep. Are you going to have to create a file that defines the upkeep and build costs of every single army in the game in order to create this one, or can you just define a new resources category for it and it alone?