Game Market Simulation

Abstract

This document describes the mathematical foundation behind the price generation and market dynamics of the game. The model is inspired by financial markets, using random processes and market factors to simulate the fluctuation of asset prices. The primary mathematical concepts employed include geometric Brownian motion, random drift, and volatility, which together form a stochastic process for price generation. We present the formulas and their explanations, followed by a discussion of how these components are combined into a functioning market model.

1. Random Data Point Generation

The asset prices in the game follow the principles of geometric Brownian motion (GBM), which models stock price behavior using the following formula:

dSt=μStdt+σStdWtdS_t = \mu S_t dt + \sigma S_t dW_t

Where:

  • ( dStdS_t) is the price of the asset at time ( t ),

  • ( μ\mu ) is the drift as average rate of return over time,

  • ( σ\sigma ) is the volatility as the randomness or risk in the market,

  • ( dWtdW_t ) is random component as a Wiener process

In discrete time, this becomes:

St+1=Ste(μ12σ2)Δt+σΔtZ S_{t+1} = S_t \cdot e^{(\mu - \frac{1}{2} \sigma^2) \Delta t + \sigma \sqrt{\Delta t} Z}

Where:

  • ( ZN(0,1)Z \sim N(0, 1) ) is a standard normal random variable,

  • ( Δt\Delta t ) is the time step.

2. Initial Setup

At the beginning of the game, each asset is initialized with random drift and volatility:

  • Drift: A random drift is assigned to each asset, with a 60% probability of a positive trend.

  • Volatility: A random level of volatility is assigned to simulate market risk.

Formula for initial drift:

μ={DRIFT×(0.5+rand())if rand()<0.6DRIFT×rand()otherwise\mu = \begin{cases} DRIFT \times (0.5 + \text{rand()}) & \text{if } \text{rand()} < 0.6 \\ -DRIFT \times \text{rand()} & \text{otherwise} \end{cases}

3. Updating Prices Over Time

As the game progresses, prices update based on pre-generated data points, which simulate time evolution.

The absolute gain and percentage gain are calculated as:

percentageGaint=New PricePrevious PricePrevious Price\text{percentageGain}_t = \frac{\text{New Price} - \text{Previous Price}}{\text{Previous Price}}
absoluteGaint=New PriceinitialPriceinitialPrice\text{absoluteGain}_t = \frac{\text{New Price} - \text{initialPrice}}{\text{initialPrice}}

4. Market Influence and Weighted Average

The performance of individual assets influences the overall market performance. The market's value is a weighted sum of individual assets' performance, based on their allocation.

Let ( AiA_i ) be the allocation of asset ( ii ) in the market, and ( Pi(t)P_i(t) ) be the price of asset ( ii ) at time ( tt ). Then the market value ( M(t)M(t) ) is calculated as:

M(t)=iAiPi(t)M(t) = \sum_{i} A_i P_i(t)

The percentage gain for the market is calculated as:

Market Percentage Gain=M(t)M(t1)M(t1)\text{Market Percentage Gain} = \frac{M(t) - M(t-1)}{M(t-1)}

Where ( M(t1)M(t-1) ) is the market value from the previous period.

5. Summary

The game uses a simplified geometric Brownian motion model to simulate asset prices, where random drift and volatility generate price movements over time.

The combined performance of all assets influences the overall market, weighted by asset allocations. The result is a dynamic simulation where prices can rise and fall unpredictably, while still adhering to the underlying mathematical principles of financial markets.

Last updated