Best practice for level monster spawns?

Hey there,

At the moment I have 3 possible spawn points for monsters and an array of different monsters. Right now I’m randomly selecting a monster every second round and then spawning it at one of the 3 points at random. This has been good for test purposes but it obviously wildly differs in difficulty from round to round.

I know I could make a script for every level and hand pick the monsters and placement, but I’m wondering if there is a superior way of doing this?

This is what my current spawnMonster script looks like.

void spawnMonsters() {
        if (round % 2 == 0) {
            int randMonster = Random.Range(1, 11);
            int randNum = Random.Range(0, 3);
            while ((randNum == 0 && BusyCheckLeft.LeftLaneBusy) || (randNum == 1 && BusyCheckMid.MidLaneBusy) || (randNum == 2 && BusyCheckRight.RightLaneBusy)) {
                randNum = Random.Range(0, 3);
            }
            if (randMonster < 2) {
                GameObject monster1 = (GameObject)Instantiate(Monsters1[0], new Vector3(randNum, 0.1f, 5), Quaternion.Euler(90, 0, 0));
            } else if (randMonster >= 2 && randMonster < 5) {
                GameObject monster2 = (GameObject)Instantiate(Monsters1[1], new Vector3(randNum, 0.1f, 5), Quaternion.Euler(90, 0, 0));
            } else if (randMonster >= 5 && randMonster < 7) {
                GameObject monster3 = (GameObject)Instantiate(Monsters1[2], new Vector3(randNum, 0.1f, 5), Quaternion.Euler(90, 0, 0));
            } else if (randMonster >= 5 && randMonster >= 7) {
                GameObject monster3 = (GameObject)Instantiate(Monsters1[3], new Vector3(randNum, 0.1f, 5), Quaternion.Euler(90, 0, 0));
            }
        }
    }

If your game is a tower defense, or beat/shot em up, or any type of game, where the difficulty grows every round, then I would take the time and make a monster editor. Most of the games have the monsters in a 2D array, 1. dimension is level number, 2. is monster types

Okay, sounds good. Would using a switch for rounds be the best method?

Although it’s not a TD game, there will be upwards of 15 rounds per level.

If it’s one type of monster per level/round then you could keep track of the level number & use that in the array to spawn the monster type.