waves of zombies in the l4d style

Hello guys, I’m new in all this ue4 and first of all I apologize for my bad English.
I wanted to know how I could implement waves of zombies in the l4d style
I know the quick answer is to implement spawns in different areas of the map, but I see these problems …

  1. they would always appear in the same place
  2. the player could see them literally appear
    taking into account that the player would be moving around the map, how do I generate these waves of zombies near the player and that is not visible to him?
  1. Randomise their location at spawn time; have several spawners distributed manually in the nooks and crannies the player can’t see; spawn zombies behind doors or windows that swing open and spew the dead out, rooftops, vents, grates

  2. as above or spawn them behind the player / behind an obstacle they’re looking at / distract the player with light / colour / sound so they turn away

For performance reasons you should also check out the new Animation Sharing Plugin which was released with 4.22. Check the documentation here: Animation Sharing Plugin | Unreal Engine Documentation

okay, suppose I have several spawns hidden around the map, how do I only activate the spawns that are close to the player? because if they were all activated it would be bad for the performance and the spawns more distant would take to reach the player

This would depend on how you envisioned the gameplay mechanic. Spawners can be on a timer and release just a handful of enemies to keep the player occupied. You can place trigger boxes in choke points the player has to pass through, activating connected spawners - that’s the most common method.

Proximity based approach is fairly easy to achieve, too - for something simple and reliable you can check with a sphere overlap whether there any spawners nearby and activate the ones that are are close enough to the player (check if the length of v1 - v2 is less than desired value).

Full disclosure - never made a zombie game but that’s the approach I’d try first!

You should also consider Object Pooling, because instancing so many actors at once during gameplay could result in noticable frame drops. By Object Pooling I mean something like this: Object Pool Plugin in Code Plugins - UE Marketplace

thank you very much guys, I will keep it in mind when starting the project

Yes, it’s a generic concept applicable to everything. Spawning an actor is very expensive. Instead spawn 200 projectiles at the beginning of the game or during load; keep them in an array, hidden and ready.

When you need a projectile, fetch one that is readily available; rather than destroying projectiles, flag them and move them back to the pool. Recycle what you have, you can make the pool dynamic - extend and trim it as need to. You trade a larger memory footprint (more actors spawned) for better performance (they’re already spawned!).

It does come with cons - if looking up and moving objects is more expensive than constructing them… then pooling is not helping much.