Sign in to follow this  
Acharis

Market (supply and demand)

Recommended Posts

A medieval browser MMO. There are kingdoms and each kingdom has a market (by market I mean an economic ecosystem with prices, not a building).

There is a list of goods, each has a price (no difference between selling and buying price, just one price). Each player can sell/buy any amount of any goods, there is no track keeping on availability of goods, just the price. Every 8 hour the game compares the volume of sell and buy transactions in the last 8 hours for each good and adjusts the price (more sales - price goes down, more buys - price goes up).


Do you see any weak points of the system? Especially possible system abuse and price manipulation by the players?

Share this post


Link to post
Share on other sites
A player could move goods back and forth between kingdoms. A player could buy all of a resource type from a kingdom, and sell it to another. After 8 hour tick, prices will have dopped in the kingdom you sold to, but increase in the kingdom you sold from. You can now sell it back for large profits. 8 mour hours, and situation is reversed.
I assume there will be many players, and they would buy all goods from the markets and sell the specific goods types to the kingdom that offerse the best price.
Your idea is quite unstable.

Share this post


Link to post
Share on other sites
OK, for simplicity let's assume there is only one kingdom (I could make high transaction costs for inter kingdom trade).

With one market you can still do the same trick I guess, just not selling but stockpiling and waiting for the price change... I think there need to be some track of goods volume in a longer period. And some transaction costs (like sale tax) so buy and sell price is not identical.

Maybe base the price on all transactions in the last 30 days? Althrough then the price might be a bit too static...

Share this post


Link to post
Share on other sites
[quote name='Acharis' timestamp='1318624188' post='4872663']
...there is no track keeping on availability of goods, just the price.
[/quote]

Economics is driven by scarcity I don't think there's really much way to prevent people gaming the system if there isn't a limited supply of goods.

The best implementation I've seen [i]without[/i] scarcity was Age of Empires II, an RTS. In AoE2 anyone who built the market building could buy and sell stone, gold, and lumber. Every time a commodity was bought the price when up, every time a commodity was sold the price went down. All players had the same prices and they were updated instantaneously.

Tracking commodities wise, I think the best implementation I've seen is an auction-house style free market where players set their own prices, succeeding or failing based on demand.
Over the past week I've been watching the market for a particular pet on WoW, and seen it's price rise up to 50 gold, then plummet to 27 when more suppliers entered the market. That's exactly what basic economics says should happen, and given enough time the market will stabilize to the "ideal" price.

Share this post


Link to post
Share on other sites
[quote name='ShawnCowles' timestamp='1318679529' post='4872802']
[quote name='Acharis' timestamp='1318624188' post='4872663']
...there is no track keeping on availability of goods, just the price.
[/quote]

Economics is driven by scarcity I don't think there's really much way to prevent people gaming the system if there isn't a limited supply of goods.
[/quote]But the scarcity is represented by high price, not by lack of goods. It's not that there are no diamonds in shops for you to buy, it's that their price is very high and you can't afford them :)
In any real market (except a really, really tiny one) you can always buy whatever you desire, as long as you are willing to pay the price.

Share this post


Link to post
Share on other sites
[quote name='Acharis' timestamp='1318680539' post='4872806']
[quote name='ShawnCowles' timestamp='1318679529' post='4872802']
[quote name='Acharis' timestamp='1318624188' post='4872663']
...there is no track keeping on availability of goods, just the price.
[/quote]

Economics is driven by scarcity I don't think there's really much way to prevent people gaming the system if there isn't a limited supply of goods.
[/quote]But the scarcity is represented by high price, not by lack of goods. It's not that there are no diamonds in shops for you to buy, it's that their price is very high and you can't afford them :)
In any real market (except a really, really tiny one) you can always buy whatever you desire, as long as you are willing to pay the price.
[/quote]

