What's the best way to start the next wave in a tower defense game?

  1. What do you want to achieve?
    I have been working on a tower defense game for quite some time and it’s going along about 85-90% smoothly. I haven’t had too many issues so far, however the issue I have right now is probably the biggest issue I have had so far, that being knowing how to exactly structure when I start the next wave.

  2. What is the issue?
    I am unsure about how to make the system for starting each wave. I want to achieve something in games like lysandr’s Tower Defenders and BoringGames Studio’s Evolution Evade. A smooth wave transition that will end the current wave and start the next one when all the enemies alive in a round are defeated or the current round goes on for too long so the next one automatically starts. This is a head scratcher for me as I am unsure if my current idea for a solution would work well enough, plus, like quite a few features I have made in my game so far, this is my first time attempting this sort of thing.

  3. What solutions have you tried so far?
    I haven’t tried anything due to a lack of time but I have thought of a solution I was going to try and execute when I had the time to. Currently I have an enemies remaining value to track the number of enemies on the map. I was thinking about making a value for the total enemies to spawn (set on each round as the number will increase) and have a value incremented with each enemy that spawns, similar to my tracker I have, but it won’t decrease the value when enemies on the map die. I was thinking about running a for loop for a timer, and check to see if the number of enemies spawned that round is greater than or equal to the max number to spawn for that round, if so then I will call a function to start the next round, otherwise once the timer hits zero that same function will be called to start the next wave. I am not sure how efficient this solution is but in my head it seems like a good start. However, I am open to any better solutions/feedback people have.

1 Like

My first thought is to have a table of each waves amount of enemies and then only spawn that amount and simply detect when one of them dies and see if the amount left is 0. If it is then go ahead to an intermission and then spawn the next one. This is just a general idea since its tough to know exactly what to do without knowledge of your current system.

1 Like

This looks to be a good solution that I can try to implement when I am able to. I haven’t actually made a system yet because I haven’t had the time but this seems more efficient than what I had in mind.