Overview
Gold Rush is a free-for-all minigame where players compete to collect coins launched from a central chest while avoiding falling bombs and each other. Players must maneuver carefully, as getting too close to an opponent can result in being kicked and stunned.
Coin/ Bomb Placement
A core mechanic of Gold Rush is the randomized placement of coins and bombs. Since the playable area is disc-shaped arena, I couldn't simply generate random X and Z coordinates, doing so would cause coins and bombs to spawn in restricted areas near the center and edges of the arena.
​
To solve this, I broke up the placement process into three steps:
-
Random Angle Selection - I randomly choose an angle from which the coin or bomb will be dropped
-
Random Distance Calculation - I select a distance from the center within a defined range to ensure valid placement
-
Trigonometric Conversion - Using trigonometry, I calculate the corresponding X and Z positions for the coin or bomb
Gaussian Randomness for Better Gameplay
While this method ensured that drops occurred within the arena, another issue arose: Unity's built-in random functions use a uniform distribution, meaning coins and bombs were spread evenly across all distances from the center. This led to less player interaction than desired.
​
Since avoiding bombs and other players is a key challenge in Gold Rush, I needed a way to naturally encourage players to cluster together. My solution was to apply a Gaussian (normal) distribution to the distance calculations. Unlike uniform randomness, a Gaussian distribution produces a bell curve, meaning drops are more likely to occur toward the center rather than being evenly spread across the arena.
Since Unity does not feature a way to use Gaussian distribution in its random functions I had to implement a function that would do so myself. To do this I utilized the Marsaglia polar method, a pseudo-random number sampling technique for generating standard normal random variables.

By applying the Gaussian randomness to coin and bomb placements, I was able to create a gameplay dynamic that naturally draws player toward the center. This increases player interactions and raises the likelihood that a bomb will land within a range of a player, making the minigame more engaging and competitive.

Uniform Gold Distribution

Gaussian Gold Distribution