True, I guess I was thinking more of preventing cross-kingdom trade abuse. If I move 500 diamonds from Kingdom A to Kingdom B I most likely wont make a profit trading them back. But if the prices for diamonds in Kingdom A keep low (because they are being produced there) I could do regular trades between markets, forming a trade route.

I suppose you could have the same effect just with prices. I'll have to think upon it some more, I guess.

Share this post


Link to post
Share on other sites
I have thought of using the same idea for an economy model and realize it can be abused depending on how you calculate the way the price fluctuates.

Example 1,
Fixed amount changes.
If you move the price up or down by 1% depending on the volume.

If given enough resources I will corner the market and just making sure selling volume > buying volume continuously for a period of time until the commodity I am targeting hit the bottom say 1 gold/unit.

From then on the market for this commodity is controlled by me, I can just buy in bulk whenever I want and just profit from having such a cheap supply (with occasional manipulation to keep it rock bottom).

This may be prevented if your market is big enough to prevent a particular player from cornering one commodity in one market.

Example 2,
Percentage amount changes.
Slightly harder, but still achievable you just need a longer period of time to drive the market down.

Suggestion,
Keep track of scarcity of goods, then move the prices based on availability of goods in meeting this demand.

Share this post


Link to post
Share on other sites
[quote name='Acharis' timestamp='1318680539' post='4872806']But the scarcity is represented by high price, not by lack of goods. It's not that there are no diamonds in shops for you to buy, it's that their price is very high and you can't afford them :)[/quote]
My God!! No.
There actually are intentional attempts from individuals with dominance in the market or powerful influences try to alter the supply in order to keep prices high. Diamonds is exactly that case.

But commonly, it's the other way around, it's because there are not enough diamonds in the shop that the price is too high.

In the basic microeconomic model (which is really, really simplified; but the principle still drives it), the price is driven by the maximum profit the seller can make. Which means the equation Price - Cost = Maximum.
The diamond shop will prefer to sell 900 peanuts at $200 each, rather than selling his entire stock of 1800 peanuts at $50 each. He could try selling at $80 each, but then he may only sell 1000 peanuts. It's called [url="http://en.wikipedia.org/wiki/Elasticity_%28economics%29"]elasticity[/url] (see [url="http://en.wikipedia.org/wiki/Price_elasticity_of_demand"]demand's elasticity[/url]).

900 * 200 = $180.000
1800 * 50 = $90.000
1000 * 80 = $80.000

More units solds != more profit.
But in the end, [u][b]elasticity is indirectly driven by scarcity[/b][/u]; elementary goods like food are highly inelastic because of their scarcity and lacks of substitutes; while goods like diamonds are highly elastic.

But we've just analyzed it from a demand perspective.
[url="http://en.wikipedia.org/wiki/Price_elasticity_of_supply"]Seeing it from the [b]supply point[/b] of view is a whole different side[/url] (see how availability of raw materials is listed as one of the determinants).

If the owner can sell his entire stock of 1800 peanutes at $30 each, and he can still sell them at $40; he'll sell it for $40.
If his stock is now 20.000; and he invested an insane amount of money, he'll need to recover it, and may end up selling it as fast as he can at the lowest possible price.

How this all plays depends on the market you're in. Monopoly vs Perfect Competition; and we're usually in the in between.
If you look at Real Life (tm), it uses a market closer to a monopoly (try counting how many CPU makers are, how many dominant GPU vendors exist, how many milk derivatives manufacturers exist that don't actually all belong to the same company, etc); but I recommend you to implement a more perfect competition system because it's the one everyone understand most, it's usually more fair (specially in a video game!, where you want to prevent frustration) and we somehow tend to think reality resembles more to a Perfect Competition (may be we're naive? light hearted?).

Cheers
Dark Sylinc

Share this post


Link to post
Share on other sites
[quote name='Siao' timestamp='1318817850' post='4873293']
I have thought of using the same idea for an economy model
[/quote]Have you managed to make it work?

