Developer Diary 9

This developer diary was first posted in the M&T forum here, and team members answered some questions in the thread. It was further posted on the M&T subreddit here, and team members also commented there.

Dev Diary #9 - Path to Modernity
Welcome to the newest version of M&T, still 3.0, but with enough work you could think otherwise. 3.0 is the next version of M&T, and 3.0’s probably worth reintroducing considering it's been so long since the last update on how its systems are progressing along. But do not despair, the second great dev diary drought is over. In response to this agonising delay, we’ve prepared a hybrid dev diary: One part a Trade/Production diary on the new systems (yes, third iteration) we’ve designed, and one part a summary of all the other new features, which will receive their own dev diaries in the near future. I do hope that you enjoy this toblerone-sized dev diary.

Note: The first two sections, Trade and Production, are written personally by KJH, lead programmer on economy.

Trade
How goods travel between different regions of the world has changed rather drastically as development progressed. That's because for a long while I was focused not on creating a fun system for players to interact with but was focused on instead creating an elaborate and intricate simulation. You could barely interact with it, and it was so delicate and unstable that one wrong move and it fell apart like a house of cards. It was a mistake on my part which cost me both time and emotions.

The main focus of new trade, therefore, was in addressing those problems that I just pointed out. I made it so that you can interact with it, and I made it resilient so that it can withstand a lot of abuse. Let's start with sectors.

A sector is a new addition to the new trade, which is basically just a set of provinces. It is defined as a set of provinces that are within the same tradenode and share the same nationality. Sectors avoid the need for each province to conduct foreign trade on their own by grouping provinces together. After that, each sector can do trade with other sectors, which greatly reduces the number of possible trade links.

A sector can trade with another sector when it has a trade link between the two. A trade link is created and maintained by states. It is created when there exists an unbroken chain of merchants placed in tradenodes between two sectors.

For example, suppose there exists 3 nodes A, B and C. There also exists 3 sectors Z, Y, and X, where Z is in A, Y in B, and X in C. If 3 nodes A, B and C have vanilla trade connections that's set up like A -> B -> C. If owner of sector Z has placed a merchant in both A and B, then trade link is formed between sectors Z and Y. If the owner of sector Z has placed merchants in all 3 nodes of A, B and C, and if it is also the owner of sector Y, then trade link is formed between sectors Z and X through sector Y. If the owner of sector Z has placed merchants in all 3 nodes but does not own any node B, then a trade link cannot be formed between sector Z and X.

This change, which puts the burden of opening and maintaining trade routes on the state, is a radical change from the previous model of provinces forming trade routes on their own. It meant that trade routes are more dynamic and less stable. Therefore, I also had to change how trade itself is conducted once trade links are established.



Previous model worked based on a concept of incremental optimization. Basically it stored a variable whose value represented the total trade volume, and it incrementally optimized that value by either increasing or decreasing it based on price differences of trading actors. The key problem of this model was that it takes time for sufficient trade volume to accumulate and therefore was unsuited for an environment where links were opened and closed in unpredictable fashion.

New model works based on making bids and then resolving those bids by matching them with offers. Basically, I made it so that sectors no longer care about their previous business transactions and made them buy and sell all they want with whomever they can find that gives a good deal. This model proved to be far more stable and resilient, as even if one trade route suddenly got closed it could still try to find another sector to trade with.



Production
If trade is about the movement of goods, production is how those goods are produced in the first place. Like trade, production too has seen a good amount of changes during its course of development. Key changes to note are changes in how industry size is determined, how it shifts, and how it interacts with property.

Industry size is a value that represents the sheer size of scale of a given industry. Before, it used to be directly tied to how much wealth is stored up in a given industry's treasury. If industry profits, then it will accumulate wealth and therefore increase in size. If the opposite, then size would have decreased.

The problem arose when the concept of separate treasuries for each industry became a goner. As part of property rework, it was changed such that all industry profit and losses, rather than accumulating in their own separate treasuries, would just be fed back to property owners based on their property share. It was a nice change, but it meant a lot of production code and concepts had to be reworked. I tried many different things, but in the end concluded that just having industry size to be its own thing not tied to anything else was the best approach. Now, industry size is not a composite or result of some other set of variables. It just stands on its own as its own thing.



That did lead to a new set of problems. If industry size is its own thing, then I had to rework how it changes based on market situations, as I could no longer just rely on change in treasury size as a result of profit and losses to automatically handle industry size changes for me. I again tried many things, and settled on a simple script. Basically, all industries now record any change in size that they made to themselves, and record how much change in profit has occurred after it made that change. Then, they calculate how much they'll change in size and in which direction next year by simply multiplying previous size change with previous profit change. If one of the two was negative, then industry will try to shrink. If both were positive or if both were negative, then industry will try to expand.



