Price of goods simulation for a shop

Started by
12 comments, last by psychictreason 16 years, 10 months ago
Hi all,

Finally I've managed to get back to this after that destroyer of plans, "life", came into play for the last few days.

Right, I've had time to digest all the *very* good responses - thanks a lot for this guys.

I think in order to keep it simple I might need to assume that each "market" is essentially stand alone and then peg certain products according to some level of cheap supply. So for example buying grain in the market situated in the middle of the agricultural belt would be cheap as it would be plentiful first and because of it's "zone" it would be generally a cheaper commodity than maybe something like steel which would be in mountains and would be cheaper there.

I don't really need ultra realistic market places in this, just a general addition to the flavour of the rest of the game.

So my next set of questions then are related to this:

Assuming that for each market that we have some banding on rough prices. Take the example above. In the agricultural town [call it A]:

Grain rough cost is around 1credit - 1000 units in stock
Steel rough cost is around 10 credit - 5 units in stock
Sheep rough cost is around 5 credit - 200 units in stock

Town B [the steel mill / mine] has:

Grain rough cost is around 3 credits - 10 units in stock
Steel rough cost is around 6 credits - 150 units in stock
Sheep rough cost is around 7 credits - 30 units in stock

Obviously these prices are arbitrary but lets assume I use some sort of banding algorithm to set the start price in a particular market.

Now if I buy 100 units of grain and 5 sheep from Town A, what happens to the prices there after I've decreased the amount of stock? Presumably go up slightly - but by how much and how do I mathematically calculate it.

Then when I go to sell the grain and sheep to Town B, what happens to the price of the commodities after I sell it? Again it should go down slightly but by how much?

After this I can add some slight randomness in to account for things like season etc as well...

Again any ideas would be gratefully appreciated. I feel like I am almost there from the suggestions thus far but am not quite grasping exactly what I need to do mathematically...
Advertisement
Quote:Original post by Mr Grinch
I think this is a tricky problem to handle well. We have gone around and around trying to get decent market movement in Crown and Cutlass, but never really gotten anything we like.

Ravuya, does it really make sense to charge next to nothing if a shop-keeper has only 1 qty in his shop, but there are 100 total items in the world? Perhaps it does if the other 99 items are at the shop next door (I'm still not convinced), but what if they are on the other side of the world? In a world like Elite or Freelancer, the distance between shops shouldn't just be ignored. Even for trading within a single "town", does it really make sense that a shop with 10% of the inventory of another would be charging 1/10 of the price of the other?

What happens when you come into a town that owns 1/100 items (let's say a max price of 100, giving a price of $1), and you sell 5 items to the shop. Then the price suddenly goes to $6? That doesn't make sense to me. The supply goes up, so the price goes up? I don't think anyone would expect that to happen and it certainly goes against the basic rules of supply and demand.

Edit: Also, consider what happens with 0 qty. The shop keeper won't even give you money if you sell an item just because he happens to have none of it.


There should be a minimum price, asked and paid regardless of demand and supply: sale price= minimum price + (maximum price - minimum price) * (quantity in store / total quantity).

But monopolistic price increases involve demand, not only supply: a more realistic model should increase the price with respect to other stores if on the whole customers prefer to pay higher prices than travelling to cheaper stores.

For example, suppose there are two fletchers in villages A and B and an adventurer needs to buy n arrows. Going to either village, from wherever he is, costs Ta or Tb (lost work, inns, risk, mere unpleasantness, etc.).
Let's assume the adventurer knows the prices Pa and Pb of fletchers A and B: he'll rationally go to A if n*Pa+Ta < n*Pb+Tb and to B otherwise.

These individual decisions add up, allowing the two fletchers to optimize prices for maximum profit according to their model of how random variables Ta, Tb and n are distributed over the adventurer population.
Simple models can fix n (the purchased amount) at a reasonable uniform level depending on carrying capacity (as would be the case for arrows), amount commonly needed for one use (e.g. rations of perishable food) and other heuristic criteria.
T can be approximated by a discrete distribution containing only the travel costs from known sites of special customer concentration (e.g. dungeon entrances for adventurers) to each store and back, weighed by the customer populations of each source.

Omae Wa Mou Shindeiru

Once idea is to have two prices for each good a minimum and maximum. Then for each commodity a store trades in give it a consumption value, and an ideal number of days stock to have. Or just an ideal stock value. Then calculate prices as max * (1-stock/ideal) to a minimum of min.

Then you can do the following.
Grain 10 – 100
TVs 70 – 500

Town A
Grain
- ideal stock = 1
- stock = 5000

TVs
- ideal = 300
- stock = 50

Prices
Grain = 100 * (1 – 5000/1) = 10
TVs = 500 * (1 – 50/300) = 417

Now if player sells 100 TVs the price would change to 250, selling 10 TVs would change to 400


Hi Lorenzo and Techno.

Thanks loads for these additional ideas - this has really pushed things on for me massively. I was really getting bogged down in trying to model supply and demand curves and it was starting to get a bit complex.

I think a combination of these two ideas will work really well as techno's lets me model a particular market and using Lorenzo's idea I can create individual differences so I think the combination of these things will work well.

I'm off now to create a little model and see how it works in practive with several commodities and differences in locations.


Again thanks to everyone for your help on this - much appreciated.

Cheers
Andrew

This topic is closed to new replies.

Advertisement