Talk:NPC spawning

From Terraria Wiki
Jump to navigation Jump to search

blocks

Are there blocks upon which a monster will now spawn on? --67.168.255.104 02:06, 2 August 2011 (UTC)

Max Spawns column & Meteor Heads

reclarify the maximum number column please because i have VERY frequently gotten roughly 12 meteor heads at a given time in a hallow biome created by adding meteor biome added in. 96.15.233.3 18:49, 10 December 2011 (UTC)

Did you have battle potion and/or water candle active at the time? The time of day also has an effect, unless you are underground. Did you make the meteor underground? I didn't bother including a column for underground meteor, since this typically won't happen naturally. It would have a significantly higher spawnrate/limit. --GauHelldragon 18:57, 10 December 2011 (UTC)
i placed 50 (and any extra meteor pieces the meteor foes dropped) in an open completely hallow area underground at about depth 400 in a small world. it is third layer underground (mostly stone but not yet lava). i would like to point out that spawn rate, if i constantly killed and not let numbers add up, was roughly 7 heads per 3 seconds. further, i couldn't completely clean out neighboring hollow spots and i almost constantly had water based mobs appear below me but out of view range, about 3 min and max not counting dead goldfish. my screen is 1440x900, i think spawn area is equal to half the radius further than view range. i did not use battle or water candle. 96.15.251.38 19:12, 10 December 2011 (UTC)
If you built it in the cavern layer, that explains why the spawn rate/max is different from the one listed. --GauHelldragon 20:29, 12 December 2011 (UTC)

Spawn Radius

i think i discovered something about spawn radius, or at least the width but height is found similar way. using a 1920x1080 screen resolution and maximized windowed mode (or full screen for similar width measuring purpose), i calculated every block is 32 pixels wide (not amazing yet but whatever) and there are 60 blocks in the screen in one direction. i verified using a ruler accessory (much to my eyes pain). default window size is 50 tiles in diameter.

next i used the gps/compass to measure npc spawn protection size and spawn range, remember that 2 ft = 1 block. the width of the anti-mob bubble is 125 tiles wide give or take 5 tiles for npcs not lining up vertically during my night time test. additionally that spawn protection is depends on the player's location, meaning a monster can spawn inside it if the player itself is outside of it. this is because of the player's own anti spawn bubble (ok square, whatever), which is EXACTLY this equation: window_size*120%. i say window size because i specifically remember an update that linked spawn "rate" and location to the game window's size. i highly doubt what i just said about rate is wrong but i proved the spawn location right. a monster didn't spawn at block 72, it spawned the block right after, thus a monster can spawn at (window_size*1.2)+1 or block 73 as written on the page. given that the article written that this is the maximum, i suspect a player with a screen resolution larger than 2304 wide (or 2560 as idk what screen would be close to and over 2300), the developers expected that players wouldn't use a monitor above 1900 wide. using default window size, a monster didn't spawn till i was around 110 tiles away from an npc, giving enough space for a monster to spawn between the npc's 72 tile wide and player's 30 tile wide.

