Logo

A space themed grand strategy with emphasis on economy, society, and politics

18 February 2026

More economic developments

by EhWhoAmI

Now that the space side is in a good spot for now, I will be talking about the economy. It has been a while since we’ve talked about the economy, and I think it’s time that we get back into the flow.

The goal of an economy is to be able to distribute limited resources efficiently across varying supply and demands. It reacts to changes in supply and demand by adding or reducing production or consumption, and tries to give an even input and output.

We have previously mentioned about our S/D ratio, and how it determines price by multiplying it by some factor based off this S/D ratio.

Prices have been reformed that the maximum and minimum price of a certain good is bounded. This makes the economy a little more stable as dynamic prices could lead prices to explode too much. Currently, we have a massive deficit with the way goods are being produced and consumed. I define this deficit as the sum of the total volume of goods sold subtracted by the sum of the total volume of goods purchased. In essence, this helps us compute the amount of money created or disappeared into thin air.

This amount is not insignificant, and could lead to inflation or deflation. The cumulative sum of this should be approximately zero, but for now, it remains increasing. There are a few potential solutions that I am brainstorming, such as being more aggressive with increasing or reducing demand based off the supply-demand ratio.

I am still looking into putting floating prices back, if we can get a good inflation mechanic and finance mechanics.

On the production and consumption side, factories are now capable of increasing and reducing their production based off the profit that they make. Factories have an in built wallet that they use to take in their profits, and use that as a factor to determine whether or not to increase the size of their factories. However, right now, factories tend to hoard their money, which if put back into the economy, will likely make up for a significant amount of the deficit that we are seeing right now. I will need to add behavior to make factories give back their dividends and spend it back.

Factories have a few important values, but right now, the most important value is the size and utilization values. The size of a factory represents the actual production lines that it has, and the utilization represents the current production of one. A factory’s utilization cannot exceed the size, and cannot go under 10% of the size. The utilization can be variably changed based off how much supply and demand there is, and does change pretty dynamically. The size itself however, can only be changed through construction, and does take longer to change.

I did experiment with using an FSM and accounting for layoffs and other variables, but that was a bit too complicated for the time being. Right now, the way we determine how much to produce and reduce production is just a few equations, but I’m worried that it could lead to the acutal formulas being too complicated to understand.

Trade across provinces in the same planet have also been reformed. The supply and demand to a province is dependent on the the ratio of local demand to the overall demand of the market, and is also weighted by the local price. This enables provinces with a higher price to receive more goods, and provinces with a lower price to sell more goods.

For developers, we have a few tools that are able to give us some metrics on the economy, and they have been tremendously helpful in debugging both the mechanics and the appropriate values to set for the factories.

Here is one such example testing out the stability of the economy: economy_pic

On the content side, we will still need to populate each province with the appropriate factories and consumption, and also add more goods. This will be a long process as we will still need to shed some provinces, and also look up historical data for those regions.

The runtime performance of the economy is also an issue. Although there are no noticable jitters within release mode, in debug mode, there is a noticable quarter to half a second freeze whenever an economic tick fires. I can partially attribute this to the fact that we have about 6000 provinces, and it does take a while to iterate through them, despite 99.9% of these provinces not having any economy as well. I will be working on simplify in the map to something more managable so that we can have better performance. The goal will be about 1000-1500 provinces overall over the solar system.

Despite that, I do think decimating the provinces will not be a cure all. Performance is also contingent on how many factories there are, and I don’t forsee this to be in any way bounded. I think there are a few solutions to this, including spreading out economic ticks for individual provinces across time, improving cache locality for each good, or introducing SIMD into the system.

For now, the economy is mostly self sufficient, and will handle itself without player input. I will have to gradually add in features to turn this economic simulation to an actual game, but for now, I think we are in a good spot.


tags: dev-diary - economy