Tower Defense Wave Generator

Updated on February 22, 2018 in [A] Unity Scripting
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
4 on February 11, 2018

Hi everyone! I’m working on a tower defense game, I started from the brackeys tutorial and moved on implementing some features I found intresting. Now I’m trying to generate the waves randomly, and it’s more difficult than what I thought, expecially to have some balanced and challenging stuff. My first approach was to simpy have an enemy pool, and to create each wave picking random enemies from this pool, limiting the maximum index I could use to pick from the pool based on the current wave index.

after some tests, I found this method too “random” since the waves didn’t have a “shape”, they were just a bunch of random enemies, and also as the game goes on, small enemies will still spawn and they won’t be challenging at all..


So my next approach, was to have some kind of “semantic” groups of enemies, and create waves made by some of these groups. Like a burstGroup with same kind of enemies but small spawn rate, followed by a longGroup of same enemies but slow rate and so on…

But I don’t have the right “formula” for this… I’m trying to figure it out, but I’m posting here just to see if anyone could have some suggestions!

Thank you!

  • Liked by
2 on February 14, 2018

What do you want your waves to behave like? Do you want the waves to be the same each play though or different?

on February 16, 2018

the idea was to have them generated ramdomly each time, but I’m trying to figure out how to do this in a fancy way

on February 20, 2018

A good place to start is to define what types of enemies can spawned in each wave then determine what is the max number of each of those enemies can spawn. You can then roll a random number to select the type of enemy from there. And in then if the number of those enemies is all ready at its cap just choose another one. I wouldn’t re-roll the random number to get a replacement though, because you could infinite loop. I would just choose the next type of enemy that is not a cap.



Show more replies
  • Liked by