How to manage which AI enemies are spawned?

Hello and thanks for any help or guidance in advance.
I’m trying to make a game with 20 different enemy AI’s across 100 levels/stages. What I can’t wrap my head around is how to change the percentage or chance the “harder” enemy AIs will spawn more fequently at higher levels while the lower level enemy AIs will have a less percentage of spawning. I want to learn how to do this procedurally in some way so that as the level/map generates the progression through the levels seems smooth to the player. Is there any kind of AI I could script or “Spawn Manager” something to decide which enemy AI would be best to spawn based off a range?
Example: Say I have five different zombies ranging from A through E with A being the easiest enemy and E being the hardest. At player level 1, enemy A has a 100% chance to spawn, but come player level 10 say it’s A 30%, B 30%, C 10%, D 0%, E 0% chance to spawn.

You will need to create something like a spawning manager. It will come handy if you decide that you want to spawn them in waves or at intervals.

From this point there are 2 solutions

SOLUTION 1

The spawn manager needs to have access to a list of some kind of descriptor object (e.g. struct) with following information in it:

  1. level
  2. Total number of enemies spawned
  3. % of Type A
  4. % of type B
  5. etc

You can keep this list in game instance for example.

When you start level 1, the spawning manager will go to the list and do a for loop with break until it finds a struct with level equal to 1. Once found the loop will break and pass back the struct to the spawn manager.

Spawn manager will read the total amount of enemies it needs to spawn this level. Subsequently it will start from the hardest group and spawn the number of enemies that the corresponds to the % of the descriptor. (e.g. if level 1 should spawn 50% Type B and 50% Type A, and the total amount of 10, you will first spawn 5 of Type B and then 5 of Type A) If your percentages add up to more than 100% you will simply spawn more enemies unless you have been tracking the %'s and subtracting until you get to 0. If you want you can spawn only X amount at a time and wait until player kills them all, then spawning the second group.

SOLUTION 2

At runtime come up with the number and difficulty of monsters
Assign difficulty level to Monster from 1 to 5 (5 is hardest)

Spawning manager will look at level number and then based on a formula decide how many and which ones to spawn.

Example formula

Number of enemies: Current Level * 10

Max level of enemy: Current Level / 5 (clamped between 1 and 5) So max difficulty will be 1 at levels 1 to 10, 2 from levels 10 to 15 and etc. it will max out at level 25. Againt his is a suggestion, you can come up with your own formula

% of max level enemies: 10% + Current Level*2 (clamp at 30%) (remember derived %)

% of enemy level max-1(if max-1 is more than 0): 20% + Current Level*2 (clamp at 30%) (remember derived %)

follow this logic and at every step check that the %s don’t add up to more than 100. if at any point they do, clamp to whatever’s remaining until 100%.

If at any point you have leftover % just spawn the weakest ones for that amount (will happen on lower levels)

Good luck!

Still searching for guidance