Developer Diary 2

POP has had some history with its economy, namely emerging from a stricter model in v2.0, into a more flexible model with some market elements in v2.5. Yet these models have suffered all the same due to abstraction previously thought necessary and unassailable. With v3.0 however, we have been able to take our accumulated experiences and knowledge and create something more.

The Economy
In v3.0, the economy is the heart of all data, providing output’s that feed everything from politics to warfare. The new economy is a production-oriented model, where income from the production of goods is the major marker of wealth. Multiple goods per province are represented, along with wealth outputs for individual classes and a meaningful wealth distribution model.

The first major component that is responsible for the simulation is the production subsystem. It handles two key tasks, namely ‘who produces what’, and ‘how much is produced’. The technical complexity of representing these two simple questions can end up prohibitively expensive without constraints. So, to represent multiple goods per province, the production system is built upon ‘slots’.

Production
Slot’s represent the primary unit of the production economy. The slot system entirely replaces the good system in EU4, as well as the old food market and urban production systems. Instead of a multitude of functionally unique system’s, slots represent both the production and consumption of goods, as well as representing new concepts such as industrial dependency all within a single unified model. Replacing the old goods are the two things, industry and trade goods.



In each slot, a unique industry is represented. Distinct, regional and varied production is represented through a provisional list of 24 industries, such as textiles, components, timber or livestock. The inclusion of industry allows regional flavour, minor variation and familiarity within the new production economy. When it comes down to the actual handling of consumption and production, trade goods come into play.

Trade goods represent the commonality between goods, and their shared utility, empowering the exchange of goods and enabling efficient representation of industrial dependency. They are implemented as groupings of various industries, allowing for example grain, livestock and game to be traded as a single trade good, food. As an example, a slot could contain the unique industry ‘textile’. Textile consumes ‘fibre’, a trade good. Fibre can be produced by ‘plant fibre’ industry, which would be flax and cotton, but it can also be produced by ‘livestock’ industry, which would be wool and leather. The output of either industry would be, in the eyes of the system, equivalent. Textile would also output ‘consumer product’ another trade good that can be consumed by other industries.



In summary, every slot can represent a unique industry, representing regional and unique production of multiple goods in each province. Slot’s don’t output or consume industry, instead it utilises trade goods as a medium of sorts, empowering the exchange and dependency of multiple goods. There can be 8 slots in total in each province, which can be filled by any one of a provisionary list of 24 industries, which output and consume any combination of 15 trade goods.

While slots generate wealth through production, the subsystem also handles the distribution of wealth from slots to other entities. This is accomplished through the land and labour markets, built upon the trinity of supply, demand and price. While slots provide the demand for land and labour, people, buildings and land all provide the supply. Prices are calculated from supply and demand, weighing the need for land and labour against its availability in the province. The resulting price is used to either add or deduct wealth to each individual actor.



Trade
The old model of local, regional and continental trade is gone, and instead a new subsystem has been built to facilitate the calculating and handling of price and fulfilment. Price determines the value of each trade good, while fulfillment is based upon working out how much demand for each trade good has been met. This is facilitated through the use of nodes.



If it sounds familiar, that’s because the Trade system uses the in-game trade nodes as its base. As such, nodes are effectively a grouping of provinces in a same trade zone. Nodes are not bound to the connections present in EU4 between nodes, with many custom links and alternate routes added to best facilitate historical trade. Both land and sea routes are viable, and generally follow the historical lines that trade in this era followed. Also, they are not bound by upward or downward flows, as in, trade can flow both ways.

This intermediary unit is required simply because direct province to province trading is a remedy for disaster, both in terms of user complexity and its sheer performance cost. The purpose of nodes is to collect provincial export and import from its member provinces, and then exchange trade goods with all other nodes it is connected with. Through internode trade, a global network of commercial exchange is formed, fully simulated and rooted in historical flows.

The entry point of the trade system is the member provinces of a node. Every province will export what it has in surplus and import what it lacks from the node. As such, it’s the nodes responsibility to collect this provincial import and export, and gather it in the trade hub, the exchange capital of a node. A node will then calculate trade good prices based on its provincial, and internode import and export. Once calculated, it falls upon internode trade to handle the next step.



