Survivor Market: enemy spawns

A survivor settlement in an old railway shed — trade at six stalls, rest among the people who live here, then ride on.

Level id
market
Difficulty tier
1 — Explicit difficulty tier of the level (0 = the starting level). Metadata only: no automatic scaling of counts, damage or loot, and no enemy family is enabled by it. LEVELS.market.tier in game/src/levels/registry.ts:106 (repository access required)
Spawn profile
Survivor Market (calm: no enemies) — MARKET_SPAWN_PROFILE in game/src/ai/spawnTables.ts:799 (repository access required)
Spawns tried per level
0 (E = 0), over 2 generation contexts
Room modifiers
All 0 room keys resolve to 1× for every family (neutral); the profile sets no room modifiers

Generation contexts

A generation context is one run of the enemy placement code. Each run draws one count, uniformly from its range, and tries to place that many spawns. The contexts below are parts of the one Survivor Market level and are generated with it; they are not separate levels. A context that runs more than once per level (for example once per storey) draws a new count each run.

Survivor Market: spawns each context tries to place (count per run, uniform; per level = runs × count)
ContextStoreys one run coversRuns per levelCount per runE[count] per runPer levelE per level
The settlement (platform, stalls, square, housing deck): none — a calm pit stopstation data hookthe whole settlement (platform, stalls, square, housing deck)00U{0..0}000
Service annex (per annex)servicenone: the market grows no service annex (LEVELS.market.trackExtensions none)0one per zone (seeded)5–6U{5..6}5.50zone budget, not in the total5.5per zone
Whole levelall core contexts (zones reported separately)00

Spawns the level's context runs try to place (Σ runs × count). The family roll replaces, never adds; placed totals can fall short where eligible, spaced cells run out. Not included: the zone context 'service' (a per-zone budget of 5-6 per zone, 0-0 per level), reported separately.

Service annex (per annex): A PER-ANNEX ZONE BUDGET: one run per seeded service annex (0 to TRACK_EXT.annex.max per level, a generation census quantity — see docs/enemy-spawns.md "Service annexes"), on the annex's own fork, appended after every core spawn and tagged 'service'. It is additive to the core contexts and NOT in the whole-level total above; the level's zombie types apply; its spawns draw from the annexes' OWN family pool (SERVICE_FAMILY_POOL: a configured 20 % rat/dog selection share, Blightbelly 5 %, Strainer 8 % (the only pool that enables it: STRAINER_CONTEXTS), no Siren — per-spawn probabilities, not quotas). The seeded roster pass then runs on the finished level (see the seeded roster): it fixes the level's Strainers at EXACTLY ONE on the maps whose seed rolled the Strainer present, and at none on the others, and it decides per level whether Blightbellies and rat/dogs are there at all (the slot rules of the roster-only Screacher and BB list the core contexts, not the annex). The sampled census shows the outcome with the pass applied. Killed annex enemies stay dead for the run (per-index memory).

Service annex (per annex): its own family pool (configured selection share per spawn) — zombie 67 % · blightbelly 5 % · siren 0 % · ratdog 20 % · strainer 8 % · screacher 0 % · bb 0 %. This context's OWN pool: its spawns draw their family from it (the same single roll per spawn, room modifiers and eligibility on top) instead of the level pool. The shares are CONFIGURED selection probabilities per spawn, not quotas: a 5-6-enemy annex may hold none or several; the sampled census shows the placed outcome.

These are targets: the generator can place fewer when it runs out of eligible, spaced floor (see placement rules). The game has no per-area or per-square-metre spawn rate; the count is spread over the eligible areas of the context.

Generator: generateMarketLevel in game/src/gen/market/index.ts:82 (repository access required). ONE continuous level (LevelId 'market'): a calm survivor settlement in a salvaged railway shed where the player's train stops (the platform, six trader stalls, the market square, the housing deck), generated once per level seed. NO enemies: the generator never runs a placement (its one ambient context places [0, 0]), there is no horde pool, no Siren eligibility and no service annex (LEVELS.market.trackExtensions 'none'); its friendly residents are not enemies (never in layout.zombies). The seeded roster pass (ai/enemyRoster.ts applyEnemyRoster) does nothing here: a zombie-free level never holds any enemy family.

The settlement (platform, stalls, square, housing deck): none — a calm pit stop (station): count [0, 0]: a calm settlement, gen/market never asks for a placement run

Enemy families

Every placed spawn is one enemy family. A family's conditional share = weight / Σ weights (denominator 1) is the chance that the per-spawn roll of one placed spawn draws that family. It changes the mix, not how many spawns are placed. The seeded roster then decides whether this level holds each special family at all.