[quote name='Matias Goldberg' timestamp='1318826907' post='4873318']
But commonly, it's the other way around, it's because there are not enough diamonds in the shop that the price is too high.
[/quote]There is [b]always[/b] enough diamonds in the shop, if there is not, it means the shopkeeper is incompetent and put the wrong price tag :) The price determine if you can buy it or not, not the lack of goods on the shelves.


Hmmm, maybe make the game act like a merchant? The game puts on sale X1 goods on price Y1 and is willing to buy X2 goods for price Y2 (so the player can both buy and sell the same good, just the price is different). When the game sells the quota, you can't buy it until the next cycle. Also, it keeps the goods warehouse. So, initially there are 0 goods on the market, then players produce and sell some and the next cycle after they sold it the game put it on the market. The game could even keep the "average acquire cost of the good" and never put on the market anything for less than "average acquire cost +5%".

Share this post


Link to post
Share on other sites
Depends what you are trying to achieve. I've played a couple of games with a central market and they can be quite easy to manipulate. Evony is an example of one I played ages ago where I quickly learned I could make as much money as I wanted by just buying and selling the same commodity over and over again. All I had to do was for examples set a buy order for 1 million iron at a price of .3 and then a sell order for 1 million at .7, after they are completed I just repeat as needed. After a couple of days I had more gold and resources then I could possibly use.

If you are going to let players trade large quantities of goods through a central market there will be plenty who will use to make money through price manipulation

Share this post


Link to post
Share on other sites
Market manipulation is fine as long as your gains come from other players. If you can make money in such a system, it means someone else lost it and it was the player's inability to properly use the system that led to his loss or your profit came from your ability to plan ahead and provide a service to the other players. You gave them resources now in exchange of money or money now in exchange of resources. Your profit is your risk for holding these resources hoping to turn around and sell them for more.

If you can manipulate a non-player controlled system due to a flaw, then those who refuse to exploit the flaw will be at a disadvantage. That one is bad for your game.

Share this post


Link to post
Share on other sites
I did a simple test to see if I can force a price to hit rock bottom. Based on following formula.

If selling amount outnumbers buying amount price reduce by 1 gold.

A manipulating player who understands this formula can just continuously sell more then buyers, one way to achieve this is to go some remote places where other players will not take note and since there is no actual goods (30 tons of iron) I can just buy and sell any amount in this remote kingdom, I can basically force the price down by making large amounts of selling, or if there are no buyers in this kingdom just selling 1 unit will be sufficient. Assuming I have the resources to keep selling (buying from other kingdoms to make up for the amount I am selling). After a number of ticks (in your case is 8 hours), the price hits rock bottom of 1 gold (assuming that is the minimum price for any object).

This is basing on a few assumptions, like having enough resources, other players have not discovered this and attempt to buy in on the cheap which disrupts the manipulator's plan.

I tried to tweak this by using the following formula:
If selling amount outnumbers buying amount price reduce by 1 percent of current price.

This does not solve the problem at all, only makes it harder for a player to manipulate the market as he needs more ticks to make the price of an item drop to rock bottom.

That's when I drop this idea and started exploring tracking the actual goods.

Share this post


Link to post
Share on other sites
Maybe like this:

* Virtual Merchant (VM) - buys goods and put goods on sale (both prices are different of course). It owns actual goods (can't put on sale whe he has not). The algorithm is trying to make a small profit (won't attempt to optimize for profit or monopolize).
* Virtual Client (VC) - is buying a certain volume of goods on regular basis. How much he is willing to buy depends on number of players in that kingdom and on the current price (will buy more if price is low). Has unlimited money.

So, the player is mostly adding goods to the economy (producer) while getting money from it (the game will take the money back via various costs not related to the trading part of the game).