Property and Infrastructure
To facilitate these new Trade and Production systems, we had to forgo our old system of abstract ‘Property Power’ and automatically calculated property shares. With this new model, we decided to work from a clean slate, moving away from simply having ‘Rural’ and ‘Urban’ property. Instead, there are real, discrete, buildable units of property that each are owned by a given class. Property is not focused on progression, it is instead focused on supplying real estate for industry slots to utilise, working as a primary means to distribute wealth and thus power dynamics in a province.



Progression instead falls largely upon a new Infrastructure system, entirely divorced from the old. New infrastructure is based on a ranked system of progression, each rank providing increasing bonuses while requiring dynamically sized amounts of units to be constructed for each rank. This dynamic sizing allows larger provinces to have larger costs where appropriate, while also providing a way to increase maintenance accordingly as well. In a sense, a rank is a collection of these units, providing a means for partial progression towards the next improvement in a province.



Trade Nodes
Our new trade system left a fundamental issue, which is the balanced trade nodes of 2.5 would not fundamentally work due to the limited trade node connections inherent to it. In this sense, we made the conscious choice to forsake AI balance to an extent, and instead focus on providing a larger number of merchants for a now larger, fully formed network of inter-node trade connections, providing complete functionality for trade with historical, redrawn routes and an expanded trade node set. This includes major reworks to the nodes of much of Asia, and additional work in many other areas.



Classes
The bedrock of the 3.0 rework originally was a class system, providing discrete units of population focused on socioeconomic differentiation, including within Rural and Urban. Rurals were split into Slaves, Peasants and Freeholders, while Urbans were split into Slaves, Residents and Artisans. Through the last two years of development however, we’ve found that the greatest value of classes was in discrete economic units for the ‘Elites’ of society. Consolidating Rural and Urban classes back into united classes provided better results in our systems, improved performance and understanding.

The fundamental divisions however are now reflected through the systems developed in the last few months. For example, we’ve moved from a Serfs class to a more multi-factored approach to distinguishing the wellbeing and freedom of Peasants. Aspects like their property share, their ‘Freedom’ value or the rights applying to them all have strong effects on their fulfilment and wealth, representing the intent of the divisions without the need for separate classes.



Elites
While the foundation of 2.5 politics was the Estate system, 3.0 replaces that with the Elites, also known internally as Powerbrokers. The Elites are the local powerbrokers in a given province, each holding power and loyalty, alongside all the data you’d expect from a class (including wealth). They may work in industries, own property and extract earnings, and fund property and infrastructure. At their core however, they are political entities, and will strive to achieve a more favourable environment.



Elites have power, and it's not mutually exclusive between them. Power represents the influence of an elite in their given domain, such as the countryside for Nobles, the towns and cities for Burghers, or the entire province for the Clergy. In the absence of another elite, they can encroach on other domains and tax those within. Both the effects of elites, and how their resources are translated into power are shaped by national rights, requiring their influence to extend beyond the provinces.

One other entity seeks to manifest their power in all domains, and that is The State. Through State Reach, representing the influence of a state in a given province, the state can enact the effects endowed by national rights, transform the effects of other elites in their given domains, and institute a new foundation of power that revolves around the state. All stats from all elites are summed and displayed in national UI, but their wealth, power and influence is all fundamentally provincial. And here, familiar concepts including Interactions and Privileges return anew, to provide the means to change the power dynamic in the realm.



Factions and Authority
While the Elites represent the power balance in the provinces, Factions represent their influence specifically in the central governmental authority, and their control over the government at large. These factions have relations with the state and can help or harm a given ruler depending on their alignment with the factions given agenda. Allowing governmental influence to reach its natural state can allow powerful factions to provide the ruler with legitimacy and authority, while going against the status quo can provide the means for the rise of new factions, facilitating reform and a new direction.

In coexistence with this new system of governmental power, is the return of Executive Authority for the old-timers out there. Executive Authority represents the real power of the central government, replacing the ruler-centric mana generation with a new hybrid value. Ruler Mana is now a dual calculation of Ruler Authority limiting their influence to act, weighted against their own Skill to contribute. Institutional Authority provides an alternate means of generation, shifting the value towards a uniform, consistent mana generation that is less dependent on rulers, while leaving less capacity for exceptional rulers to exert influence on the state. And while balancing those two is key, authority of any kind will be essential to avoiding a vacuum of power, widespread corruption and an ineffective and inactive central governing authority.



Rights
While Privileges and the power dynamics of the Elites both provide a path to an alternate future, the core of political progression lies with National Rights, internally known as National Reforms. The differences in rights between realms forms the core differentiation of 3.0, shifting the realm in a given direction, usually towards what we today consider a ‘modern’ state. Rights are a major shift in the powers provided to the Elites, to the powers of the State, and the framework that governs the economy.

