Balancing game economies

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
pedrosgali
Party member
Posts: 107
Joined: Wed Oct 15, 2014 5:00 pm
Location: Yorkshire, England

Balancing game economies

Post by pedrosgali »

Hey all,

I've been (slowly) working on a space trading game, I'm just getting the economy set up at the minute and I was wondering if anyone had any ideas on economy balancing. Here's what I've made so far...

The economy works on a supply and demand basis, each planet gets a modifier for the amount of each resource available (0.1 to 2). The cost of these goods is an arbitrary base value multiplied by (two - the modifier) so the rarer the resource is then the more it costs.
Then each higher tier trade good has a recipe which has a cost calculated by adding up the costs of the items in the recipe plus a profit margin (In this case 10%).
Both costs are multiplied by a modifier 0.1 to 3 based on how full the planets stores are of that item, so the less there the higher the price goes.

What I'm really having trouble with is getting planets to use higher tier items to stop the whole planet filling up on each resource, I made each colony buy a few ships to go and trade for the goods they need but I'm still having trouble with them all filling up.

I hope that makes sense, any help would be appreciated. Here's the .love, controls are:

"WASD" = Move the camera.
pgup/pgdn = cycle through your ships.
up/down = select the next entity.
numpad+/numpad- = Change game speed.
Click on a planet to view the planet window.

You can trade with any planet that you are landed at, click the "Set Course" button in the planet window or select your ship and right click a planet to move there.

Much like the sun it's probably best if you don't stare directly at the code but if you must then the economy stuff is located in
"/Data/Game/behaviour/Colony/behaviour/colony_economy.lua".

Code: Select all

if not wearTheseGlasses() then
  chewing_on_trashcan = true
end
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Balancing game economies

Post by raidho36 »

Maybe you have too simplified idea about free market. There are no rules governing a free market. Any formulas you see about it are at best crude approximations of idealized systems. In real open market, everyone fends for themselves. And in real open market, goods cost exactly as much as they are worth. The statement may seem like tautology but it's really how it all works. When you sell goods there's no way to tell how much it should cost. It may be sold at manufacturing cost or it could be sold with a huge markup, especially if it costs absolutely nothing to produce more of the same goods or it costed absolutely nothing to obtain them in the first place. How does one tells the right cost? It costs exactly as much as it is worth. If it's worth 100 million interstellar credits to someone, that's what it costs. So in a free market, things cost in ballpark of how much the buyers are willing to pay for them. If they're willing to pay more, it gets pricier since that way the seller makes more money. If they're not willing to pay as much, it has to get cheaper to sell at all.
pedrosgali
Party member
Posts: 107
Joined: Wed Oct 15, 2014 5:00 pm
Location: Yorkshire, England

Re: Balancing game economies

Post by pedrosgali »

Thanks for taking the time to look. :)
I understand your point, but how do you approach programming an approximation of a system with no rules?
I tried to simplify the factors involved in free trade with a few broad rules, for example if goods are abundant then prices fall if they are scarce they should rise. Also it's bad business to sell goods for less than it cost to make them so I added a simple check for that.
The numbers I get for price data fluctuate rather well using these simple systems so I'm not sure they are the problem. The real trouble I'm having is all the planets filling up rendering trade pointless.

Code: Select all

if not wearTheseGlasses() then
  chewing_on_trashcan = true
end
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Balancing game economies

Post by raidho36 »

Market behaviour is a sum of everyone's personal judgement. This is why using formulas to simulate it is never good idea. Instead you should program individual market agents to make their own judgement regarding buying and selling things. Then functioning free market will emerge out of it. It's like mind, intelligence and personality are not a real entity, but rather an emergent function of collective operation of billions of simple monocellular organisms, which are individually not much more than automation.
pedrosgali
Party member
Posts: 107
Joined: Wed Oct 15, 2014 5:00 pm
Location: Yorkshire, England

Re: Balancing game economies

Post by pedrosgali »

