NPC spawning

From Terraria Wiki
Jump to: navigation, search

In Terraria, enemies, critters, and other NPCs will spawn off screen and enter the screen area based on their AI. The rate at which enemies are spawned, the maximum number of enemies, and the type of enemies spawned are all dependent on the time of day, biome, the tile type of the ground, and other factors.

Spawn Rates[edit | edit source]

There is a 1 in "Spawn rate" chance an enemy will spawn every game tick. There are 60 ticks per second, so a spawn rate of 600 means, approximately, a 10% chance of at least one enemy spawning per second, and a spawn rate of 100 means approximately a 45% chance of at least one enemy spawning per second.

When the game is determining the maximum number of enemies in the area, the "Max Spawns" is used. Some enemies count towards this limit more than others. Most bats are considered 0.5, uncommon enemies typically count as 3, bosses count as 5 and finally critters do not count toward the limit. Each individual segment of worm enemies counts towards the spawn limit. For example: If The Destroyer is spawned, it will count way over the limit: 80 segments * 5 for bosses = 400!

Note: the "Max Spawns" focuses only on monsters that are in a specific area whose center is the player, in other words, active enemies for the player. When an enemy is outside the 504*283.5 blocks rectangle (1920*1080 pixels screen multiplied with 4.2*4.2) and it is not a boss, the monster will not be considered active, thus not counted in when checking the max-spawns limit and other calculations. (Fortunately for the enemy and event farming: the enemy will despawn if it is outside another specific rectangle which is much smaller. More details, go to NPC Despawning)

The minimum (fastest) spawn rate under normal conditions is 60, and the maximum spawns is 15. The modifiers from Water Candle and Battle Potion are set before these limits are checked. Invasion events (including Goblin Army, Frost Legion, and Pirate Invasion and Martian Madness) and moon Events (Lunar Event/Pumpkin Moon/Frost Moon) are a special case; they ignore any modifiers or limits to the spawning rates or number of spawns (including water candles/battle potions).

Drinking a Calming Potion increases (therefore slows) enemy spawn rate.

Biome Spawn rate[1] Max Spawns Hardmode
Spawn Rate[1]
Hardmode
Max Spawns
Forest (Surface day) 600 5 540 6
Forest (Surface night) 360 6 324 7
Forest (Blood Moon) 107 11 97 14
Forest (Solar Eclipse) - - 108 11
Forest (Underground layer) 300 8 243 10
Forest (Cavern layer) 240 9 216 11
The Underworld 600 10 162 15
Jungle (Surface day) 240 7 216 9
Jungle (Surface night) 144 9 129 11
Jungle (Blood Moon) 60 15 60 15
Jungle (Underground layer) 120 12 97 15
Jungle (Cavern layer) 96 14 86 15
Corruption/Crimson (Surface day) 390 6 351 7
Corruption/Crimson (Surface night) 234 8 210 10
Corruption/Crimson (Blood Moon) 70 15 63 15
Corruption/Crimson (Underground layer) 195 11 157 14
Corruption/Crimson (Cavern layer) 156 12 86 15
Hallow (Surface day) 600 5 540 6
Hallow (Surface night) 360 6 324 7
Hallow (Blood Moon) 108 11 97 14
Hallow (Underground layer) 300 8 243 10
Hallow (Cavern layer) 165 12 140 14
Meteorite (day) 240 5 216 6
Meteorite (night) 144 7 129 8
Meteorite (Blood Moon) 60 12 60 15
Underground Desert 180 7 162 15
Dungeon (Underground layer) 120 14 97 15
Dungeon (Cavern layer) 96 15 86 15
Invasions and Moon Events 20 10 + 1.5 per player 20 10 + 1.5 per player
  1. 1.0 1.1 lower numbers spawns more enemies

Additionally, the spawn rate will be modified by the number of active enemies in the area. The fewer active enemies there are, the faster they will spawn. If there are fewer than 20% of the enemies the maximum number of spawns allows, the spawn rate will be multiplied by 0.6. If fewer than 40% of the enemies exist, the spawn rate is multiplied by 0.8, 65% of the max spawns correspond to the multiplier 0.8 and 80% of the enemies means that the spawn rate is multiplied by 0.9. That means that if the player is in an area where the spawn rate is 600 and the max spawns are 10, but there are only 2 or fewer enemies, the effective spawn rate is 360 until more enemies spawn.

