Zombie 'Wave-System'

Hello there,

I’ve been having trouble thinking of a simplistic way of creating a zombie ‘wave-system’.

Here is what I am trying to build:

A wave system (typically seen in zombie games). As the waves increase, zombies will increase in amount and strength (different zombie ‘types’ are spawned in on higher waves) Each round increases when the timer hits 00:00 OR if all zombies are killed. I’m trying to implement randomness, not a fixed set of zombies that will spawn each round.

Here is what I’m trying to avoid:

  • wave 1 || 3 blue zombies, 2 red zombies, 1 boss
  • wave 2 || 5 blue zombies, 7 red zombies, 2 bosses

Games that utilize/showcase this system include:

Those Who Remain:

Zombie Attack:

Zombie Rush:

etc, etc, etc…

I’m trying to stay away from making the rounds bleak and repetitive.

I haven’t seen any posts directly addressing a zombie ‘wave-system’, hence is the reason why I created this post. Let me know if there is a resource already available. Thank you! :smile:

10 Likes

I’m unaware of any resources which directly address a system which you seem to be looking for. However, I would argue that the system you seek is highly subjective and may be that way because of the specific use case you intend to implement it for. Although I’m unsure of the exact details, I would guess that “classic” wave systems are highly structure, meaning it is either explicitly defined or some sort of increasing function is used to determine “difficulty”. Before you look too much further into ways to introduce “randomness” into waves, I would stop to suggest you ask yourself how much randomness could impact the player’s ability to navigate a wave system. Different variables you introduce to produce a “random” effect can have various effects on the “difficulty” of each wave. For example, if the number of spawned zombies is varied, this will obviously increase the difficulty for the waves which happen to have more. However, variables such as spawn location would have a much smaller impact on the overall sense of “difficulty” while still avoiding the repetitive nature of waves. For that reason, I would take a moment to consider all variables which can change across waves (examples: number of zombies, type zombie, health per zombie, spawn location, speed, damage dealt to players, spawn frequency/how fast the zombie spawn, etc.) and group them into categories based on whether each variable will have a direct impact on “difficulty”, as perceived by the player(s), or the change will (at least mostly) only counter act this sense of “sameness” you seem to be running from. I would argue, however, than any “randomness” introduced into a wave system will always inevitably lead to some difference in “difficulty” per wave, which, depending on your context, may negatively impact a player’s experience. If too much “randomness” is introduced into each wave, and therefore the perceived difficulty shifted too much from one play through to another, there will be no benefit to the player to learn how to overcome each wave. I realize this may be your intent and you may want player’s to always feel as if they need to improvise in order to survive, however one of the most satisfying aspects of game, both consciously and unconsciously, is the ability to “game”/learn the system and therefore overcome it.

I find this question very intriguing, please keep us all updated on how you experiment with, and ultimately decide to implement this feature.

4 Likes

For the wave system, I would use a while true do loop to control how often the enemies spawn. Then I would make a for loop inside that for the timer. You could create a variable for the number of zombies and break the for loop after the number of zombies reaches 0.

For the randomness, I would create a table with all the different zombies that I had stored in replicated storage. I would loop through the table and spawn a random number of each zombies based upon what wave they are on. So it might be limited to 1-3 of each zombies for the first 5 waves and then go up to 2-4 of each zombie for the next 5 waves and progressively get harder as you go.

not tested, just an example to get you started:

local rs = game:GetService("ReplicatedStorage") -- path to zombies
local blue = rs.Blue --blue zombies
local red = rs.Red -- red zombies etc.
local zombies = {blue, red}
local zombiecount = game.Workspace.Zombies -- int value to track number of zombies, this can be deducted when the zombie is killed

while true do
-- spawn your zombies
    for i = 30, 0, -1 do --rounds would be 30 seconds
        if zombiecount.Value == 0 then --start new wave early if 0 zombies left
            break
        end
        wait(1)
    end
end

you will have to write the function for spawning the zombies and I would add a counter in there too so you know how many waves have elapsed since the start of the game. Hope this gets you started. Again, I would use the wave count variable as a multiplier when deciding how many of each type of zombies to spawn

2 Likes

Hey @East98!

Thanks for the response. I will definitely experiment with some variables and implement them onto zombies/rounds.

I can also agree that wave ‘randomness’ unavoidably increases the difficulty each time, as it testifies a player’s problem-solving skills.

Thanks again for the tips.

Best, Water_KKnight

Hey @icunicu1983,

Thanks for the starter-code. I do question how I could re-access the ‘while-loop’ after it breaks.

I also like the randomness idea.

Thanks, Water_KKnight

I’m not totally sure, but I think the break will break out of the for loop and not the while loop.

so wht I did was this-

 local waves = {5,10,15,20,35...}
local mobs = {
green = 1,
yellow = 5,
red = 7.......
}

–insert buncha ifs to check round,etc,etc.

local mobcount = waves[_G.round] + 0
for i,v in pairs(mobs) do
if mobcount/ math.random(3,4) >= v then
mobSpawn(i)
mobcount-=i
end
end

since pairs() goes thru table randomly u have ur random effect plus mobcount is divided by smthg random too.

the reason I am not gonna explain my entire script n all is well cuz… this

2 Likes

Use fuctions, and clone zombie from (example) replicated Storage. If you want to get “zombies: 30” get a local of the zombies to add and monitor if they died :slight_smile:

1 Like

I will recommend watching code orange. His zombie game tutorials is where I learned and made my own zombie game.

2 Likes

You would do an if statement I believe, and then do an else statement, though I am unsure if this is the right way to solve this.