Economic concepts in computer games is a subject I've previously written about. This time, I'll look at trade of commodities in a game that I think implements it well.

Patrician IV is a game set in the historic Hanseatic League, a late medieval trading network centered in northern Germany and extending throughout the Baltic and a fair bit of the North Sea. The game features well over a dozen goods that can be bought and sold in towns across the region. Their prices vary depending on their availability in each market and when the player buys or sells a quantity of goods, the average unit price is rarely the same as the spot price before the transaction, since the availability is dynamically altered during the transaction, reflecting market depth. Next to each good in the market there are up to four diamonds, reflecting its abundance/availability. Buying up something that is already scarce or in high demand (1 diamond or less) will lower your popularity in that town, but selling something scarce will increase your popularity (and earn a nice profit in the process). This video explains more about the trading system in Patrician IV.

Contango is "a situation where the futures price of a commodity is higher than the spot price". If I understand correctly, it should be understood as a comparison with the expected spot price at maturity rather than the current spot price. As futures contracts come due, the futures price and the spot price have to converge. However, in the title of this post, I'm using the term in a less technical and more colloquial sense. After all, the game is set before the first stock market (1611), let alone the development of futures contracts. The core idea, though, is of an opportunity for arbitrage—taking advantage of differences in prices (again, applying a less technical definition to markets 650 years ago)—that is temporal rather than spatial.

A real world example was the time that oil prices briefly went negative in April 2020 (which feels very distant from the current conditions, where the price of oil hit a five+ year high last month). The reason that happened is that futures contracts were coming up to the delivery date but demand had cratered and storage capacity was largely used up; the oil had to be delivered but there were so few takers that anyone who could free up some storage or transportation space for it was getting paid rather than having to buy to receive it. If you had storage space near Cushing, Oklahoma (the contractual location for West Texas Intermediate oil), you could have made a tidy contango play. This example illustrates the link between carrying/storage capacity and contango.

With that introduction behind us, I'll retell the events of a playthrough I did earlier this year, pointing out where and how these things apply. The first order of business was to choose a hometown. I chose Visby since it is relatively central and can serve as a sort of gateway or entrepôt for the eastern Baltic. In the game (as in reality), not all products are harvested or manufactured in every location. The towns of the eastern Baltic are the only source of pelts. Many of them are also good sources of hemp (for making rope), wood, and bricks, although these items can be found more widely. Conversely, several key goods are not produced in this region, including cheese (except in my home port of Visby), cloth, grain, and beer. Having scoped out the landscape of supply and demand, I focused my initial trading efforts on collecting pelts from this region then making longer runs to the UK (mainly Edinburgh) for cloth and using Visby as the exchange point. I also took a lot of cheese from Visby to ports further east where it wasn't readily available. Finally, there were some intra-regional trade opportunities based on demand for inputs to certain production chains: Novgorod has salt and Stockholm produces salted fish; Visby and Riga have honey while Novgorod and Stockholm produce mead.

In-game map of the eastern Baltic; Visby is the island on the centre-left of the screen; note that many of these towns have an initial demand for cloth. 

The game begins in April of 1370. By the end of that year, my initial trade runs (in which I manually told my ship where to go and what to buy and sell) had brought in enough income that I was able to expand my business to 3 ships and several properties in my hometown: a warehouse, a few houses (rental income), and two hemp farms. With storage space in my warehouse and an administrator on staff in my counting house, I no longer had to manually trade in Visby. Instead, I could set rules to buy or sell up to a certain quantity of various goods whenever the price went past a given point. The next two screenshots show these rules. For example, I'll sell cheese from my warehouse (maintaining a reserve of 50 units for loading on ships to trade to other ports) when the price rises above 155 and buy cheese (up to 200 units) when the price falls below 123. The goods to buy are only those that are produced in Visby, while the goods to sell includes most of the commodities available in the game. I set these rules by looking at the normally prevailing prices in the local market (i.e. with locally-produced goods abundantly available and imported goods in high demand due to scarcity). This way, when my ships returned from trading voyages, I could unload the goods to my own warehouse and sell them when the market conditions were favourable, instead of being at the mercy of whatever the market price was at the conclusion of a voyage. Prices change when other merchants make large purchases or sales (among other factors), so having a higher sell price for the same goods I have rules to buy allows for taking some quick profit—with no added work or risk—on occasions when someone else drives the price up.  