so to summarize:

  • player anti-spawn protection is based on windowsize
  • exact protection size is windowsize*1.2
  • max is based on a 1900 wide screen. 72 tiles wide radius for left and right.
  • npcs have radius as the max centered at each of themselves but only if there are at least 3 npcs close together (for close together i didn't test)

98.134.162.247 03:13, 19 December 2011 (UTC)

to update slightly, npc's spawn protection up and down is shorter than player's spawn protection of screen size. (tested with an underground house with helivator) 98.134.167.67 21:40, 20 December 2011 (UTC)

Some slightly more precise numbers based on experiments in-game and poking around in source:

  • the update the above contributor refers to is an early one that says "Enemy spawn distance has been pushed back to the maximum resolution to ensure that they will never spawn on the screen." The maximum resolution the devs were thinking of is 1920x1080, or 120 tiles x 67.5 tiles. The actual safebox around the player seems to be 124 tiles (62 left/right of player's centerpoint) x 70 tiles (35 up/down of player's centetpoint). NPCs always spawn outside of this area, which is offscreen if you're playing at 1920x1080 resolution or less.
  • the information on the NPC spawning wiki page seems to be a little bit off based on experiments and source, and maybe have changed due to the update mentioned above. It looks like the maximum distance that NPCs can spawn at is 84 left/right of the player and 47 above/below, not 73 and 45 as mentioned. (This is important for creating really precise farms!) Would appreciate it if someone could double-check my work, probably a good idea before updating the page.

Metasynthie (talk) 00:45, 9 November 2013 (UTC)

Terraria Spawn Area.png
trying to make an illustration of spawn aeria — Preceding unsigned comment added by Post Mjobeus (talk • contribs) at 00:19, 9 November 2013 (UTC)

<< On the topic of spawn radius and 'spawning basics'. I keep coming back to this page, when I feel like playing again, and still don't get it.

Player is 3x2 (6 tiles), from top left the max distance is 84 west, 83 east, 46 up, 45 down. Chooses tiles until finds empty, check for ground below empty, check for fit hostile at ground arrived at. Checks if in safe area (from top left of player, 62 tiles east or west, 34 tiles up or down). Also, it must be outside a SECOND safe zone of 2088x1172 pixels around player's CENTER of hit box (sprite?). (Also, if the player is not riding a mount then the 'tile' is 3/16 above the top left corner of the player's head. Not sure why. If standing on a half block then the safe zone is only 34 above the tile, but if on full then it is 35. As interpreted from the information provided.)

The graphic helps... by making it easy to ignore the 'basics' and just follow the graphic. But then, I'm left with a question... does this mean that if I build a 124 tile wide platform and stand on the dead middle two tiles, nothing can spawn on that platform to get me? (Ignore fliers going around.) So, in game... I would use the ruler and stand on two tiles... then measure 61 tiles on either side and build to that distance? (Total tiles is 124.)

Taking the ruler back to the 'basics'. The safe area is 62 tiles east or west (so far lines up) of the top left tile of the player. So, I should measure with the ruler to 61 west and 60 east since the right side of the player sprite is the 61th tile. But, that means my safe platform must only be 123 tiles wide (61 + 60 + 2). Now, above my sprite the safe area is 34 tiles... if I am standing on a half block. It is actually 35 if I am standing on a full block. So, as I normally build with full blocks, I can place my roof 35 tiles above my sprite head... or by ruler that would be 38 up... and nothing can be spawned standing on it. That raises another question... for the safe zone, does it look at the space the hostile will be placed in or does it look at the block it will be placed on top of? Because if it looks at the space it will be spawned into then I want my roof at 34... actually, putting it a little lower, like 30, would ensure that I don't have to worry about it. Same goes for below, as long as the open space below where I stand it less than 35 and then it is solid block to 50 tiles below (for example, 30 tiles open space and 20 tiles solid beyond that) then it will be fine.

All in all, it is best to play it safe and go beyond these numbers. If trying to make a safe box and not install your own walls, make it no wider than 60 and no taller than 30... so no matter where you stand in it, the whole thing remains in the safe zone. If trying to make a hostile spawning area, build 90 tiles east and west (180 wide)... because building too large doesn't matter, you just don't want to miss spawns by building it too small. >>
184.65.217.231 13:52, 8 October 2019 (UTC)

Biome where player is standing?

Edge case: Is it the biome the player is currently in that counts, or the biome at the place where the mob is selected to spawn, when considering spawn rate? 82.99.4.212 13:36, 7 August 2013 (UTC)

The biome the player is in. --0icke0 (talk) 10:51, 8 August 2013 (UTC)
I confirm that. I also noticed a strange phenomenon: When the player is just outside of the Temple or the Dungeon (when the wall tiles are not resembling that biome behind the player/music changes) the NPCs spawning inside the structure will mostly be Goldfish or bunny, occasionally the mobs of either the structure, or the biome the player is in. 157.181.101.156 16:54, 10 January 2014 (UTC)

Mobile version

It seems that monsters spawn much less frequently on the mobile version than on PC. -- an anonymous user — Preceding unsigned comment added by 210.41.86.187 at 02:32, 17 December 2014 (UTC)

This has been a common complaint since the mobile 1.2 update. If you want to add your voice or check for the latest info from the developer, it's best to use the forum. Equazcion (talk) 03:00, 17 Dec 2014 (UTC)

47tiles above and below me is safety-zone...but where am I?

