Page 1 of 1

Improving Morrowind's Economy

Posted: 01 Feb 2019, 05:11
by Greywander
No, I'm not talking about bringing jobs back to Vvardenfell or reworking trade deals with the Akaviri. My goal is to make the economics of Morrowind more interesting than they are now (not difficult, as they're pretty boring).

Now, this presents certain challenges. I'd rather avoid anything that requires us to go in and edit each and every merchant. For one, that's a lot of work. It could also introduce compatibility issues with other mods that also edit those merchants. And then there are mods, such as Tamriel Rebuilt, that add new merchants, and I'd like to be able to accommodate them without requiring any extra work on their part (they have enough on their plate).

All of this points toward an engine modification. If we rework the way the economy works inside the engine, then we can apply all those changes to all the merchants without needing to even touch them. The most likely way this would be implemented would be post 1.0 when certain parts of the engine are de-hardcoded and a more powerful scripting system, such as Lua, is implemented. Thus, this new system could be implemented as nothing more than a mod consisting of just Lua scripts, or something.

But what about the actual implementation? How could we go about improving the economics of Morrowind without touching merchants? Behold my three step plan:

1. Supply and Demand
  • Use rudimentary supply and demand calculations to create dynamic prices for goods.
2. Redistribution
  • Move items between merchants to simulate the flow of goods around the region.
3. Item Disposal
  • Get rid of excess items so that merchants' inventories don't get clogged up with junk.
1. Supply and Demand
By using rudimentary supply and demand calculations to dynamically adjust prices, we gain a number of benefits. One is that it makes it possible to play as a traveling merchant, buying low in one region and selling high in another. Another benefit is that it acts as a soft fix to a number of money making exploits, as many of those involve selling large quantities of the same item.

To start with, we need a rough calculation of supply. The simplest way to do this is to just count how many of that exact item is in that merchant's inventory already. However, we can get a bit more complex than this. We can weight each source of supply in their importance as follows:
  1. How many of that item that merchant has. (Most important, most weighted.)
  2. How many of that item other merchants within the same cell have.
  3. How many of that item exists within the same cell not owned by merchants. (Least important, least weighted.)
And actually, since each group already includes the ones above it (i.e. this merchant -> all merchants -> all NPCs), weighting per se may not be needed, as the most weighted categories will already be counted more than once unless we explicitly exclude them. We can expand this further by looking at the adjacent cells (including diagonals), weighting them less than this cell. Theoretically, we could expand out further and further, but practically we aren't able to do so indefinitely and have to draw the line somewhere. One set of adjacent cells should be fine, and a second set should be more than enough.

Pretty good so far, but we're only looking at one specific item. So maybe steel swords are abundant and the price is low, but there aren't any silver swords so the price is unusually high. That might not seem so strange, but it is odd that the price of one item shouldn't be influenced by the price of a similar item. While we're counting the number of items in a region, we can also look at similar items, weighting them less and less the more different they are.

Example: Glass Spear
  1. How many glass spears there are. (Most important, most weighted.)
  2. How many spears in general there are.
  3. How many glass weapons there are. (Not sure if this is possible in Morrowind.)
  4. How many weapons with a similar base price there are. (The more different the base price, the less heavily weighted.)
  5. How many weapons in general there are. (Least important, least weighted.)
Example: Potion of Health
  1. How many potions of health there are. (Most important, most weighted.)
  2. How many potions in general with a Restore Health effect there are.
  3. How many potions with a similar base price there are. (The more different the base price, the less heavily weighted.)
  4. How many potions in general there are. (Least important, least weighted.)
This allows us to differentiate based on a number of factors, such as the base price or the specific skill used or effect produced. Thus, just because a town is overrun with spears, sure the price of swords will be a bit lower, but they'll still get a better price than spears.

Whew, that's a lot, and we've only dealt with the supply side of things so far. Fortunately, addressing demand should be a bit easier.