The presence of friendly NPCs greatly reduces the rate at which enemies spawn, and also reduces the maximum enemies as well. When 3 or more NPCs, or the Skeleton Merchant are present, no enemies will spawn. Events such as Slime Rain, Pirate Invasion, Lunar Event, etc bypass this reduction.

Certain items when used or placed will also change the max spawns and spawn rate, as per the table below.

Item Spawn Rate Max Spawns
Water CandleWater Candle +33% +50%
Battle PotionBattle Potion +50% +100%
Calming PotionCalming Potion -17% -20%
SunflowerSunflower -20% (Desktop VersionConsole Version only) n/a
Peace CandlePeace CandleDesktop VersionConsole Version -23% n/a

Some biomes will override each other when determining the spawn rate. Corruption, Dungeon, Meteor and Jungle are all mutually exclusive spawn rates. Dungeon has the highest priority, then jungle, corruption, and finally meteor. For example, if a meteor hits the jungle, it will use jungle spawn rates.

Spawning Basics[edit | edit source]

Each player in the game will spawn their own enemies. If two players are in the same area, monsters will appear twice as fast as they would with only one player. Max Spawns rule are still used, which means that even if 2 players are in the same spot, you cannot gather 30 normal monsters near the spot. (Don't forget, the bats count as 1/2, and some special enemies count as 2 or more.)

Choosing a spot to spawn the enemy[edit | edit source]

Spawn area illustration

Verify When the game decides to spawn an enemy, it will first choose a random tile within a rectangle around the player (specifically, the tile containing the top left corner of the player's hitbox). The maximum distance from the player it can choose from is 84 tiles west, 83 east, 46 up, and 45 down. If the picked tile is a solid block, it will try another one. Tiles that are actuated out do not count as solid. If the picked tile has a wall that blocks enemies from spawning, it will also try another tile.

Once an empty tile is found, it moves down until it finds the ground. (Note that this tile can be more than 45 tiles below from the player. If it finally is outside the "Active Rectangle" it will be instantly despawned, anyway.) If there is enough space for an enemy to be spawned at this location, this will be the tile it chooses. The exception to this is when the player is in an area where Harpies and many other flying enemies can be spawned. In this case, the game does not attempt to find a ground tile.

The chosen tile is then checked to make sure it is not within the "safe" area around the player. It cannot be within 62 tiles east or west, or 34 tiles up or down. Also, the chosen tile space must be completely outside 2088 × 1172 pixel rectangles centered on the center of each player's hitbox. (If the player is not riding a mount, the top edge of this is 34 + 3/16 tiles above the top left corner tile mentioned above, meaning that NPCs can spawn on ground exactly 35 tiles above a player standing on half blocks, but not a player standing on full blocks.)

Using certain items causes monsters to spawn further out than normal. Equipping a Rifle Scope or Sniper Scope does so only when the player has a compatible gun selected, whether or not the player is zoomed out.

Items Spawn range Safe range
Horizontal Vertical Horizontal Vertical
Normal 84 46 62 34
Rifle Scope or Sniper Scope 114 62 92 50
Binoculars 124 68 102 56
Sniper Rifle 124 68 102 56
Sniper Rifle with Rifle Scope or Sniper Scope 132 72 110 60

Note : If using the Depth Meter, Compass, or similar, each tile is equal to 2 feet, so double all measurements to get distances in feet

On the Mobile version Mobile version, the no-spawn area around the player is 68 by 48 tiles, and the spawn area is 112 by 62 tiles. In addition, enemies cannot spawn closer than 34 tiles to the sides and 24 tiles up and down. They also cannot spawn farther than 56 tiles to the sides and 31 tiles up and down.

Choosing a type of enemy to spawn[edit | edit source]

The type of enemy spawned will depend on many factors including, but not limited to:

Notes[edit | edit source]

  • When standing on the left or right edge of the world, the enemies can spawn on screen, as long they are at least 62 tiles from the player. The screen is around 85 blocks wide, so in this case the enemies can spawn in the farthest quarter of the screen. (This may not necessarily be the case, some players have larger screens, as high as 120 blocks wide).
  • Equipping Binoculars does make the active rectangle bigger.

History[edit | edit source]

  • Desktop 1.2.4: Fixed bug where spawn rates would increase underground when a moon event is happening.
  • Desktop 1.2.3: Fixed bug where spawn rates were higher than intended everywhere rather than when below the middle of dirt layer.