Simple spawn balancing

Let’s go over a simple implementation of how to balance the spawning in the game.

The SpawnManager was adjusted to handle waves than one enemy in this article.

This is a bit down to preferences, however, I prefer handling the chance of random events based on percentage. Open the SpawnManager script and in the SpawmEnemyRoutine add an int to take a random value from 1–100 (remember the upper value in Random.Range is exclusive for ints, so if set to 101 it means it goes up to 100). Also add a local int that later on will take the value of which enemy to spawn:

Add the same amount of if statements as there are enemy objects in the array. Set the chances based on how difficult an enemy is, i.e higher chance for a simple enemy to spawn:

Lastly, spawn the enemy:

You can use the same balancing logic for the power-ups as well:

Good luck!

--

--

--

Unity / C# Game developer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Best Golang Websocket package

golang-websocket

Next Previous Link Button Pagination in Laravel

Web Development Trends to Scale Your Application in 2022

I love react.js

Vue.js or React.js

React: Form Validation (having nested schema) with Formik, Yup, and Material-UI

Custom directives in Angular 6 — building a Google places autocomplete

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Niklas Bergstrand

Niklas Bergstrand

Unity / C# Game developer

More from Medium

Tailgreeter Cure Bowl Preview — Northern Illinois vs. Coastal Carolina

The Tip Off: CBB Card (Tuesday Nov. 30th)

Silco: Arcane’s Beautiful Monster

Meet Matt and Shannon, Owners of Taplands!