How would you go about making an endless mode?

So I wanna make an endless game mode in my tower defense game where enemies just spawn for infinity and it gets harder with more and more enemies who are stronger and stronger.

How would you go about doing this? I don’t wanna use randomization because I want it to still be the same each time you play.

I thought of having a table from weakest to strongest of the enemies and then going to the next one every 5 waves but I feel they would lack variety.

Lemme know what you think

1 Like

A while loop and then I get a ranking of how many enemies I want in the round and which enemies are the hardest. I then just increment it every round

1 Like
local wave = 1

while true do
    Spawn enemies based on the wave.
    
    repeat
         wait()
    until
    All enemies are defeated.

    wave += 1
end
1 Like

I already have the wave system, just not sure how to go about spawning the enemies. (I mean I have spawn functions I’m just not sure if I should make a table of weakest to strongest enemies and increment it or smth else)

1 Like

Can you show us your wave script?

1 Like

Just looks smth like this:

	elseif wave == 9 then
			info.MobNumber.Value = 18

			mob.Spawn("Mob1",3,map)
			mob.Spawn("Mob2",7,map)
			mob.Spawn("Mob3",5,map)
			mob.Spawn("Mob4",3,map)		
			info.WaveOver.Value = true

I’m not rlly asking how to make infinite waves, I alr know how, I’m more so asking how would I go about making an automated mob choosing system. I don’t wanna manually make each wave, I want it to be more procedural and get harder over time

2 Likes
-- Infinite loop to keep spawning waves
while true do
	if wave == 9 then
		info.MobNumber.Value = 18

		mob.Spawn("Mob1", 3, map)
		mob.Spawn("Mob2", 7, map)
		mob.Spawn("Mob3", 5, map)
		mob.Spawn("Mob4", 3, map)
		info.WaveOver.Value = true

		-- Add a delay before the next wave spawns
		task.wait(5) -- Adjust the wait time as needed

	end
end
1 Like

I think for endless you definitely need to do a scaling value for #mobs, mob difficulties, etc. (nevermind for a capped wave system) itll be annoying to do repetitive elseifs like what you are doing now.

1 Like

yeah i dont wanna do it manually like that, tryna think of a system for just spawning harder and harder enemies in a sensible order

To be clear, I only meant to paste the code with the while true do. The top code was op original code