Here's a simple example without any depth variables:
If System_Number = 21-25
Roll Random (4-8) for the number of ships to place.
Place that number of ships in valid locations, randomly.
Roll (1-100)
-1-10 then the ship is a Missile Cruiser
-11-20 Science Vessel
-21-30 Battleship
-31 - 100 Standard Cruiser
With a weight system this could be something like:
4-8 ships
Missile cruiser: weight 10
Science Vessel: weight 10
Battleship: weight 10
Standard cruiser: weight 70
If you want to tweak the spawn rates for different vessels, you only have to change one number. If you want to limit the number of battleships so that the player doesn't get screwed by bad luck, you can do something like:
4-8 ships
Missile cruiser: weight 2
Science Vessel: weight 2
Battleship: weight 2
minus number of battleships presentStandard cruiser: weight 14
IF you want things to vary with depth, like in
Number_of_Monsters = 4-8 plus Depth/10. That would give you +1 monster every 10 levels.
Now place that many monsters by looping through the Fire Level Table.
Roll 1-20 (plus Depth)
-1-9 = Lil Sparky (by depth 9 there are no more of these)
-10-18 = Lil Flamer (by depth 18 there are no more of these)
-19-27 = Big Sparky (rare on level 1, getting more common as level's progress, then cut out at level 27)
-28-36 = Big Flamer
-37+ = Fire Mini Boss (cannot show up until level 17, 1/20 or 5% chance, by level 36 they are all you get)
You can do something like this (the probabilities are slightly different here, I just chose something with easier arithmetic):
Lil Sparky: Native_Depth = -5
weight = 15 - abs(Native_Depth - Depth)
if weight < 0: weight = 0
if weight > 10: weight = 10
Lil Flamer: Native_Depth = 5
weight = 15 - abs(Native_Depth - Depth)
if weight < 0: weight = 0
if weight > 10: weight = 10
Big Sparky: Native_Depth = 15
weight = 15 - abs(Native_Depth - Depth)
if weight < 0: weight = 0
if weight > 10: weight = 10
Big Flamer: Native_Depth = 20
weight = 15 - abs(Native_Depth - Depth)
if weight < 0: weight = 0
if weight > 10: weight = 10
Fire Mini Boss:
weight = Depth - 20
if weight < 0: weight = 0
I'm using the absolute value function (abs) here; that just gets rid of minus signs, so abs(-5) = 5. You can also use the max and min functions to get rid of those weight<0/weight>10 lines. abs(Native_Depth - Depth) will give you the distance between this depth and the native depth.
Just as a formula in a finished, balanced game, a weights system isn't much easier than the dice system, but if you're tweaking and balancing it's a lot easier to alter one monster's spawn rate without affecting the other monsters, or to add and remove monsters. For instance, if you pointed out that in my version, a Big Sparky can't spawn on level 1, all you do is change its native depth to 14. Everything else gets calculated automatically.
You can also mix in any variables from the game, like details from the spawn tile:
Science Vessel: weight 6 (spawn tile is near a nebula), or 2 (otherwise)
Troll: weight 13 (spawn tile is a bridge), or 3 (otherwise)
If you want a certain monster type to be common in a small range of levels, you can do that easily:
Fire Cultist: Native_Depth = 12
weight = 3 * (5 - abs(Native_Depth - Depth))
if weight < 0: weight = 0
if weight > 10: weight = 10
This monster spawns in a 10-level range, rather than a 30-level range like the rest of them, but the weight still goes up to 10 on levels 11, 12, and 13.