Enemy spawning
When and where a game puts enemies into play: from placements in the level data as the view reaches them, or from generators that keep creating them.
Enemies enter play in two ways. Placed enemies are listed in the level and created as the screen reaches them. Generators create enemies over time, from a pipe, a door, or off screen, until something stops them.
Games
| Game | Year | How | Note |
|---|---|---|---|
| Super Mario Bros.: The Lost Levels | 1986 | Generated | a new Lakitu flies in sooner than in Super Mario Bros. once none is on screen |
| Factorio | 2016 | Generated | biter spawners turn the pollution they absorb into attack groups, and biters found new nests over time |
Every claim about this mechanic, by game (11)
References
- ^While Lakitu's stretch of a level runs, the game checks every 128 frames whether a Lakitu is on screen. When none is, it counts the check, and on the third it sends a new Lakitu if an enemy slot is free (if none is, it tries again at the next check); the count starts over when a Lakitu is set up. The new one flies high in worlds 1 to 6 (
$20) and lower in worlds 7 to 9 and A to D ($60). When one is on screen, the same check leads to the Spiny throw, not covered here.Codedoppelganger's SMB2J disassemblyHow we know
7251LakituAndSpinyHandler: 7252 lda FrenzyEnemyTimer ;if timer here not expired, leave 7253 bne ExLSHand 7254 cpx #$05 ;if we are on the special use slot, leave 7255 bcs ExLSHand 7256 lda #$80 ;set timer 7257 sta FrenzyEnemyTimer 7258 ldy #$04 ;start with the last enemy slot 7259ChkLak: lda Enemy_ID,y ;check all enemy slots to see 7260 cmp #Lakitu ;if lakitu is on one of them 7261 beq CreateSpiny ;if so, branch out of this loop 7262 dey ;otherwise check another slot ⋮
sm2main.asm lines 7251–7288 at 9c40114 · upstream ↗ 7234SetupLakitu: 7235 lda #$00 ;erase counter for lakitu's reappearance 7236 sta LakituReappearTimer
sm2main.asm lines 7234–7236 at 9c40114 · upstream ↗ 928 ldx #$14 ;set offset to decrement only frame timers 929 dec IntervalTimerControl ;if interval timer control not expired, branch 930 bpl DecrTheTimers ;to skip and thus decrement only frame timers 931 lda #$14 932 sta IntervalTimerControl ;otherwise reset interval timer control to 20 frames 933 ldx #$23 ;and load offset to decrement frame and interval timers
sm2main.asm lines 928–933 at 9c40114 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-26.
Checked by a second AI model, 2026-10-26.
- ^A spawner absorbs pollution at 20 units plus 1% of its chunk's pollution per update. Each unit has a pollution cost to join an attack: a small biter 4, a medium 20, a big 80, a behemoth 400, and spitters 4, 12, 30 and 200. An attack group gathers for 1 to 10 minutes and holds at most 200 units.Codefactorio-data 2.1.23
How we know
174 absorptions_per_second = { pollution = { absolute = 20, proportional = 0.01 } },base/prototypes/entity/enemies.lua line 174 at 39dbd0f · upstream ↗ 103 absorptions_to_join_attack = { pollution = 4 },base/prototypes/entity/enemies.lua line 103 at 39dbd0f · upstream ↗ 346 absorptions_to_join_attack = { pollution = 20 },base/prototypes/entity/enemies.lua line 346 at 39dbd0f · upstream ↗ 406 absorptions_to_join_attack = { pollution = 80 },base/prototypes/entity/enemies.lua line 406 at 39dbd0f · upstream ↗ 467 absorptions_to_join_attack = { pollution = 400 },base/prototypes/entity/enemies.lua line 467 at 39dbd0f · upstream ↗ 574 absorptions_to_join_attack = { pollution = 12 },base/prototypes/entity/enemies.lua line 574 at 39dbd0f · upstream ↗ 631 absorptions_to_join_attack = { pollution = 30 },base/prototypes/entity/enemies.lua line 631 at 39dbd0f · upstream ↗ 688 absorptions_to_join_attack = { pollution = 200 },base/prototypes/entity/enemies.lua line 688 at 39dbd0f · upstream ↗ 131 -- manual groups created through the API are unaffected. 132 max_unit_group_size = 200
base/prototypes/map-settings.lua lines 131–132 at 39dbd0f · upstream ↗ 106 -- pollution triggered group waiting time is a random time between min and max gathering time 107 min_group_gathering_time = 3600, 108 max_group_gathering_time = 10 * 3600,
base/prototypes/map-settings.lua lines 106–108 at 39dbd0f · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-26.
Checked by a second AI model, 2026-10-26.
- ^Spawners, not factories, turn pollution into attacks: each update a spawner absorbs 20 plus 1% of its chunk's pollution (the wiki gives two versions of when it stops or what it takes instead, below), and after absorbing a certain amount it sends one of its units to a gathering point; the gathered group attacks after 1 to 10 minutes. The absorbed pollution pays for sending units, not for spawning them.WikiFactorio Wiki: Pollutionrevised
How we know
If a chunk's pollution is greater than 20, each enemy spawner absorbs 20 + 0.01 * [chunk's pollution] every 64 ticks, otherwise it absorbs 3 times the amount of pollution needed for the most expensive unit it can spawn for the current evolution factor. … After a certain amount of pollution is absorbed the spawner sends one of its biters/spitters to a rendezvous point. … Every 1 to 10 minutes (random) the mustered biters launch an attack.
Spawners · archived copy ↗ Every 64 ticks, spawners absorb pollution until they have absorbed more than 3 times the amount needed to send the most expensive unit at the current evolution level.
Spawners (absorption) · archived copy ↗ Note that absorbing pollution is not for spawning biters, but for sending biters to an attack group.
Spawners · archived copy ↗ Checked against the evidence by its author, an AI model, 2026-10-26.
Revised after a check by a second AI model, 2026-10-26.
- ^A spawner keeps up to 7 units of its own and spawns one every 6 seconds at evolution 0, quickening to every 2.5 seconds at evolution 1.Codefactorio-data 2.1.23 · Factorio Wiki: Enemies
How we know
177 max_count_of_owned_units = 7,base/prototypes/entity/enemies.lua line 177 at 39dbd0f · upstream ↗ 203 -- With zero evolution the spawn rate is 6 seconds, with max evolution it is 2.5 seconds 204 spawning_cooldown = {360, 150},
base/prototypes/entity/enemies.lua lines 203–204 at 39dbd0f · upstream ↗ This interval (spawning_cooldown in the enemy-spawner definition) is interpolated between 360 (0 evolution) and 150 (1 evolution) game ticks (= 6 to 2.5 seconds).
Evolution · archived copy ↗ Checked against the evidence by its author, an AI model, 2026-10-26.
Checked by a second AI model, 2026-10-26.
- ^Enemies expand: between 10 and 60 minutes apart, shorter as evolution rises (60 minutes at evolution 0, 10 at 1, on the curve −e² + 2e), a group of 5 to 10 units times 8 to the power of evolution (so 40 to 80 at evolution 1, at the default enemy base settings; 2.1 also scales it with the map's base-size setting) sets out to a chunk 3 to 5 chunks out from the enemy bases already there, where its members turn into new spawners and worms, one every 30 seconds.Codefactorio-data 2.1.23 · Friday Facts #445 · Factorio Wiki: Enemiesrevised
How we know
48 -- Distance in chunks from the furthest base around. 49 -- This prevents expansions from reaching too far into the 50 -- player's territory 51 max_expansion_distance = 5, 52 min_expansion_distance = 3,
base/prototypes/map-settings.lua lines 48–52 at 39dbd0f · upstream ↗ 83 -- Size of the group that goes to build new base. 84 settler_group_min_size = 5, 85 settler_group_max_size = 10, 86 -- Exponential factor used to determine the size of the settler group based on the evolution factor. 87 -- The size is calculated as: 88 -- size = random(min_size, max_size) * (evolution_group_size_factor ^ evolution_factor) 89 evolution_group_size_factor = 8.0, ⋮ 91 -- Ticks to expand to a single 92 -- position for a base is used. ⋮ 94 -- cooldown is calculated as follows: 95 -- cooldown = lerp(max_expansion_cooldown, min_expansion_cooldown, -e^2 + 2 * e), 96 -- where lerp is the linear interpolation function, and e is the current evolution factor. ⋮
base/prototypes/map-settings.lua lines 83–101 at 39dbd0f · upstream ↗ So for 2.1.13 we have increased the cooldowns: 30 seconds by default, and 10 seconds for Deathworld.
Build base behavior · archived copy ↗ Modify group size dependent on the map generator biter base size.
Expansion groups were too small · archived copy ↗ 336 - Increased expansion group build base cooldown from 5 seconds to 30 seconds. 337 - Reduced early game max enemy expansion group size from 20 to 10.
changelog.txt lines 336–337 at 39dbd0f · upstream ↗ When the expansion group reaches its target, each unit will begin dying in sequence to randomly create a spawner or a worm after some delay.
Expansion · archived copy ↗ Checked against the evidence by its author, an AI model, 2026-10-26.
Revised after a check by a second AI model, 2026-10-26.