The Virtual Merchant would base his decisions on the Virtual Client. Like, he will stockpile goods up to 1 week worth of current VC's buying volume. Also, he will never buy at the higher price than what at maximum VC is willing to pay. The VM would always put on sale 60% of his goods (keeping a reserve for the next cycle). VM will buy goods up to 1 days worth of VC buying volume (as long as stockpile is below 7 days). The price depends on the VM's stockpile volume compared to VC's spending volume for that price point.

Share this post


Link to post
Share on other sites
Spotted a potential problem in the Virtual Client where the client "will buy more if price is low" this sounds to me like price fixing. What is interesting is who is controlling the VM? AI? How is VM creating his goods?

You need to be careful not to create a market that excludes the player, example, you will always have a VM selling to the VC thus a player can never sell more then what the VM is selling else will the VC buy from the player? You will always have a VC buying from a VM thus ensuring the VM's survival. Correct me if I am wrong, cause I am very interested in your VM/VC idea.


For me I am now looking at having a proper supply and demand.

Demand = Population will buy a fixed amount of item categories every tick (e.g. 2000 pop will buy 2000 tons of grain every tick) depending on the size and prosperity of the population. The population will give a higher priority to necessities over luxury goods (e.g. grain over expensive clothes). The population will generate gold every tick, basically the formula to generate the gold is based on the prosperity of the town and region it is in. Using this gold the population will try to fulfill all its demand spending money wisely to fulfill as much demand as possible.

Supply = Players transporting goods to population centers and sell it on its market or buying contracts (e.g. deliver 2000 tons of grain to ton by this date) and fulfilling it.

Still very much a work in progress for me as the demand portion is really quite complicated, but I have already spotted a few problems.
1. How is gold generated without causing inflation, exploring a few ideas nothing concrete yet.
2. If no player is willing to supply some out of way towns, the towns can literally die out (if necessities are not met, population will shrink over time). Your idea of a virtual merchant is interesting, let me crack my brains on this to see if I can find a solution to this.

Share this post


Link to post
Share on other sites
VM is an algorithm (AI).
VM can not go bankrupt (he has unlimited money, althrough, will try act as if he has them limited, for example if the balance goes negative it will trigger emergency mode and the disparity between buying and selling price will be increased).
VM does not produce any goods, he buys goods from players.
VC can not die out, lack of goods won't affect him at all, he buys because he buys, not because he needs it.

You are right about the "excluding player" part to an extend. I will counter it two ways, first, the buying power if VC would be like 10% of all players (althrough I might have trouble model it that way) and second, VM will be desperately trying to stockpile goods at least a bit above VC demand and will try to optimize so at least a few units of goods are left unsold at the end of a cycle. And yes, the price will be partially fixed (based on VC min-max), but I think I would want min and max prices even without it.

The VC volume will be not equal on all goods. For example he will buy a tiny bit of grain and a lot of flour. Therefore, some players will buy grain to make flour for sale (so grain will be mostly player based good while flour will be VC based good). Generally, VC will have a low demand on all things players need (and on half products) and a high demand on things they don't need (and on finished goods).

In my case the gold inflation won't be a problem at all. It will be spent on the non economy parts of the game.

Share this post


Link to post
Share on other sites
OK, I coded the market system. You can check it at www.europe1300.eu (click 3rd button, you will be able to access "marketplace", also you can get raw resources to put on the market from "outskirts") if you are interested in that topic.

For now I'm concentrating on making it hard to speculate (please attempt to break/explain how it could be theoretically broken), in short trying to avoid making infinite money by the player (some smaller volume short term gains by the player from price speculation is OK and even desirable).
Market works in cycles (hourly right now), each cycle the price is altered. The price is based mostly on how many goods are stockpiled by the market. There are also selling/buying limits (market try to stockpile some goods and keep a reserve so something is reserved for further cycles). The market algorithm works as a selfish selfcentred one (it tries to make a not too big/not too small stockpile of all goods and earn money from the selling price and buying price difference, it does not concern itself with players needs).

Also, if you have made some market model too drop a link and explain how it works.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this