Galaxy Shooter — Phase II: Core Programming

Rob George
1 min readMay 19, 2021

Day 52 — Aspiring Game Creator

2D Game Dev: Galaxy Shooter

Objective: Balanced Power-Up/Pick-Up Spawning

To achieve a balanced system for power-up & pick-up spawning, Galaxy Shooter makes use of a Random Loot Table based on Weights.

In the example above, an Item class of Name, Prefab & Spawn Rate is used to create the — currently — seven power-ups and pick-ups in the game.

Each item is assigned a SPAWN RATE, following the system by GameDevHQ, weighted systems are not required to balance to a particular total, but instead are given weight. The greater the weight, the more likely the item will spawn.

Energy Cell (aka ammunition for my laser cannons) has a maximum weight of 50 and the Ultimate power-up has a spawn rate of 1.

The example above shows 2800 items spawned. As the weights in the spawn rate suggests, Energy Cell spawned more than 2x that of other items and the Ultimate power-up only spawned 23 times. Pretty good!

With Galaxy Shooter, Waves will be given/scripted particular power-ups and pick-ups, but they will still be random so the Waves will be unique … for the most part, on each play through.

--

--