Book reviews, art, gaming, Objectivism and thoughts on other topics as they occur.

Feb 9, 2018

Game Design: RPG Economy

So, thought experiment time. How would you go about building a "global economy" in an RPG? I don't mean the typical ridiculous RPG economy where vendors will buy your endless piles of filthy gear over and over for the same price until you could literally buy the entire country with your pocket change. I'm talking the kind of economy where prices fluctuate based on supply and demand. Where there IS "supply and demand".
So, first thing would be just to list out supplies. Have a background process that lists all supplies available in an area and can increment them as new supplies are generated or decrement them as supplies are used. So, in Town X on Day 1 there are 53 healing potions. The town produces 1d3 healing potions per day and uses 1d6 (or whatever numbers you like--you can have them change due to various events etc.) Whatever store(s) sell those potions have, as sales stock, some percentage of the total potion count. So, if there are 72 local potions, the Potion Store stocks, say, 20% of them for sale. (If the player buys the current sale potions out, it re-stocks the next day at the new level. So you could EVENTUALLY buy a place mostly out of potions, but it would take several days--assuming the production vs. use numbers aren't high enough that there remains at least one potion for sale. And use doesn't by any means need to be generally higher than production, in fact, it'd make sense for most places to have slightly higher overall production than use for most goods.
So, you've got basic numbers for generating supply and demand for your locality. Ideally, you'd want to use some kind of sensible numbers, so if there are, say, a lot of farms or gardens locally that produce Potion Ingredients, the production number would be high. The use should be based off population and events. You could write a whole algorithm to generate these numbers automatically, even, by counting all the production nodes in the zone and the people, so your production and population can change dynamically. It's arithmetic, it ain't like computers are BAD at that crap. You can add any bells and whistles you like to this calculation. Maybe guards use more potions, so if there are a lot more guards in this town than usual, the usage is going to go up. Maybe you have a "combinator" calculation in there, so if the town produces 10 wheat (health potion ingredient A) but only 5 mushrooms (health potion ingredient B), that only counts as 5 "potion" nodes. Have a whole formula for determining how many ingredient nodes are assigned to which goods.
Heck, have a dynamic algorithm where if there's a glut in potions and a shortage of pies, all the nodes are calculated toward pie production instead of potion production so pie production temporarily increases but potion production temporarily decreases. Likewise, in a glut, usage increases. Have a "theft" stat and a "damage" stat that decreases production if things are stolen or damaged. Have this increase if the player goes around looting farms and gardens for ingredients or setting them on fire. (This should also be STEALING.) Knock yourself out. There's a limit to the value of this degree of simulation, though, especially when it's only casually witnessed by the player and not terribly transparent. Their only access to this information should be by observing the prices and MAYBE hearing some canned dialog complaining about the potion shortage (although if you have a number of different "goods" types along the lines of Skyrim, this would probably exceed the total amount of other dialog in the game by QUITE A BIT). Besides, if the player is going to have opportunities to get cash by buying low and selling high, make them work for it.
Now you need to implement price change thresholds. To me, it'd make sense to divide these by your population (especially if you want the population to change dynamically at all). So, say, something like this: 0 potions = "desperation". +100% buy price.
less than 3 potions per person = "shortage" +25% buy price, +50% sale price.
3-5 potions per person = "standard". Standard buy and sell prices.
more than 5 potions per person = "glut" -50% buy price, -25% sale price.
More than 8 potions per person = "saturation", -75% buy price, -100% sale price. That's right, the vendors won't give you money for them AT ALL.
The last note is that if you really want this to be interesting, your "cash" needs to be treated as a good like any other. It needs to have a supply rate and a usage rate, gluts and shortages. However, it should probably not be possible to hit 100% saturation with cash. Or, you could just make it that any good with a "luxury" tag, can never hit 100% saturation, so cash, jewelry, high-level weapons and armor, rare books, delicious food, rare wines, etc. However, luxury goods should also have a very low "glut" threshold--or even ALWAYS be considered in "glut", since you don't "need" them. They're luxuries. Use your imagination. However, this is where things start to get a little bit complicated because, of course, if the value of cash can change, that's going to affect ALL OTHER prices. So the actual price of buying any good (with cash) is going to be modified by TWO effects.
Personally, I'd say (particularly if you're doing an RPG and not a full blown trading sim) that you should calculate the cash value and availability in such a way as to grief the player pretty severely. Games already do this sort of thing with the typical "vendors sell at full value and buy at half value" thing. Hey, they gotta make a profit--and by any measure all that stuff you took off of dead bodies that you BLEW UP AND/OR HACKED TO BITS then shoved in your greasy backpack for a month to rattle around with PIES AND DEAD FISH should be in TERRIBLE condition. Any "rural" location should have a VERY low glut threshold for cash. And cities should have enormous invisible banks of cash that isn't normally available but keeps cash prices pretty stable. Plus, that would open the possibility for the player to (literally) rob a bank. You probably also want to divorce "quest rewards" from the economy calculations. So if the players screw up and go broke (or break the economy in some hilarious way), they can always go quest while things even themselves out.
That's the basic outline, but of course you can go much, much further. You can have traders who act to equalize goods levels across different economic zones, like this: Trader Joe walks between Capital City and Port City. When Trader Joe is in Capital City, a calculation runs that determines what good(s) have the greatest price difference per unit between Capital City and Port City. Trader Joe acquires a supply of those goods and takes them to Port City, where he runs the same calculation in reverse. Over time, the traders would act to level out the supply levels between those places. You don't have to have Trader Joe ACTUALLY "buy" and "sell" the goods, just "transport" them from place to place. You could even just run this as calculation and not have real "Traders" at all, but personally I'd think it would be more fun. Plus, again, your player can always attack the traders on the road and steal all their stuff. Or, on the other hand, the player can buy a store, stock it, "hire" someone to operate it and "hire" traders. So, is this sort of thing worth the trouble? That depends on what you're doing, of course, but systems like these do one thing really well--they help maintain interest in playing. Players generally break the economy in an RPG pretty quickly--they can buy not just everything they need, but anything they want. Only there's no point, because they don't need it and there's no benefit to having 3x as many healing potions as you could ever use instead of just 2x as many healing potions as you could ever use. An economy that actually functions dynamically can stave this off for a much longer time while simultaneously adding a whole level of emergent gameplay options. I also think that if you really wanted to go hardcore RPG Economy Sim, you could theoretically create an MMORPG where the economy basically IS the game. Although maybe that's more interesting as a thought experiment than as an actual game.

No comments: