Dev Diary #18: Trade Pt. 1
17:37, 4 Mar 2023
Hello and welcome to the 18th development diary of Grey Eminence!
In today’s edition, we’ll be taking a look at one of the most anticipated mechanics in the game, trade. It is the crown jewel of Grey Eminence’s economic simulation - a process that transforms an otherwise static world of disparate populations and goods into a massive, interconnected network that ebbs and flows like a living organism.
Markets
The fundamental unit of the trade system is the market - by default, a market is composed of all tiles owned by a country in a single geographic province. Those of you who have read our previous dev diaries will notice that this is the same definition as the one we’ve used for political provinces - and that’s exactly right, in 1356 markets and (political) provinces are one and the same.
Each market has a market capital from which all its connections originate (more on that later) and a stockpile of every trade good in the game - including of goods that cannot be produced locally. Once per month, each market resolves the consumption and production requests of its constituent tiles by either drawing from or filling up its stockpile of trade goods. This process happens in two steps:
-
Essential consumption & buildings production
-
Discretionary consumption
All requests are fulfilled proportionally. For example, if a single market has 100 food in its stockpile, but its population and buildings request 200 and 300 food respectively, each request will only be fulfilled at 20% (100 / (200+300)). Continuing the example, since there would be no food left in the stockpile, 0% of discretionary food requests would be fulfilled.
By delaying discretionary consumption, we ensure that a population (with enough money) won’t starve or be left without fuel until shortages become so widespread that they affect production as well. Additionally, this also makes production more resilient to sudden spikes in discretionary spending, preventing for example an army returning home with loot from starving its local industry of inputs and breaking supply chains due to their newfound lavishness.
The market UI might look intimidating at first glance, but it gives you all the information you might need to know about what’s going on in a given market - with additional breakdowns on-hover of most numbers. Selecting any particular row in this UI causes the relevant market overlays (e.g. goods price, stockpile size) to display data only for the selected trade good, making it easy to visually navigate through the local and global economy. We’ve made numerous revisions to this UI and will likely continue iterating upon it in the future, so the design isn’t final.
Logistics
Of course, the raison d'etre of markets isn’t merely to match supply and demand locally, but rather to resolve local imbalances by importing or exporting goods from other markets they have a connection with in order to turn a profit. This is where logistics comes in: while we assume that all tiles within a single market can function as a single economic unit (at least on the order of a single month), different markets require a connection in order to trade with each other.
The most basic type of connection - and the only one we’ll cover today - is overland trade. This connection is automatically established between a market and all its neighbors. For each such connection, the fastest path between each market capital is used - notably, the path accounts for terrain, climate and infrastructure, so it might not be the geographically-shortest one.
Infrastructure is one of the main ways you can interact with the logistics system - building up roads allows you to direct the path through which trade will flow (which you’ll definitely want to keep out of enemy hands). Additionally, infrastructure greatly reduces the transport costs for moving goods, which makes trade more efficient and more profitable. Our design departs from other grand strategy games, since we do not artificially limit the volume of trade that can flow through a connection due to its infrastructure - instead, we rely on the profit formula to balance what amount of goods are profitable to move in a single month. For example, a player-led Russia might try to build up its eastern frontiers centuries before the invention of railroads, but such an endeavor would require exceptional profit margins to make carting tons of goods across Eurasia by horse profitable.
Speaking of railroads, they provide a unique mechanic that changes the way markets are structured: any of your neighboring provinces connected by railroad automatically become part of a single unified market. Thus, once you unlock railroads and start building them, you can create arbitrarily-large overland markets, greatly simplifying your internal logistics. Going back to our previous example with Russia, even with roads stretching from Moscow to Vladivostok, goods would take as many months to flow from one city to the other as there are provinces between them (since each iteration of the overland trade system moves goods only between neighboring markets). A railroad connection would not only reduce transport costs significantly, but would also make all constituent provinces part of the same market, allowing goods to move from Vladivostok to Moscow in a single month.
The current logistics overlay has lots of room for improvement. Currently, all connections are drawn the same - in the future, we’ll scale the width of a connection’s line to the volume of trade going through it, while its color will signify the level of infrastructure (none/roads/railroads) it has.
Pricing
A logistics-based trade system would be incomplete without realistic goods pricing to drive it - after all, it is price that determines profit, and it is profit that spurs the movement of goods. We won’t get into the minutiae of the pricing formula and the actors that are involved in it (that may or may not be the subject of another trade-related dev diary), but for now we can confirm that the price of goods in each market is determined primarily (but not exclusively!) by their supply and demand. Not a shocker, we know, but we felt it’s worth putting that in writing.
Moddability
Thus far, we’ve ensured to create each system included in the base game with system-level moddability built-in and trade is no exception. As one of the most interconnected systems in the game, editing how the processes connect to other game systems will require precision, but is doable. And, of course, content-level changes like adding new goods or adjusting trade-related variables like transport costs can be done inside the world editor.
However, going forward, we’ll unfortunately have to reduce the system-level moddability with which we’re building Grey Eminence’s systems. Adding such features increases the development time by at least a factor of 2 - and while we’re proud of the reception our recent alpha gameplay trailer received and are immensely grateful for your continued support, we won’t be able to maintain an acceptable development pace with our current resources without reducing the dev time we spend on moddability. That said, this doesn’t mean systems will be fully hardcoded going forward - you can always disable what we’ve built and implement something yourselves using our usual modding paradigm. Obviously, it’ll be more difficult than modding existing systems that were built with moddability in mind, but it’s still a possibility.
Thank you for reading! Rest assured, we’re working hard to get the closed alpha ready as soon as possible. While it’s still too early to give any specific date (since, after all, our resources are always in flux), we’re hopeful that it won’t be too far into the future. In the meantime, you can look forward to the next dev diary on April 1 (no bamboozle, that’s just how the dates lined up) and you should make sure to join our Discord and Subreddit, and to follow us on YouTube, Facebook, and Twitter.