For demand, the simplest thing to do is to simply total up all the NPCs (people only, not monsters or animals, i.e. only things that can't be soul trapped) in the cell, as well as adjacent cells (with a lower weight). More people equals more demand. If we wanted to get more complicated, we could look at things like class or faction, and assign each one a certain weight for the demand of particular types of items. For example, guards would have a higher demand for weapons and armor, while commoners would have a lower demand in general since they can't afford as much (but maybe a bit higher for clutter). This would require going in and editing some of the existing parts of Morrowind (the classes or factions), but it's better than editing each merchant, and I expect most mods won't introduce new NPC classes.

The more supply, the lower the price. The more demand, the higher the price.

Also, this should be implemented in such a way that you would pay or make the same amount of gold regardless of whether you are buying or selling one item at a time or all in one big chunk.

2. Redistribution
The next phase is to start moving items around between merchants. This means that merchants will gradually clean out their inventories of the loot you sell them, rather than having it sit there forever, and that you can sometimes find new things in stock that a particular merchant didn't used to carry.

The first rule of redistribution is that a merchant's default stock will not be distributed. I mean, we could distribute it, but it would make it difficult to track down a specific item that used to be sold by a specific merchant. Furthermore, if a merchant is missing a non-restocking item from their default stock, and that item gets distributed to that merchant, it will be reintegrated as its default stock (i.e. it won't be distributed anymore). The exception is that restocking items would sometimes be distributed, but since they restock the merchant wouldn't actually lose anything. This allows items to circulate in the market even if the player never sells anything.

Okay, but what about items that aren't part of a merchant's (non-restocking) default stock? Items should probably move gradually, instead of shifting a merchant's entire stock overnight. So only, say, 10% of the items a merchants has that are eligible for distribution would be distributed each day (it could be something other than 10%). We could also use price differentials to determine how many items get distributed, e.g. if there is a big price difference between two nearby merchants, then a lot of stock gets transferred, whereas if the price isn't much different then very little will transfer.

As for who they get distributed to, there are a number of factors that would figure in to the priority of who gets those items:
  • Merchants that restock an item are more likely to receive it. (The reason why will become apparent in the next section.)
  • A merchant can only receive items that they would buy or sell.
  • Merchants that are nearer to this one are more likely to receive their items. (Probably by cell rather than exact distance.)
  • Fast travel nodes (silt strider, mage's guild) would be figured into the distance formulas.
  • Merchants with a lower price for an item (supply and demand) are more likely to receive it.
3. Item Disposal
Sick of seeing literally thousands of water walking potions of varying qualities in Nalcarya's stock because you were grinding up your Alchemy skill? Redistribution will help, but ultimately we need to take out the trash to prevent the merchants from overflowing with unwanted stock.

One major problem, however, is that we don't know which items are safe to get rid of. Items don't carry a special tag that marks them as important, so you could end up deleting something you needed to complete the game. However, there is one group of items that we can know for certain are safe to get rid of: restocking items. If the item restocks, we know that you can always buy more if you really need them, so you'll never be unable to get more of them.

This is why merchants are favored to receive items they restock during the redistribution phase. If a merchant has excess items in stock that it would normally restock, they will gradually delete them from the world until they return to their normal level of stock.

This also creates an easy fix to items that don't restock: just make a mod that adds a merchant that restocks that item. The merchant doesn't even need to be accessible (so the player might not be able to reach them), which can be nice if you don't want unlimited of that item to be available for purchase, but want to clean it out of the world. Remember, monsters can drop items, so that can also be an infinite source of items aside from restocking merchants. Any item with an infinite source should be disposable, but there may not be a way for the game to figure out what those are aside from restocking items.

For a brand new game, we could do a lot more than what's given above. One big change might be to tag items with an "important", "rare", or "quest" tag, so the game knows not to dispose of it, making it easier to dispose of excess items. If you sell such an item to a merchant, you could also have the option to ask the merchant about it, if you wanted to track it down and buy it back. They might tell you who they sold it to, or which town they're in.

Anyway, I'm not sure why I felt the need to type this all out, especially since it's definitely a post 1.0 feature. I had it on my mind and wanted to get it out there. I don't know, maybe there's someone out there who is capable of actually implementing this right now, or at least getting started on it.