Reforming the rights of an entire nation can be a painful process for the unprepared. Even so, in 3.0 we have less hard blocks on internal political action than before. You can reform in instability, with a penalty. You can abuse Elites, with the risk of rebellion. There is always risk, and the reward is partially subjective. Using the various means of interactions, bartering privileges and laying the groundwork for reform can keep the realm marching onwards in the face of change, without falling into instability and chaos.



Manpower
One of the most essential changes of 3.0 is that the levy system is now gone. Levies provided a means to represent the armies of the Elites and the irregular nature of their forces. In practice however, as the nobles’ armies were hidden within the estate menu during peacetime, they removed one of the most important statistics of strength and power from the EU4 map. This removal left difficulties across all systems, from diplomacy and war to AI. 3.0 puts all armies back on the map, without removing the essentials of levies. Loyalty and rights will still play a major role in the recruitment and composition of your armies.

Through a new system of tracking and scripts, manpower has also picked up an important feature. When men die on the battlefield, that now translates into real casualties in the provinces, distributed based on each class's contribution to manpower in each province. War has never been as deadly as it is in 3.0.

Tax
For a mod named MEIOU & Taxes, there hasn’t been a lot of active taxing going on in older versions. In 3.0, Tax is a front and centre feature, and the core means to extract revenue, affect population dynamics, and balance your revenue with the resources available from your people. Every province can have multiple distinct taxes at varying rates, each raising revenue with their own cost to your administration. Their cost is two-fold: On one hand, the administrators have to be paid for their tax collection duties, while on the other hand, supporting the ongoing taxation efforts requires spending political resources, aka mana. Large states attempting to tax large portions of their population will suffer the burden of the strain of administration and will require political reform to handle the costs.

Alongside this tax model is a rework of local autonomy’s effects and an expansion of corruption as a concept. Local autonomy has shifted from a cancellation of state tax revenue, to instead a metric of the difficulty of taxing a given province. As such, revenue can be found even in a 100% Local Autonomy province. Instead, LA primarily affects the cost of tax, and the power of elites and provincial corruption. Accordingly, corruption now has a local, provincial version, that is the primary means in which the state can lose revenue to the local elites. Corruption at the local level is the elites co-opting the government in the province, reducing their tax rate while siphoning that which is collected. On the other hand, state corruption is a faster change, more dependent on executive authority, and more focused on mana cost and other factions within.



CE and Rivers
With all the new systems in place, we had a look at CE and the fundamental concept that grounds it. The core idea is to shift from a focus on speed as the base metric of governmental authority, and instead shift to a focus on capacity, which in itself has an element of speed. This allowed us to rebalance CE to act as a metric on the influence a government can exert based on its distance to the given province, and better utilise the new systems of CE.

CE has gained a new, more performant calculation method, of which the details will be shared in a future diary. In addition, CE has added River Transport to its arsenal. Using per-province data on the presence of navigable rivers, and using a system of interlocking river segment IDs with ‘Joint’ points to connect rivers, we’ve created a map for CE to follow, using Harbourage infrastructure in given provinces to allow CE to board a ship at A, sail down to B, then travel by road to C. This should allow river transport to act as the core gauge on the capacity and reach of a government in a given area.



Idea Groups
With the new systems in place that now represent many concepts once outlined in our idea groups, a rethink of all ideas and their effects was necessary. Most idea groups remain the same in concept or name, yet their content has been mostly reworked. Idea groups at their core now represent the effort the country is making to move towards a given direction. The absence of ideas does not denote the absence of its presence and instead means the focus has been shifted elsewhere. This has empowered us to add idea groups as requirements for many reforms, providing a more immersive and challenging pathway to reform your nation in given directions.



National Ideas
In addition to idea groups, we’ve undertaken an effort to rework all national ideas in the game, centred instead around culture instead of tags. This represents the past and characteristics of a given people, and the effects it has on them in 1356. We will freely delve into per-culture idea sets where we desire and where we feel it's appropriate, but by large, culture groups as the base division allows us to replace as much of the national idea sets in as short a time as possible. It also allows us to spend time with new ideas that include proper 3.0 effects, and thus integrate better with our systems.



Institutions
With new systems (a familiar theme) come new institutions, with new concepts and a full invention and spread overhaul. Our new institutions are, at their core, based around a new spread model that uses direct province borders and trade nodes, yet also uses the 3.0 trade system to allow far and wide spread across great distances. It also includes a fully functional invention system, allowing any state around the world at any time, regardless of who else has it or has invented it, to create the facilitating conditions to invent the institution in their own area and enjoy its benefits.



And lastly our secret mapmode for this diary. Might help explain something the perceptive may have noticed.



Thankyou for reading, and we look forward to future diaries on 3.0.