Zombies spawned from a new spawn point at one of the entrances to Concord. Why add extra spawns? There are many mods out there that sp...

Extra Spawns

Zombies spawned from a new spawn point at one of the entrances to Concord.

Why add extra spawns?

There are many mods out there that spawn actors in the game and some of them spawn extra Feral Ghouls that work with Zombie Walkers. The trouble is they tend to spawn creatures only in certain areas as is the case with the Zombie Apocalypse mod or spawn so frequently that they create an arcade-like experience.

I wanted a dynamic approach that would spawn not just in cities but also the country-side. Also, I wanted respawns to happen in a way that would flow with playing the game as if zombies wandered into the area in your absence.

Many players have asked for more zombies and while the spawn replacement changes have largely answered this, it still leaves areas of the game world empty once cleared when playing on survival. I wanted the outdoors to continually re-populate over time and keep players looking over their shoulders.

Where to spawn?

The first challenge is determining where to spawn zombies. Here are a few thoughts I had while working on this:

My first thought was to pick a location at a random distance from the player, but this would quickly lead to zombies spawning in places they shouldn't like inside buildings or water. 

I then started thinking about spawning them where creatures have already spawned. The trouble is I was unable to get a reference to the leveled creature markers via script. For a bit I considered spawning my own hidden spawn marker whenever a creature replacement was processed. The trouble with this is that it relied on replacements being enabled and would add extra markers to keep track of (not to mention slightly increasing save game size).

Then I started researching markers that already existed in the game and which ones I could dynamically query for via script. During testing, I spawned vertibird grenades or pre-war shiny cars at these markers so that I can see where they were. There are several types available, but two in particular stood out and were chosen for the first version: 
    1. Patrol Markers - 8,972 in base game
    2. Center on Cell (COC) Markers - 622 in base game
Center on Cell Marker at one of the entrances to Concord.

How to spawn?

In my experiments with spawn locations, I noticed that Patrol markers in particular are sometimes clustered in groups as many as 10-15. I didn't want to have 10-15 separate spawn points for what is essentially one area, so I needed a way to tag just one of them as a spawn point but the others as not. To do this I created two keywords: ZombieSpawn and SkipZombieSpawn.

I already have a script attached to a hidden quest that I use for replacements, so I was able to use that and simply add more aliases to it. The first alias was for "potential zombie spawn points" and the second was for checking if existing "zombie spawn points" should spawn.

The potential spawn markers are filled by any Patrol or COC markers in the load area around the player that have not been processed (has neither of the keywords). For each potential spawn point, I check the area around it for an already existing spawn point (within a certain distance). If there is already a spawn point nearby, then I add the SkipZombieSpawn keyword, otherwise I add the ZombieSpawn keyword which effectively turns that marker into a new zombie spawn point. Note that markers located in settlements, cities, or interior cells are excluded from becoming spawn points.

The existing zombie spawn points are filled by anything in the load area around the player that has the ZombieSpawn keyword. For each spawn point, some processing is done to check if this spawn point should spawn and if so zombies are spawned at that marker's location.

When to spawn?

Determining when to spawn was a little more tricky and may be an area that I revisit with some tweaks as this new feature is play tested. 

The first thing I added was a time constraint. The game has the concept of game days passed which you can get by calling Utility.GetCurrentGameTime(). Each spawn marker has an actor value added to store a timestamp in the future that signifies when this spawn marker is eligible to spawn. Basically I take the current value of game days passed and add to it.
  • Get current game days passed 
  • Add 2 - 10 days to it (configurable via holotape)
  • Make sure time is midnight so zombies spawn at night 
I made the time midnight to avoid mid-day spawns as I'm assuming most players sleep at night. If you happen to be out and about at midnight, you might be in for a few surprises as you wander around. "I thought I just cleared this area?"

Once a spawn point is eligible to spawn, it will start to fill in the zombie spawns quest alias where the timestamp is checked:

Zombie Spawn Point quest alias match conditions.
 The next step is to do a couple extra checks to impose limits on the spawning and hopefully avoid problems:
  • Zombies may not spawn within 3000 units of the player
  • A configurable max zombies threshold is checked before spawning to avoid too many zombies spawning within a given area (currently 10,000 units radius of spawn point)
  • Also, note earlier that spawn points are not allowed to be created in settlements, cities, or interior cells.

Future Plans

In the short term, I'll be interested to hear player feedback on the feature to see if I need to make any changes. There are configuration items for max spawns in an area and the maximum number of days between spawns for a given spawn point. I may expand on these configuration fields moving forward.

Another thought I had has to do with an escalating zombie epidemic. Maybe I could add an optional mode where spawns slowly increase in size and frequency as time passes in the game?

0 comments: