Dev Diary #17: Bankruptcy
14:22, 3 Dec 2022
Hello and welcome to the 17th development diary of Grey Eminence!
We’re continuing the series of dev diaries dedicated to the economy with another spicy topic, bankruptcy. While the word bankruptcy might evoke images of modern financial institutions, in Grey Eminence this phenomenon can occur for any production building - as opposed to default, which is the tangentially-related process for countries that we’ll cover another time.
Bankruptcy is the process through which an unprofitable building goes when it runs out of money. Thanks to bankruptcy, building owners aren’t locked into eating losses from an unprofitable venture indefinitely and workers aren’t locked into working for lower wages than they deserve (though some can attempt to migrate, if their country’s laws allow it). Bankruptcy is the cleansing fire that makes room for new buildings and ends up resulting in a more efficient allocation of capital, so it’s an important part of the overall economic simulation.
Treasuries
We already described how buildings work in the dev diary dedicated to production. We’ve made one major addition to the system since then, which allows us to model bankruptcy on an individual building basis. Previously, buildings created a direct link between their owner’s treasury and their revenues/expenses; so, whenever a building had wages to pay, it would subtract those wages straight out of the treasury of its owner. While more efficient in terms of processing, this design choice had the unfortunate effect of making bankruptcy a per-owner process: so a single owner would effectively subsidize their unprofitable buildings with their profitable ones and if their treasury goes to 0, all buildings undergo bankruptcy including those that are still earning money.
Now, each production building has its own treasury, which works as a layer of abstraction between the owner and the building. The treasury gets filled up (or depleted) based on the building’s profitability and as soon as it tries to make a payment with an empty treasury, the building goes bankrupt.
Entering bankruptcy has several immediate effects on a building. Firstly, its size gets cut in half - and if the size is already 1, the building gets destroyed outright. Secondly, its wage modifier gets reduced to its default value (if it was above it) or gets further cut if it was already below it. As a reminder from the distant days of dev diary #13: wages are a function of two parameters, the balance of labor supply/demand and the building’s individual wage modifier, so this effectively speeds up the building’s attempt at returning to profitability by cutting wages.
Auctions
Once the above process has been completed, the building owner is given a choice: to refill the building’s treasury partially or to put it up for auction. There are a bunch of factors determining which option the owner is more likely to pick. Obviously, if the owner doesn’t have the money required, they’ll go with the auction. But even if they do have the necessary cash, they might still decide to give the building up. Each elite has its own weights for buildings it prefers to keep vs. sell (for example, the nobility is biased towards rural buildings, whereas the merchants favor urban ones), which can additionally be modified by cultural customs, country laws and events.
During an auction, different buyers get a chance to buy the building. By default, the potential buyers are the other elites in the province & the local population, provided they have the money to buy it. However, once international finance emerges foreign participants may also join in on the action - assuming the building’s country laws permit it - providing an extra avenue for economic imperialism of the emerging capitalist class in the second half of the game. Each auction starts at a heavily discounted baseline price, determined by the building’s size & potential profitability post-bankruptcy. Each participant then decides how much they like the building, using similar weights to the ones we described above about the original owner, and adjusts their bid up or down accordingly.
As soon as a new owner has been decided, the final auction price gets transferred to the previous owner of the building (workers, naturally, get nothing - unless they were the owners) and the new owner refills the building’s treasury to its minimal amount, allowing it to resume production.
Over time, bankruptcies tend to diversify the ownership of the economy, since it’s unlikely for the same buyer to always come out on top in every auction. While the nobility might be more likely to prioritize rural buildings, purchasing too many slightly profitable or still unprofitable rural buildings will deplete their ability to participate in future auctions. Thus, the bankruptcy process acts as a counterweight to the accumulation of capital in a single entity’s hands.
While you, the player, can’t participate in auctions directly (we experimented with triggering events for each bankruptcy, but as you can imagine this got annoying very fast), you can always front-run the process by buying out the building’s owners before it goes bankrupt. Unlike the elites & population, you can always configure the wages of state-owned buildings throughout your country via the wage setting in the budget (covered in dev diary #15). In addition, you can also resettle more people to reduce labor costs (or even purchase slaves via the slave market), so you have an advantage in turning businesses to profitability, assuming of course you can afford the bureaucratic overhead of running them.
You might think that constructing a tailoring workshop right next to its source of input goods might be a good idea - that’s what the merchants AI thought - but in reality the small workshop is unable to compete with the massive tailoring industry in nearby Nanjing.
Moddability
By virtue of being an event process rather than a true data system, bankruptcy is easy to change or outright remove. Everything from its triggers (when/who/what goes bankrupt) to its effects (size reduction/wage reduction/auction trigger) can be changed with rudimentary C# knowledge, so it’s a good place to start when learning how to tweak the game’s systems. The auction process is actually separate from the bankruptcy one, but it follows all the same paradigms - and the fact that the processes are nested doesn’t mean that they can’t be changed separately or disconnected from each other. You can return bankruptcy to our previous implementation (owners going bankrupt vs. individual buildings), you can add the player’s country as an automatic participant in auctions, you can expand potential buyers to include every elite/population anywhere (performance not guaranteed) or you can tweak the system in a bunch of other ways we probably couldn’t even imagine.
Thank you for reading! While the winter holidays are fast approaching, we’re gearing up for a period of intense development over the next two months. We’re not that far away from the first anniversary of Grey Eminence’s announcement and we want to make that special occasion count. As such, there’ll be no dev diary on New Year’s Eve or in January as we concentrate on getting the game into a (hopefully) playable state. Have a very happy holiday season and don’t forget to join our Discord and Subreddit, and to follow us on YouTube, Facebook, and Twitter.