How can I create COD Zombies type spawning?
I am creating a survival shooter game in which enemies are spawned similarly to how zombies are spawned in COD Zombies. I have created a single spawner which spawns waves of enemies, but what I want to do is create multiple spawners to be able to be placed around the map and have those spawners only spawn enemies when the player is in a certain vicinity of them. It is going to be a fairly large map, and it wouldn't make sense for every spawner on the map to be spawning enemies if the player isn't close to them (ie. player on one side of the map, spawner on the opposite side spawning enemies). How do I create a system which allows a certain number of enemies to be spawned each wave like I have already, but also distribute the enemies being spawned to whatever spawners the player is near?
asked Oct 30 '18 at 04:26 AM in Blueprint Scripting
A high level overview of how I would set something like this up is have some kind of MasterSpawnManager which stores references to all of the individual spawners in the level, and then that holds information like how many zombies to spawn, how many have spawned, etc (Depending on your game structure, you can do this all in the gamestate as well, which is where I'd probably put it).
The second part of this is knowing if the player is close to a spawner. One way you could do this is setup a collision volume around a spawner which overlaps with the player character, and when the character overlaps this volume, the spawner becomes "active", and when the player leaves, it becomes inactive. When it is time to spawn zombies, the MasterSpawnManager goes through all of it's spawners, gets the active ones, and then disperses the spawns between them however you want that to be setup.
I hope this helps!
answered Oct 30 '18 at 05:19 AM
Since there a ton of ways to do this, this is more of a design question than a technical one. I'll give you one method, but don't take it as the only/best one.
I would probably use 2 things; a Game State blueprint (GSBP) and a Zombie Spawn blueprint (ZSBP).
All of this is maybe a touch overkill to just achieve what you want, but it allows an easy way for more complex logic to be built on top of it.
Follow this question
Once you sign in you will be able to subscribe for any updates here