Imagine if I wnat to build a thin frame around me that marks exactly the safety zone with me standing on a platform in its center, what height exactly would I have to stand on then? The safetyzone is 94tiles high, but I am three tiles high...soo... huh? — Preceding unsigned comment added by 178.200.21.8 at 14:15, 14 January 2015 (UTC)

The safe zone is actually 70 tiles high, so I guess about 35 tiles would do it. Equazcion (talk) 19:21, 14 Jan 2015 (UTC)
OOps I actually meant the spawnarea, but same applies for the safe zone, I dn't know where top/bottom boundaries are, because I'm 3tiles tall. — Preceding unsigned comment added by 178.200.21.8 at 14:36, 14 January 2015 (UTC)
I believe it's from the player's vertical and horizontal center-point. --Ferretwings (talk) 19:30, 13 June 2016 (UTC)
It's actually relative to the tile containing the top left corner of your sprite. However, the tile the game checks for background walls is your centre point. - Andrio Celos (talk) 12:13, 8 July 2018 (UTC)

Solar Eclipse

I'm pretty sure that spawn rate is greatly increased during a Solar Eclipse also, but I don't know the rate to which it is increased to. — Preceding unsigned comment added by 101.175.72.77 at 04:19, 18 January 2015 (UTC)

Anyone know the answer to this? --MentalMouse42 (talk) 16:33, 4 April 2020 (UTC)

Biome

Does the enemy type depend on the biome where the player is, or on the biome where the spawn location is ? — Preceding unsigned comment added by Matheod (talk • contribs) at 14:20, 8 July 2015 (UTC)

spawning spot

If the chosen tile is, say, directly above the player, and there are no blocks between the player and the tile, is it cancelled (due to monster cant spawn on-screen)?

And lava prevents spawning, correct? FunAlways (talk) 17:51, 1 August 2015 (UTC)

Dirt layer and Stone layer?

The page doesn't explain what "dirt layer" and "stone layer" means. I guess Underground / Cavern? — Preceding unsigned comment added by 190.17.48.72 at 00:58, 9 August 2015 (UTC)

Goblin invasions *are* blocked by walls

At the end of the Spawning Basics section, there's a claim that goblin invasions aren't blocked by player-placed walls. I know this isn't true, because I've built spawn-blocked structures in the surface layer that do not allow goblins to spawn. When I leave and there's an area in spawning range that doesn't have my walls behind it, then the goblins start spawning. I think the person who wrote that blurb was confused about the sorcerer's teleporting ability, because they can teleport into areas with player-placed walls after spawning. Any objections to me updating it?

Colezan (talk) 01:35, 7 June 2016 (UTC)

All right, I went ahead and updated that section. Colezan (talk) 05:30, 13 June 2016 (UTC)

other spawnrates

what about spawn rates for : desert, desert underground, ice, ice underground ? sandstorm & blizzard ? thanks. --84.101.149.232 18:58, 18 November 2016 (UTC)

Item spawn rate modification table

I think we should have a table outlining the effects of items on spawn rates. I created the following table, but it looks out of place and doesn't use the style templates. (Mostly because I don't know what to do to use them).

Item Name Spawn Rate Max Spawns
Water Candle.png Water Candle +33% +50%
Battle Potion.png Battle Potion +50% +100%
Calming Potion.png Calming Potion -17% -20%
Sunflower.png Sunflower -20% No Effect
Peace Candle.png Peace Candle ((Desktop, Console and Mobile versions)) -23% No Effect

If someone who knows how to make this into a good table, go ahead and add it :) Thanks! Kirbykirby56 (talk) 04:45, 27 October 2017 (UTC)

