So this is going to be an article about how I did the enemy selection in MicRogue.
The first thing I do is look at the list of possible enemies. When the game starts the game has access to only 4 enemies.
After collecting treasure more and more enemies are added to the game so eventually the game will have a much larger range to choose from.
Each character has a rarity number according to the floor. This is how often a monster can show up on a floor and also how often it shows up in the "Monster Bag" (More on that in a bit). Below you can see the rarity for the rat and skeleton across the first 4 floors
Rarity is also something that I can change as new monsters are unlocked, so as Rats are plentiful in the beginning of the game, they are much rarer after more monsters have been added.
Next I create something I have been calling the "Monster Bag". Each monster is dumped into an array for its monster rarity. so for the Rat having a Rarity of 4, 4 Rats are dropped into the "Monster Bag". so here are some examples of the "Monster Bag" early game and late game.
Next monsters are selected for the floor. So 4 Random Monsters are pulled from the bag, so even though there is an Eye in the bag, it might not show up, because there is only one in the bag.
The last thing I do is check the monsters that have been selected. Each monster has been assigned a Danger Value. The selected monsters must have a combined value over a base value, which I increase as the player goes through the game.
So if the combined value needs to be 5 or greater and 4 enemies are selected at least 1 rank 2 monster must be selected. and when a value 6 is needed you could have 2 rank 2 or 1 rank 3.
Well I think that is about it for now. Feel free to ask any questions.