In the game I am designing I have to simulate a gold market. A market is, essentially, a place where people buy and sell a specific good, in this case, gold. The prices change, ideally according to offer and demand, in a continuous way. The most well known market is the stock exchange.
I am not an economist, and being exceptionally realistic is not a goal of this design. This primarily needs to resemble the behavior while still being slightly predictable and not so complex, in order to be a funny part of the game itself. I know that there is a lot of very complex models that I could apply, but this is a simple approach that I think it can work in a game.
My approach will use a random walk. It is usually defined in a recursive way, like this:
This definition implies defining and also . The first would be the initial price and the second one the “step”, a random value that is added to the initial price (it can be positive or negative) in order to get the next price (that can be bigger or smaller than the previous).
At this point, as I don’t know really how the rest of the game will be, I establish that . In order to get variability, I thought of the following definition:
is the uniform random distribution. The higher the variability, the smaller the possible change, thus the smaller its inverse, the bigger the possible change. So in this small model we have two free variables that we can control for the evolution of the market and .
It’s time for a simulation or two. I think that Excel will cut it.
In this images you can see already several flaws that this small model has: once the tendency is set (raising or lowering price), it is difficult that such tendency is reverted and it goes below zero (which for obvious reasons should not be allowed).
I will tackle this flaws and refine this model by adding more variables and trying to model tendencies and tendency changes.