Developer Diary 7

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.

Introduction
Dev Diary posted on behalf of wogudwkd12.

I know that we’ve already talked about trade back in the second dev diary, but there have recently been some major changes in how it works. Without further ado, let's get into it!

So, trade. In the previous dev diary, we explained how trade in M&T 3.0 is based on a network of tradenodes. Provinces trade with tradenodes, and then tradenodes trade with each other. This high-level abstraction of global trade was a noticeable improvement when compared with the unidirectional trade of vanilla, yet nevertheless had its own share of issues. The most fundamental issue with the model was transportation cost.

I mean, how do we even measure in? One solution might be to measure the average terrain malus and infrastructure bonus. If we do that, however, then trade between Malacca and Hanthawaddy is hampered by the Burmese mountain range.

Measuring tradenode size also has its share of issues, because representing the silk road becomes difficult due to the sheer size of tradenodes that compose it. However, if you don’t measure tradenode size, then the algorithm will always prefer a path of large nodes, since they cover more distance with a similar ‘transportation cost’ to smaller nodes.

My solution was to scrap all that, and build something new. Conceptually, the general idea of ‘actors’ trading with each other based on supply and demand, through the gradual changing of trade volume, remains in-tact. What’s new is the ‘actors’ in the system, and the links formed between them. In summary, tradenodes no longer serve as an intermediary for interprovincial trade. Instead, provinces now trade with each other, directly. Let me explain how.

Suppose you are in some small town in the middle of Kansas. No company in their right mind would run a direct flight from that town to New York. Instead, you fly from that town to a nearby hub, from which you then take a large transit flight. It is far more efficient for small scale flights to first aggregate in a nearby hub. If every airport, big or small, ran a direct flight to every other airport, that would be a logistical nightmare.

In the new model, trade centers serve a similar role. Trade centers use Communication Efficiency’s distance script to find provinces within reach, taking province size, terrain, infrastructure and even sea routes into account. Centers then use these provinces to form trade links, with the results of the distance script used as transport cost. Open links then facilitate the flow of trade.

The special part about these changes is that there’s nothing special about trade centers, they aren’t fixed to certain locations such as trade nodes. They’re just provinces, and they can create new links freely. There can be several trade centres in a single node, and no centers in another. They can be created and destroyed dynamically, changing over time as the game progresses.

Let me show you how this works in practice:

TODO finish