But surely to determine a cost each market actor will pay you would need a formula to determine that number, also the seller is an autonomous actor trying to maximize his or her profit thus setting a selling price is a compromise between the two values.
Any way you slice it I feel you still require a formula to determine a value. Also rules to the game mean that players can more easily spot trends in the market and thus make smarter trade decisions.
I agree that in real world terms these are much more complex than the systems I'm using but the numbers are good and they fluctuate as I would expect in a more complex system.

Code: Select all

if not wearTheseGlasses() then
  chewing_on_trashcan = true
end
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Balancing game economies

Post by raidho36 »

Then I'm afraid I can't help you much. Economists have been shit out of luck with boiling down market interactions to concrete formulas or scenarios for decades upon decades - much like psychologists, because fundamentally market hinges upon actors' psychology.

Also no you don't need any formulas. You just make the seller guess how much it will sell for, possibly using current market trends, and then adjust the price to maximize profits. The same way you do in real life.
pedrosgali
Party member
Posts: 107
Joined: Wed Oct 15, 2014 5:00 pm
Location: Yorkshire, England

Re: Balancing game economies

Post by pedrosgali »

I will be doing some simulations later today using your idea for this, anything I've said so far is just based on my intuition rather than any concrete data. I'm not home currently but I will be taking a serious look into your ideas or maybe a combination of both. Please don't think I'm just disregarding your opinion, I will be exploring it further. Again thank you for taking time to help. :)

Code: Select all

if not wearTheseGlasses() then
  chewing_on_trashcan = true
end
User avatar
airstruck
Party member
Posts: 650
Joined: Thu Jun 04, 2015 7:11 pm
Location: Not being time thief.

Re: Balancing game economies

Post by airstruck »

It sounds like you're more or less happy with your approximation of economy, but the problem is that at some point everyone is always fully stocked with everything, is that right? Have you thought about tweaking something outside of your economy simulation? For example, maybe "actual scarcity" instead of rarity (finite amount of resources occur naturally; can't stock more because there's no more to stock), or maybe stocked resources expire after a while, or storage or acquisition costs become prohibitive, or the more storage space you have, the more likely some of it is to get wiped out by natural disaster; something like that?

Just spitballing ideas here; even though a simulation with autonomous agents might be more accurate or interesting, I wonder whether it would actually fix the problem you're having (at least, I'm not sure why it necessarily would). if you're happy with your current economy solution you might try keeping it in place and finding a more direct way to prevent the storage problem.
pedrosgali
Party member
Posts: 107
Joined: Wed Oct 15, 2014 5:00 pm
Location: Yorkshire, England

Re: Balancing game economies

Post by pedrosgali »

I'm not sure currently, that's why I'm putting it to the forum. I like the independent actor idea but have no idea yet how I'd implement it. I tried the finite resource idea at first but that yields the opposite result and everywhere ends up empty and prices skyrocket. Fortunately I made it in such a way that I can just drop a new system in pretty easily. Thanks for the ideas though, I'll be doing more on this tonight.

Code: Select all

if not wearTheseGlasses() then
  chewing_on_trashcan = true
end
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Balancing game economies

Post by raidho36 »

Yeah you see, that's the problem with trying to tie it up to formulas - it's pretty much guaranteed to act unnatural, and getting it under control will require more and more patching and there will still be weird issues with it.

Also I don't see what's difficult with implementing a merchant system. You already have merchant ships and marketplaces, now all you need is to design a simple AI and make it do the business on each end. Every entity wants to maximize its profits. Sellers want to try to sell at a higher price, and buyers want to buy at a lower price. Seller monitors its sales and makes decisions about increasing or decreasing prices. Buyers make effort to buy from sellers that offer lower prices.

Note that it probably not gonna work if there's only traders. There has to be production and consumption of goods. Traders will pay manufacturers for new goods, and local buyers will buy items from traders. Note that the trader may cover significant distance before selling its goods, like if it finds a place where it'll sell for more. It's also probably a good idea to limit the amount of money buyers can pull out of their ass, so that the player can keep up with the inflation.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 19 guests