A node will import trade goods from other nodes when its price for that good is higher than another node. Export as a result is simply reverse import, in that data is set when nodes are importing from any given node. It may surprise that this internode trade is one of the cheapest parts of the entire economy system, as any node can at most be connected with 8 other nodes, preventing cascading negative effects from overconnectivity. Even with this simple restraint, the effectiveness of long range trade is not hindered.

Long range trade instead still remains viable because of intermediary trade. A node can export what it has imported. For example, a theoretical Node A can buy from Node B, who bought its goods from Node C. It's actually a pretty fun process, and let me show you step by step how that works.

So, suppose there are 3 nodes, A, B, and C. A has high demand, B has medium demand, and C has low demand. Because A has high demand, A has high price, while B has medium price and C has low price. Because B has higher price than C, B would try to import from C. Because A has higher price than A, A would try to import from B. At the end of a given iteration, the result would be, A <- B import increasing in size, B <- C import increasing in size, price in A decreasing, price in B both increasing and decreasing, and price in C increasing.

As iterations pass, this would naturally result in a trade network where size of trade increases until prices in A, B, and C are roughly similar.

This allows the creation of long networks of import and export, without needing every node to connect with all other nodes. When all this trading is done, node fulfillment is simply the measure of how much of each trade goods supply a node is left with, compared to the summed provincial imports of its member provinces. Provincial fulfillment, as a natural consequence, becomes the following formula.

Provincial Demand / ((Provincial Import * Node Fulfilment) – Provincial Export + Provincial Supply)



Actual Example
Some might ask, this is all great. But how do this all actually work in practice? That, my dear audience, is why I've prepared this step by step example for what actually goes on in the city Dadu under this economy system.

First, it starts with slots checking the balance of wealth left over from previous iteration. If the industry contained in the slot earned green, then it increases its throughput accordingly. If they instead lost money, then it decreases its throughput.



Then, slots begin hiring people and renting out lands/buildings based on their size. Crop industry hires rural workers and rent out cultivated land, for example, while trade industry hires burghers and rent out trade infrastructure. They pay wages to workers they hire, and pay rent to respective property holders, which is nobles and freeholders for rural industries, and burghers and artisans for urban industries.



Now, trade kicks in. Trade system checks class consumption, slot consumption, and slot production to get provincial supply and demand. Dadu, as you can see, is a city that is more focused toward consumption than production, other than trade and knowledge. That is because Dadu is a bureaucratic capital, where notable people and their servants are aggregated to form center of bureaucracy, but that is for another day. For now, what is important is that Dadu consumes a lot more than what it produces.

So naturally, they import. They import food from other Huabei, salt from Tianjian, urban goodies from Xian and Huangzhou, etc. And all that creates a demand for 'trade' trade good, which basically means that trading activity is required to actually conduct business transactions. Thankfully, they have a lot of that, so they successfully import what they need.

Now, Dadu calculates provincial price and fulfillment for each trade goods. They lack a lot, but since they imported what they lack, their price and fulfillment is good. Each classes and slots pay for, based on price and fulfillment(because if you demanded 10 but node only provided 9, you only pay for 9), what they demanded.

At the end of the day, every income and spending from wage, rent, sales revenue, various costs, and consumption, are summed and added into class and slot wealth. They are left with how much of their innate demand has been met and satisfied, as well as how much income they earned, spending they lost, and wealth they have. Then, other systems can pick up on those variables and do their own set of magic, like population system picking up sustenance fulfillment and modifying birth rate and death rate accordingly.

Summing Up
With both production and trade unified within a single model, the economy system creates a detailed and vibrant civil economy, with markets, trade and production. Wages, production chains, land sparsity and more all come naturally within this system, without the need for separate, dedicated mechanics of their own. The new economy is dynamic, in that it can evolve to various forms based on the conditions of the market. In addition, it is a procedural system, in that its dynamically generated using the set of rules it was coded with. We provide it data, and it simulates a world of its own, one that v3.0: Path to Modernity will allow you to experience for yourself.

We have more to reveal in time, for now I hope you enjoy this sneak peak at what lies ahead.