Every placed spawn draws its family independently: roll = enemyRoll(level seed, spawn index) ∈ [0, 1), walked over the pool weights of the spawn's room (the level pool when the room has no modifier), in registry order (the rat/dog keeps the top band; a family at weight 0 — the roster-only Screacher / BB — has no band). A drawn family REPLACES a zombie; it never adds to the count.

Survivor Market: family pool (per-spawn roll: shares conditional on one placed spawn; denominator 1) and the seeded roster on top
FamilyWeightConditional share (per-spawn roll)Expected per level by the per-spawn roll alone (before the roster)Seeded roster: chance the level's roll includes itPer level with the roster (sampled)
Infectedzombie0.90.9 / 10nevera zombie-free levelnone: a zombie-free level
Blightbellyblightbelly0.050.05 / 10nevera zombie-free levelnone: a zombie-free level
Sirensiren00 / 10nevera zombie-free levelnone: a zombie-free level
Tunnel scavenger (rat/dog)ratdog0.050.05 / 10nevera zombie-free levelnone: a zombie-free level
Strainerstrainer00 / 1level pool; its weight is in a context's own pool: Service annex (per annex) 8%0nevera zombie-free levelnone: a zombie-free level
Screacherscreacher00 / 1roster-only: no per-spawn roll draws it (placed by the seeded roster alone)0nevera zombie-free levelnone: a zombie-free level
BBbb00 / 1roster-only: no per-spawn roll draws it (placed by the seeded roster alone)0nevera zombie-free levelnone: a zombie-free level

Expected per level by the per-spawn roll alone = share × spawns tried per level (E = 0), with neutral room modifiers and before any placement shortfall. That is the stage before the roster pass. The last two columns are the seeded roster: a level either holds a family or has none of it, so the per-level figure of a level that holds it is higher than the long-run mean. Defined at ENEMY_POOL in game/src/ai/spawnTables.ts:125 (repository access required).

Seeded roster (which families this level holds at all)

Survivor Market is a zombie-free level: it holds no enemy of any family, and the seeded roster pass does nothing here.

Survivor Market: seeded roster — whether the level can hold each family, and the chance that a map's roll includes it
FamilyCan this level hold itChance the roll includes itOn this levelThe roll itself over level seeds 1 to 10000Sample levels with the roster (sampled)
Infectedzombieno: a zombie-free levelnevera zombie-free levelNever: Survivor Market is a zombie-free level — it holds no enemy of any family, and the roster pass does nothing there.not rollednone: a zombie-free level
Blightbellyblightbellyno: a zombie-free levelnevera zombie-free levelNever: Survivor Market is a zombie-free level — it holds no enemy of any family, and the roster pass does nothing there.not rollednone: a zombie-free level
Sirensirenno: a zombie-free levelnevera zombie-free levelNever: Survivor Market is a zombie-free level — it holds no enemy of any family, and the roster pass does nothing there.not rollednone: a zombie-free level
Tunnel scavenger (rat/dog)ratdogno: a zombie-free levelnevera zombie-free levelNever: Survivor Market is a zombie-free level — it holds no enemy of any family, and the roster pass does nothing there.not rollednone: a zombie-free level
Strainerstrainerno: a zombie-free levelnevera zombie-free levelNever: Survivor Market is a zombie-free level — it holds no enemy of any family, and the roster pass does nothing there.not rollednone: a zombie-free level
Screacherscreacher roster-onlyno: a zombie-free levelnevera zombie-free levelNever: Survivor Market is a zombie-free level — it holds no enemy of any family, and the roster pass does nothing there.not rollednone: a zombie-free level
BBbb roster-onlyno: a zombie-free levelnevera zombie-free levelNever: Survivor Market is a zombie-free level — it holds no enemy of any family, and the roster pass does nothing there.not rollednone: a zombie-free level

There is nothing to sample: a zombie-free level holds no enemy before or after the pass.

Roster version 4; the rules of the pass and every family's rule: the seeded roster. Defined at applyEnemyRoster in game/src/ai/enemyRoster.ts:285 (repository access required).

Zombie types (inside the zombie family)

Not separate enemy families. The types (coated, shambler) split the Infected family only; the family shares above do not change with them. Wardrobe outfits are a further appearance choice, also not a family.

Survivor Market: zombie type chance per spawn (before the at-least-one-of-each rule)
TypeChance per spawn
coated
shambler