Looked at the code, seems like some of the values are wrong/out of date
Item Spawn Rate Max Spawns
Water CandleWater Candle +33% +50%
Battle PotionBattle Potion +100% +100%
Calming PotionCalming Potion -23% -30%
SunflowerSunflower -17% -20%
Peace CandlePeace Candle(Desktop, Console and Mobile versions) -23% -30%
Calming potion seems to have gotten buffed sometime between 1.2.4.1 and 1.3.4.3, don't know exact version it changed.
In the same version span water candles got an additional +100% spawn rate in space, but only when placed, when held in hand they don't have this additional effect.
Could someone verify(mainly don't trust my math when converting multiplier to %), and update related pages? 86.115.19.146 11:06, 27 October 2017 (UTC)

Specific enemies

Can you add a table of specific enemies whose spawn rates are multiplied from the normal ones with the spawn rate compared to the forest next to them? Some examples for the table would be pinky, medusa, and the bounded goblin tinkerer. 174.66.199.150 21:13, 31 July 2020 (UTC)

Spawn rates

To not long consideration, for example, on page of pinky his spawn rate is precisely specified, but Nymph for example is not. There is general lack of spawn rates of multiple enemies, what should be corrected. On outer sources there are many. --Inioszi (talk) 02:18, 29 November 2020 (UTC)

Player placed walls

So how do player placed walls block NPC spawn? I've tried placing walls to block all spawn points on the ground, but enemies are still spawning. Do all flying enemies able to spawn midair everywhere (e.g. A Corruptor in the Underground Corruption) , or they can only do so in Space?BadPiggy1024 (talk) 11:27, 30 December 2020 (UTC)

Detailed spawning conditions

Currently the page only described how an enemy spawns, but not exactly where it spawns. Throughout play experiences, we can find out that some (or many?) "biome-exclusive" enemies may spawn wherever there are blocks of corresponding biome, regardless of whether there are sufficient amount of blocks to create the biome (i.e. they do not need an existing biome to spawn, and the only need is one particular block). Is it possible to create a detailed table to list all enemies' spawning conditions?

Something like this: (I'm not very good at editing tables)

Enemy Spawning Conditions Notes
Blood MummyBlood Mummy(Desktop, Console and Mobile versions) On Crimsand BlockCrimsand Block. n/a

It would be helpful for those who want to create an "enemy farm" on their own.

1024 with bad English (talk) 10:03, 29 April 2021 (UTC)

Sounds like a good idea. This kind of information is also quite straightforward in the source code. I'm not sure about the best location on the wiki, though. It seems like too much information for this page, maybe a subpage would be better. --Rye Greenwood (talk) 15:43, 30 April 2021 (UTC)
Would making it a collapsible list work? That way a new page isn't required (if one hasn't already been made), and having it be collapsed by default keeps the large amount of info from bloating the page (that way only the people that want/need to see it can if they choose to). Other pages seem to do this as well and it really helps with navigating them when there are multiple lists involved, or really long lists. Stranded at sea (talk) 13:53, 16 June 2021 (UTC)

The Effect of town NPCs on spawn rates seems wrong

I read the source code a bit and it seems that it should be interpreted in a different way taking the code of underworld with 1 NPC as an example:

```
if (Main.player[k].townNPCs == 1f) {

if (Main.rand.Next(2) == 0)
flag5 = true;

if (Main.rand.Next(10) == 0) {
flag12 = true;
maxSpawns = (int)((double)(float)maxSpawns * 0.5);
}
else {
spawnRate = (int)((double)(float)spawnRate * 1.25);
}
}
```

the current interpretation says there is a 90% chance to increase spawnRate by 1.25x and 10% chance to decrease the maxSpawns by 0.5x, but that seems misleading.

first, flag5 indicates whether player is in front of a safe wall, when player is in the underworld it has 50/75/90% chance to consider player in front of a safe wall when 1/2/3 town NPC is nearby (outside the underworld it is always 100%), this effect is not touched in the current page.

second, flag12 seems to be a flag indicating whether the current spawning should spawn critters instead of enemies. so the above code should be interpreted as: when there is 1 town NPC nearby in underworld, the spawning has a 10% chance to spawn critters, if so the maxSpawns will be decreased by 0.5x, if that's not the case (the remaining 90% chance of spawning an enemy), the spawnRate will be increased by 1.25x.

in underworld, with 1/2/3 NPC near by, there is 50/75/90% chance to consider player in front of a safe wall, 10/20/33.3% chance to spawn critter with 0.5x maxSpawn, if not spawning critters, the spawnRate will be 1.25/1.5/2x

in graveyard, with 1/2/3 NPC near by, player is considered in front of a safe wall, 11.11/16.7/33.3% to spawn critter instead of enemy with 0.6x maxSpawn, spawnRate will always be 1.66/2.33/3x no matter spawning critter or enemy.

otherwise, with 1/2/3 NPC near by, player is considered in front of a safe wall, 33.3/66.7/100% to spawn critter instead of enemy with 0.6x maxSpawn, if not spawning critters, the spawnRate will be 2/3/- x

in expert or above, when there are 3 town NPC nearby there is still 1/30 chance to set flag12 to false so enemies may spawn. in that case we still use maxSpawn & spawnRate of the critter mode

Add Spawn Rate Priority explanation

I'm not sure about the best way to go about this, but I think the section explaining per-biome spawn rates should explain the priority. Just checked the source code - the Dungeon takes top priority, then Sandstorm, Underground Desert, the Jungle, the Corruption/Crimson, and Meteorite, in that order. Additionally, the Hallow's spawn rate bonus in Caverns appears to not be part of this priority, meaning it can actually stack on top. The same applies for the Jungle Temple's spawning bonus, which only checks if the player is standing over unsafe Lihzahrd Brick Wall. See line 73629 of NPC.cs, in SpawnNPC. Also it looks like the level of cloudiness affects surface snow biome spawns?

MingCat (talk) 19:34, 12 January 2024 (UTC)

Personally i dislike the current explanation. The game actually separate the section into 3 parts, first check the height and time, then biome (from dungeon to meteor), then some extra multipliers (jungle temple, cavern hallow, etc.). in the first two sections only one condition will take effect in each section, while in the 3rd section each condition is triggered separately. It's definitely better to explain as how the source code goes instead of doing a cartesian production like this.

I'm not familiar with the wiki table so i just past my own markdown side notes here, if anyone think this looks better feel free to put it on the page.

If not specified, only the first condition met in each table will take effect, conditions in different table can work together.

    1. Height and time
      1. in normal world
| Condition          | spawnRate |  maxSpawn |
| ------------------ | --------: | --------: |
| Underworld         |         / |         2 |
| Cavern             |       0.4 |       1.9 |
| HM Underground     |      0.45 |       1.8 |
| Pre-HM Underground |       0.5 |       1.7 |
| Surface Blood Moon | 0.6 * 0.3 | 1.3 * 1.8 |
| Surface Night      |       0.6 |       1.3 |
| Surface Eclipse    |       0.2 |       1.9 |
      1. in remix
| Condition     | spawnRate | maxSpawn |
| ------------- | --------: | -------: |
| Underworld    |         / |        2 |
| HM Cavern     |      0.45 |      1.8 |
| Pre-HM Cavern |       0.5 |      1.7 |
| Underground   |       0.4 |      1.9 |
| Condition                    | spawnRate | maxSpawn |
| ---------------------------- | --------: | -------: |
| Blood Moon (Cavern or below) | 0.6 * 0.3 |      1.8 |
| Blood Moon                   |       0.6 |      1.8 |
| Eclipse                      |       0.2 |      1.9 |
    1. Biome

Jungle is further affected by number of at most town NPC, (0.4+0.15 * npc) for spawnrate and (1.5-0.15 * npc) for maxSpawn

| Condition          | spawnRate | maxSpawn |
| ------------------ | --------: | -------: |
| Dungeon            |       0.3 |      1.8 |
| HM Sandstorm       |       0.4 |      1.5 |
| Pre-HM Sandstorm   |       0.9 |      1.2 |
| Underground Desert |       0.2 |        3 |
| Jungle             |       0.4 |      1.5 |
| Evil               |      0.65 |      1.3 |
| Meteor             |       0.4 |      1.1 |

Conditions in the following table are independent from each other.

| Condition                |   spawnRate | maxSpawn |
| ------------------------ | ----------: | -------: |
| Surface Snow             | (2-cloud)/2 |  1+cloud |
| Drunkworld Hive          |         0.3 |      1.8 |
| Jungle Temple            |         0.8 |      1.2 |
| Remix Jungle Temple      |         0.4 |      1.5 |
| Remix Surface Evil       |         0.5 |        2 |
| Cavern (or below) Hallow |        0.65 |      1.3 |
| Underworld with WoF      |           3 |      0.3 |


ZeroRin (talk) 11:58, 15 January 2024 (UTC)