Setting up a counting house with automated buy/sell rules
Setting up a counting house with automated buy/sell rules

Occasionally, a really good opportunity arises. In the following screenshot, a large quantity of beer suddenly became available in Visby. I bought as much of it into my warehouse as I could without driving the price point above my automated sell point. I knew that once the glut passed, I could sell it for the normally-prevailing price—an example of contango. This was possible because I had enough space in my warehouse (you can rent space in other merchants' warehouses if you exceed your capacity, but the rental fees will eat into this kind of profit; you can also invest capital in more warehouses, but should consider the opportunity cost of doing that versus making other investments like rental properties or production facilities).

Buying beer during a glut for sale later. 

By the spring of 1371, I was ready to automate one of my regular trade routes. Similar to the settings shown above for a counting house in my home port, the game allows you to set rules for prices and quantities of goods to load or unload at a sequence of ports. I set up a circuit from Visby - Stockholm - Riga - Reval - Novgorod and then repeating. It traded the same goods I had already been dealing with on the voyages I controlled directly (e.g. cheese and honey from Visby, mead and fish from Stockholm, salt and pelts from Novgorod). The screenshot below shows the sell settings for Stockholm. Note that even though I'm buying fish and mead there, I also have rules to sell them at a much higher price should the opportunity arise.

Also in the Spring of 1371, I lost 3 ships from 2 convoys to pirates. I'd judged incorrectly that I'd be able to defeat them instead of trying to evade or outrun them. Still, my trade routes and business operations in Visby were profitable enough that I was able to recover, and by mid-October of that year, was back up to 4 ships. By this time, I'd also set up another automated trade route, to Edinburgh. As your character gains ships, wealth, and businesses, you rise in rank as a merchant. This unlocks new privileges and can eventually give you the opportunity to participate in Guild and town politics. The next step for my character at this point was to expand to another town. I selected Thorn for a combination of reasons: I already had some popularity there (and no other Guild merchant was more popular) and it is a source of in-demand goods such as grain (not otherwise available in the eastern Baltic), pitch (needed to build ships), and lumber (needed for building ships and businesses, so strategic for further expansion). It is located up a river, so only shallow-draft boats can get there, but that just serves to limit competition.

By the end of April in 1372, I'd reached the rank of Grand Merchant. And had finally defeated a pirate fleet for the first time. That was about as far as I played on this play-through. My next expansion plans were to expand to Novgorod and then Copenhagen. The former would allow me to collect pelts in a warehouse or even produce them in my own businesses, so I could get a favourable price for a key trade good my convoys were bringing from the east. The latter would serve as a western hub the way Visby had on the eastern half of the map. Eventually, I'd aim to implement a hub-and-spokes trading network of automated convoys in the west, with other automated convoys circulating goods produced in my own businesses between the ports where I had a presence. Beyond that, an established merchant can get married and start a family, and even run for office. My Patrician IV strategy always includes keeping one fleet that I control manually so I can perform missions, take advantage of abnormal supply/demand conditions (in-game events sometimes result in a supply glut or demand spike of a trade good in a town somewhere), and fight pirates. There's also a sketchy guy in some taverns that tries to persuade you to partner with him in plausibly-deniable acts of piracy, but I try to resist that temptation.

A setting I think would make a great sequel or mod to this game is the Indian Ocean in the ~18th century. Aside from a different map, the trade goods would differ (e.g. spices, tea, ivory, gold, etc.). Other possible features could be reputation scores with various imperial navies (Portuguese, British, Dutch, Ottoman, Mughal, Maratha, etc.) and local rulers that would protect you or attack you if it got far enough from neutral; additionally, the effect of the monsoon winds could be simulated by having travel be much faster/easier in the appropriate directions depending on the season.