Each spawn of a run: coated with the coated chance, else shambler; then, if the run has no coated, its first spawn becomes coated, and (count > 1) if it has no shambler, its second becomes shambler. Ratdogs keep the rolled type but ignore it.

Survivor Market: expected coated share of one context run (exact, including the at-least-one-of-each rule)
ContextSpawns in the run (n)Expected coated share
Service annex (per annex)5
Service annex (per annex)6

Shambler / coated type (the profile's zombie type roll) and the wardrobe outfit chosen at spawn time from (level seed, spawn index, type) by ai/wardrobe.ts pickZombieLook — sub-distributions of the zombie family, not separate families.

Defined at ZOMBIE_TYPES in game/src/ai/spawnTables.ts:379 (repository access required).

Baseline placement rules

These are the generator's own rules for where the counted spawns go. Room modifiers at 1× leave every one of them unchanged. They are also why a generated level can hold fewer spawns than its count drew.

The settlement (platform, stalls, square, housing deck): none — a calm pit stop · station · count 0 per run × 0 runs

One run covers: the whole settlement (platform, stalls, square, housing deck). Count per run uniform integer U{0..0} (rng.int, inclusive); E[count] = 0.

Which cells can hold a spawn

  1. a FLOOR cell of the context's storeys (not the outer border row)
  2. walking distance from the start ≥ 36 cells (18 m)
  3. every cell within 1 cell(s) walkable
  4. not a stair ramp, not in a stair-role area, the area on its own storey
  5. ≥ 5 m from every keep point of the storey
  6. the area's effective weight (area weight × room intensity) > 0
Survivor Market · The settlement (platform, stalls, square, housing deck): none — a calm pit stop: keep-away and clearance rules
RuleValueUnitIn metres
walking distance from the player start36cells18
clear walkable cells around the candidate (radius)1cells0.5
straight-line keep-off from stair / elevator landings, the roof hatch and the ladder foot5m5

Which areas are visited first

First matching rule wins (enclosed office rooms and back-of-house rooms otherwise). A relative weight in the weighted area order, multiplied by the room intensity D of its room key (1 when the room has no modifier). Weight 0 = never a candidate.

Survivor Market · The settlement (platform, stalls, square, housing deck): none — a calm pit stop: area weights (relative order preference; first matching rule wins)
Areas matchingArea weightWhy
kind platform2.2the platform of the station under the tower
type exit-stair / washroom0.5closed street exits and washrooms
type office-stair / stair-core / office-elevator0never in a stairwell, stair core or the elevator cab
type eatery / shop0.5storefront units
kind closet0.5closets
type office-open1.6open-plan office floors
public space1other public halls, lobby and corridors
any other area1.3

How many spawns one area may hold

The placement walks the area order once per pass (caps 1, 2, 3); an area takes one more spawn per visit while it is below its cap for that pass. Room modifiers never raise a cap.

Survivor Market · The settlement (platform, stalls, square, housing deck): none — a calm pit stop: spawns one area may hold (passes 1, 2, 3)
Areas matchingCapWhy
kind platformpass cap + 1platforms hold one more per pass
kind closetat most 1closets: at most one
any other areathe pass cap
Tries per area visit
14 random eligible cells
Spacing
at least 4 m between spawns (straight line, same storey)

Placement defined at OFFICE_PLACEMENT in game/src/ai/spawnTables.ts:374 (repository access required).

How a run places its count, and why it can fall short

  1. Draw count = U{0..0} (one draw per run), then the zombie types of that many spawns.
  2. Collect every eligible cell, grouped by area; order the areas by a weighted shuffle (Efraimidis–Spirakis keys u^(1/weight)).
  3. For each cap pass (1, 2, 3), walk the order: an area below its cap gets up to 14 random cell picks; the first pick ≥ 4 m from every enemy already placed on that storey takes one spawn.
  4. Stop when the count is reached. Spacing, caps and eligible floor can leave a run short of its count (placed < count); validation regenerates the attempt where the profile requires it.
  5. Each placed spawn is then a family by its own roll (see the family pool) — independent of the area unless a room modifier says otherwise.

Checks that reject a whole generation attempt

Context defined at MARKET_SPAWN_PROFILE.contexts.station in game/src/ai/spawnTables.ts:802 (repository access required).

Service annex (per annex) · service · count 5–6 per run × one run per zone (0 per level)

One run covers: none: the market grows no service annex (LEVELS.market.trackExtensions none). Count per run uniform integer U{5..6} (rng.int, inclusive); E[count] = 5.5.

Which cells can hold a spawn

  1. a FLOOR cell of the context's storeys (not the outer border row)
  2. walking distance from the start ≥ 36 cells (18 m)
  3. every cell within 1 cell(s) walkable
  4. the area's effective weight (area weight × room intensity) > 0
  5. an area of the zone (one service annex), ≥ 6 m from the annex's entry door (its keep point)
Survivor Market · Service annex (per annex): keep-away and clearance rules
RuleValueUnitIn metres
walking distance from the player start36cells18
clear walkable cells around the candidate (radius)1cells0.5
straight-line keep-off from stair / elevator landings, the roof hatch and the ladder foot6m6

Which areas are visited first

First matching rule wins (annex rooms (pump / electrical rooms, stores, workshops, custodial rooms) otherwise). A relative weight in the weighted area order, multiplied by the room intensity D of its room key (1 when the room has no modifier). Weight 0 = never a candidate.

Survivor Market · Service annex (per annex): area weights (relative order preference; first matching rule wins)
Areas matchingArea weightWhy
kind closet0.6annex closets (janitor / electrical / supply)
kind service1annex service corridors (1.5-2 m wide)
any other area1.4

How many spawns one area may hold

The placement walks the area order once per pass (caps 1, 2); an area takes one more spawn per visit while it is below its cap for that pass. Room modifiers never raise a cap.

Survivor Market · Service annex (per annex): spawns one area may hold (passes 1, 2)
Areas matchingCapWhy
kind closetat most 1closets: at most one
any other areathe pass cap
Tries per area visit
12 random eligible cells
Spacing
at least 5 m between spawns (straight line)

Placement defined at SERVICE_PLACEMENT in game/src/ai/spawnTables.ts:405 (repository access required).

How a run places its count, and why it can fall short

  1. Draw count = U{5..6} (one draw per run), then the zombie types of that many spawns.
  2. Collect every eligible cell, grouped by area; order the areas by a weighted shuffle (Efraimidis–Spirakis keys u^(1/weight)).
  3. For each cap pass (1, 2), walk the order: an area below its cap gets up to 12 random cell picks; the first pick ≥ 5 m from every enemy already placed takes one spawn.
  4. Stop when the count is reached. Spacing, caps and eligible floor can leave a run short of its count (placed < count); validation regenerates the attempt where the profile requires it.
  5. Each placed spawn is then a family by its own roll (see the family pool) — independent of the area unless a room modifier says otherwise.

Checks that reject a whole generation attempt

Context defined at MARKET_SPAWN_PROFILE.contexts.service in game/src/ai/spawnTables.ts:803 (repository access required).

Room modifiers

All 0 room keys resolve to 1× for every family (neutral); the profile sets no room modifiers. A room key or family without an entry resolves to 1×, which leaves the baseline placement unchanged.

Room key = the area's purpose id (gen/purposes.ts) when it has one, else its room type. Each field resolves: purpose entry → room-type entry → 1 (missing = neutral). Two modifiers exist per room key and family. Density changes local intensity: how strongly the room's areas are preferred when spawns are spread. Weight changes conditional composition: which family a spawn placed in that room is. Neither changes the count range, and caps and spacing still apply. No explicit entries: every other room / family resolves to 1×. Rows list the room keys seen in the sampled census plus any explicit entry; a key not listed resolves to 1× as well.

What each room modifier changes (per room key and enemy family)
ModifierChangesHowAt 0At 2
Density (local intensity)local intensityarea weight × D, D = all.density × Σ_f p_f·w_f·d_f / Σ_f p_f·w_f (p = pool weight, w = weight modifier, d = density modifier); the room's family mix uses p_f·w_f·d_fD = 0: the room is never a candidate (no spawns there); the count roll and the other rooms are unchanged, so its spawns go elsewhere when capacity allows.The room is visited earlier in every cap pass, so it tends to fill its caps before the count runs out: more spawns there, fewer elsewhere, the same total.
Weight (conditional composition)conditional compositionP(family f | spawn lands in the room) = p_f·w_f·d_f / Σ_g p_g·w_g·d_gThat family never spawns in that room (its spawns there become the other families).Twice its relative odds in that room before normalisation; the room still attracts the same number of spawns.

The profile sets no explicit room modifier entries: every room key below resolves to the neutral 1×.

Survivor Market: resolved room modifiers for every room key the level can produce (1× = neutral)
Room keyKey kindSampled room typesRoom intensity D(room)Infected: densityInfected: weightBlightbelly: densityBlightbelly: weightSiren: densitySiren: weightTunnel scavenger (rat/dog): densityTunnel scavenger (rat/dog): weightStrainer: densityStrainer: weightScreacher: densityScreacher: weightBB: densityBB: weight

Room intensity D(room) multiplies the room's baseline area weight (see placement rules). Defined at roomIntensity in game/src/ai/spawnTables.ts:992 (repository access required). Meaning of each field: room modifiers.

Sampled census

sampled Observed, not a rule. These figures come from running the real Survivor Market generator on a small fixed corpus: 4 generated layouts from seeds 11, 222, 3333, 44444, pistol start. Eligible floor is the floor the generator's own candidate filter accepted (0 cells of 0.25 m², 0 m² in total), not the map's bounding box. Densities are placed spawns per 100 m² of that eligible floor over this sample only. Families are counted with the seeded roster applied: what these levels hold. The roster changes families only, so the totals are the generator's.

SAMPLED: 4 sample levels of the registered generator (seeds 11, 222, 3333, 44444, shipped start weapon) WITH THE SEEDED ROSTER APPLIED (roster version 4: what a level holds; the roster only changes families, so counts, positions and eligible floor are the generator's). Eligible floor = cells the generator's own candidate filter accepted (walking distance, clearance, storey, stair / landing keep-off, weight > 0) x 0.25 m² — never bounding boxes. Not exhaustive; not a runtime rule.

Survivor Market: placed spawns per family with the seeded roster applied (sampled: 4 layouts)
FamilyPlaced over the sample (with the roster)Mean per levelSample levels that hold itPer 100 m² eligible floor (sampled)Placed by the per-spawn roll alone (before the roster pass)
Infectedzombie000 of 400
Blightbellyblightbelly000 of 400
Sirensiren000 of 400
Tunnel scavenger (rat/dog)ratdog000 of 400
Strainerstrainer000 of 400
Screacherscreacher000 of 400
BBbb000 of 400

How to read these numbers

More: How to read enemy numbers.

Where to tune it

Each value names the source file and export where it lives (the game repository is private).

Survivor Market: where each enemy spawn value is tuned
ValueCurrentWhere it lives
count range (station)0MARKET_SPAWN_PROFILE.contexts.station.count in game/src/ai/spawnTables.ts:802 (repository access required)
count range (service)5–6MARKET_SPAWN_PROFILE.contexts.service.count in game/src/ai/spawnTables.ts:844 (repository access required)
family pool weightszombie 0.9, blightbelly 0.05, siren 0, ratdog 0.05, strainer 0, screacher 0, bb 0ENEMY_POOL in game/src/ai/spawnTables.ts:125 (repository access required)
coated chance0.4ZOMBIE_TYPES in game/src/ai/spawnTables.ts:379 (repository access required)
area weights7 rules, otherwise 1.3OFFICE_AREA_WEIGHTS in game/src/ai/spawnTables.ts:347 (repository access required)
capspasses 1 / 2 / 3; 2 rulesOFFICE_CAPS in game/src/ai/spawnTables.ts:361 (repository access required)
tries per area visit14OFFICE_PLACEMENT.tries in game/src/ai/spawnTables.ts:375 (repository access required)
spacing (m)4OFFICE_PLACEMENT.spacingM in game/src/ai/spawnTables.ts:375 (repository access required)
keep-away from the start (cells)18 m walking36OFFICE_PLACEMENT.startCells in game/src/ai/spawnTables.ts:375 (repository access required)
landing keep-off (m)5OFFICE_PLACEMENT.landingKeepM in game/src/ai/spawnTables.ts:375 (repository access required)
area weights2 rules, otherwise 1.4SERVICE_AREA_WEIGHTS in game/src/ai/spawnTables.ts:387 (repository access required)
capspasses 1 / 2; 1 rulesSERVICE_CAPS in game/src/ai/spawnTables.ts:396 (repository access required)
tries per area visit12SERVICE_PLACEMENT.tries in game/src/ai/spawnTables.ts:406 (repository access required)
spacing (m)5SERVICE_PLACEMENT.spacingM in game/src/ai/spawnTables.ts:406 (repository access required)
keep-away from the start (cells)18 m walking36SERVICE_PLACEMENT.startCells in game/src/ai/spawnTables.ts:406 (repository access required)
landing keep-off (m)6SERVICE_PLACEMENT.landingKeepM in game/src/ai/spawnTables.ts:406 (repository access required)
room modifiersroom key → family (or all) → {density, weight}none (all 1×)MARKET_SPAWN_PROFILE.rooms in game/src/ai/spawnTables.ts:805 (repository access required)
difficulty tiermetadata only (no scaling)1LEVELS.market.tier in game/src/levels/registry.ts:106 (repository access required)