Theory: Certain blocks cannot have enemies spawn on them?

Predious

The Destroyer
The theoretical idea in this post is simply this: Do some blocks not allow monsters to spawn on them? Like maybe fire blocks (Meteorite blocks or Hellstone blocks) and platform blocks.

I'd like to hear everyone's thoughts on whether this is true or not, and how this could be utilized.
 
It's hard to tell something like this, unless anyone's willing to actually delve into the code.

I will admit that I've never seen an enemy spawn on a meteorite block. However, this is probably because the blocks are either offscreen - in which case you really can't tell - or there's enough of them present to constitute a Meteor biome, in which case only Meteor Heads will spawn.

As for hellstone bricks, though - I'm fairly sure that mooks can spawn on them as usual, because Fire Imps pop up for the first time on them quite often. Yeah, this is all observational data, but it would suggest that blocks that inflict burning damage do not affect mob spawning at all... which would kinda make sense considering that mobs ignore that kind of damage.

I don't know about platform blocks, though.
 
Player placed walls can negate spawning, but offhand I'm not aware of any blocks that explicitly prevent spawning. Generally there seems to be some fall-through default when all else fails. The good news is that I think I have a way to challenge this to see what happens. Certain spawns are contingent on biomes or elevations. Having a spawn target of Hellstone or Ash Block at the surface level most likely isn't going to yield Fire Imps or Lava Bats.

I've spent some time poking around in the code, but it's a big tangled maze of if this, else this, else if that nested checks almost entirely handled in one function. While certain specifics are relatively easy to pin down, the broader logic is a bit of a mess to follow. At the very least, observations I've made recently have me starting to wonder about the relationship between the block that's selected and where enemies spawn, making me think the NPC Spawning entry on the wiki might be over-simplifying the process. I've noticed things happening like Wall Creepers and Black Recluses spawning well outside the spider nests and hallowed/corrupt enemies showing up removed from where they ought to be spawning.

More to follow later.
 
Player placed walls can negate spawning, but offhand I'm not aware of any blocks that explicitly prevent spawning. Generally there seems to be some fall-through default when all else fails. The good news is that I think I have a way to challenge this to see what happens. Certain spawns are contingent on biomes or elevations. Having a spawn target of Hellstone or Ash Block at the surface level most likely isn't going to yield Fire Imps or Lava Bats.

I've spent some time poking around in the code, but it's a big tangled maze of if this, else this, else if that nested checks almost entirely handled in one function. While certain specifics are relatively easy to pin down, the broader logic is a bit of a mess to follow. At the very least, observations I've made recently have me starting to wonder about the relationship between the block that's selected and where enemies spawn, making me think the NPC Spawning entry on the wiki might be over-simplifying the process. I've noticed things happening like Wall Creepers and Black Recluses spawning well outside the spider nests and hallowed/corrupt enemies showing up removed from where they ought to be spawning.

More to follow later.
Nicely done! I hope more good news comes our way.

Keep up the good work.
 
At the very least, observations I've made recently have me starting to wonder about the relationship between the block that's selected and where enemies spawn, making me think the NPC Spawning entry on the wiki might be over-simplifying the process. I've noticed things happening like Wall Creepers and Black Recluses spawning well outside the spider nests and hallowed/corrupt enemies showing up removed from where they ought to be spawning.
More to follow later.
The type of block does play a role. I've had purity mobs show up in what was a corruption I used to have. The cause of the problem? Platform I had placed for mob control and travel/maneuvering. Similar can happen elsewhere. Is especially true in biome overlap areas where a block is common between 2 biomes, allowing mobs specific to either biomes to spawn on the same block type.

Also, mobs that DON'T spawn ON block have lesser restrictions on spawning. Look at Harpies and Arapaimas (I had a bug post asking about the Arapaima spawns). Mobs that spawn in mid-air, in (mid?)water, and upon background walls (e.g. black recluses) are more likely to spawn in location you wouldn't normally expect them. As an example, I have a world where there is a spider nest right up against the dungeon. If I get close enough to the spider nest (I had to dig out part of the wall for a project), it overrides the dungeon spawns. I suddenly have spiders spawning within the dungeon directly.

Mobs spawns mostly work as intended. However, there are errors in the code logic that make you go "huh?" or "WTF?" now and then. The more blatant gameplay-affecting ones get squashed with patches. But there might be other logic fallacies that only pop up in specific cases that aren't common. Like my Arapaima bug: setting up a "Jungle" biome within a Purity biome without any open, exposed jungle blocks. I get Arapaima spawning in my pools and lakes in the area. Someone else helped me confirm it as well.
 
The type of block does play a role. I've had purity mobs show up in what was a corruption I used to have. The cause of the problem? Platform I had placed for mob control and travel/maneuvering. Similar can happen elsewhere. Is especially true in biome overlap areas where a block is common between 2 biomes, allowing mobs specific to either biomes to spawn on the same block type.

Yep, I was just wandering about corruption a little while ago and noticed that there were some Green Slimes popping up around an area where there are platforms. I'll be doing some experiments with that.

Also, mobs that DON'T spawn ON block have lesser restrictions on spawning. Look at Harpies and Arapaimas (I had a bug post asking about the Arapaima spawns). Mobs that spawn in mid-air, in (mid?)water, and upon background walls (e.g. black recluses) are more likely to spawn in location you wouldn't normally expect them. As an example, I have a world where there is a spider nest right up against the dungeon. If I get close enough to the spider nest (I had to dig out part of the wall for a project), it overrides the dungeon spawns. I suddenly have spiders spawning within the dungeon directly.

Yep, there seem to be a lot of edge cases, and due to the way the logic cascades, some enemies end up getting priority in non-obvious ways. The wiki's explanation is, "Once an empty tile is found, it moves down until it finds the ground. If there is enough space for a monster 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 can be spawned. In this case the game does not attempt to find a ground tile." This seems to imply the entity spawns on that block, but the actual spawn location almost seems separately random from the selected block. Dungeon's a little different since dungeon spawns require both dungeon bricks and for the player to be standing in front of natural dungeon walls.

Mobs spawns mostly work as intended. However, there are errors in the code logic that make you go "huh?" or "WTF?" now and then. The more blatant gameplay-affecting ones get squashed with patches. But there might be other logic fallacies that only pop up in specific cases that aren't common. Like my Arapaima bug: setting up a "Jungle" biome within a Purity biome without any open, exposed jungle blocks. I get Arapaima spawning in my pools and lakes in the area. Someone else helped me confirm it as well.

Yeah, I was that someone else. :D
 
From testing mobs that require a surface can spawn on any block. However, as ZeroGravitas discovered, spawns require a 3x2 area and they require at least a single block below the bottom right corner of that 3x2 area. Thus if you place a block to the immediate northwest of the block you want mobs to spawn on, you can block those spawns. Thus mobs are not capable of spawning on any staircase running down and to the right.

Also note that while the spawn area stretches ~45 tiles below the player, the spawns can actually occur on surfaces much lower than that. What likely explains this is that spawns will still initiate in mid-air within the 45 tile limit, but when the first available surface is sought out, it can be outside the spawn limits for the spawn to occur.

Another fun fact: the spawn ranges for bosses are much larger than the limits for regular mobs (including moon event "bosses"). I'd be curious if anyone knows what those exact limits are.
 
Spawning mechanism?

First the game identifies the back wall in order to determine special conditions, such as dungeon walls, lihzahrd wall, spider nest walls, and player placed walls.

Dungeon walls behind the player will readily prevent all spawns except dungeon mobs, and only in dungeon bricks, effectively allowing the dungeon to become spawn-free if the floor is exchanged or covered with another block.

Lihzahrd walls allow spawn of lihzahrd enemies, but do not prevent other spawns. Same applies to spider nest walls, only to spiders instead.

Player placed walls prevent spawns in the area the wall is covering.

The next thing the game considers is the floor-type, different materials cause different mobs to spawn. All non-natural materials (wood, ores, made bricks) do not add more mobs to the list, but do not prevent spawns due to depth. All natural materials have a list of mobs that can spawn from them.

Next is depth, which forcefully adds another plethora of spawns which cannot be blocked normally without back walls. As long as the given depth is reached, the given monster has a chance to spawn. For example: Undead Miners can spawn underground regardless of the type of floor or natural back wall in the area, but will have better chances of spawning if few possible spawn options exist.

Flooring may replace spawns pertaining to certain depths with other mobs of that certain depth.
Ex: Prehardmode: Day time
surface + grass,stone,wood,bricks,dirt,mud,ash = slime
Surface + jungle grass = jungle slime, jungle bat
Surface + ice,snow = ice slime

The space layer will always spawn harpies regardless of anything else.

The edges of the world, so long as enough water and pure sand exist, will always spawn ocean mobs.

Meteorites may replace the spawns of most areas, except the ones mentioned just before.
 
tbh, I would appreciate if there was an easy way to stop monsters spawning completely. Nothing bugs me more than eclipse starting right before blood moon when I'm building some monuments.
 
Any info on Marble and Granite minibiome spawn rules? I'm guessing it's the back walls like spider nests, but information is pretty scarce right now. (I kind of want a granite farm!)
 
Any info on Marble and Granite minibiome spawn rules? I'm guessing it's the back walls like spider nests, but information is pretty scarce right now. (I kind of want a granite farm!)

Stand on marble/granite blocks in cavern layer and you can farm them.
 
Stand on marble/granite blocks in cavern layer and you can farm them.

You don't necessarily need to stand on them. Ideally, the tiles should be 62-84 blocks horizontally away from your current position (35-47 away vertically), where spawning occurs. I've used this to farm Medusa, Hoplite, Grolem, and Granite Elemental drops in my 1.2 world (only the blocks are needed, no wall requirements).
 
Ideally, the tiles should be 62-84 blocks horizontally away
I.e. in the spawn zone, as a spawn surface. But what Thiner is saying, I think, and I've observed, in passing
, is that marble (and granite) mobs will spawn on non-marble/granite surfaces if you are on (not just near, @Thiner?) marble blocks yourself. A modified spawn mechanic. This doesn't apply to the new antlion mobs at all does it (wasn't sure were some came from earlier in a playthrough game)?

As for spawn blocking: only lava surface, totally filled in spawn area (blocks and/or backwalls) or a 45 degree slope (top left to bottom right) for a spawn surface:
Fullscreen capture 13122014 230055.jpg

[DOUBLEPOST=1439406347,1439405724][/DOUBLEPOST]We also recently talked about possible 1.3 spawning changes here: http://forums.terraria.org/index.ph...pper-limit-of-spawn-rate-and-max-spawn.28713/ But as far as I know, slime rain is the only other exception (not talked about above). The slimes spawn in empty spaces above you, somewhat like harpies do, but further out and needed more open space.
[DOUBLEPOST=1439419396][/DOUBLEPOST]Ok, just verified experimentally: granite and marble mobs (pre-jard mode, at least) will spawn without biome specific spawn surface blocks, and without player standing on biome specific blocks (or background walls). Rate *appeared* higher with spawn surface, but just 2 marble blocks vaguely near-ish player were sufficient to spawn Medusa and the odd Hoplite:
CropperCapture[55].jpg
Same with granite mobs. Perhaps a little like snow-flakes, which you can get when there's even a single snow biome block in range. (But a higher base effect.) Thankfully these mobs can't spawn at surface level, so I should be ok to build my marb-ite/gran-ble mini-biome dome...
 
Hmm, the spawning conditions for Granite and Marble enemies is very odd. It's not entirely clear to me what is going on in the code. A quick glance seems to suggest that just have the relevant blocks near the player would be enough to trigger the flag, although the more the better, because the game seems to select the blocks to test somewhat at random. That being said, standing on the blocks or making the spawning surface out of those blocks will always trigger the flag, but it is a little odd. (All this is predicated that you're at the correct depth, of course.)

@Thiner, this is a very interesting quirk to the normal spawning algorithm. I've tracked it down to save some time: in NPC.cs, searching for ".type == 367" in SpawnNPC() and looking for four conditionals should be the right area. There are two boolean flags set there, one for marble biomes and one for granite biomes. Maybe you have some insight?
 
Personal opinions (if inaccurate feel free to correct them):
1. We are talking about Marble/Granite spawns, which is different from each other(maybe). Spawning Mechanics are complicated, and it is very likely that the same theory only apply to a few conditions. So I should clarify: we are talking about Marble/granite spawns, not desert/underground desert spawns or something else.
2. Standing on marble blocks in rock layer is the EASIEST way to set the marble-spawn flag true. In the best condition(when nothing goes wrong) with the marble-spawn flag true you can ensure 4/5 of the spawns are marble-styled.
3. If you put marble blocks under where the mobs would spawn, same applies.
4. If you put marble blocks somewhere near the player and the mobs, then some sophisticated random algorithms come in, and the marble flag might be true sometimes and false at other times. I don't think that we need to dig deeper into the sophisticated algorithms, because it is kind of complex and useless, once we know that a blanket of marble blocks will work. Granite works the same way. The only thing that I think might be valuable enough to say is that, because of the peculiar algorithm, you can see Medusa spawn 30+ tiles away from a existing marble block sometimes.
5. Natural marble walls don't affect spawning.
6. If the marble style is settled, then Medusa will spawn in 5/6 chance when there isn't a Medusa, and won't spawn when there is one.
 
Ok, just verified experimentally: granite and marble mobs (pre-jard mode, at least) will spawn without biome specific spawn surface blocks, and without player standing on biome specific blocks (or background walls). Rate *appeared* higher with spawn surface, but just 2 marble blocks vaguely near-ish player were sufficient to spawn Medusa and the odd Hoplite:

Same with granite mobs. Perhaps a little like snow-flakes, which you can get when there's even a single snow biome block in range. (But a higher base effect.) Thankfully these mobs can't spawn at surface level, so I should be ok to build my marb-ite/gran-ble mini-biome dome...

I was about to post some results along these lines. I did some similar tests and found that being on or near both granite or marble allows their respective NPCs to spawn, even with as few as a single block. In the past I've seen certain enemies spawn well away from their apparent source point. This is particularly noticeable with Wall Creepers and Black Recluses, but I've also seen this happen with other enemies around biome edges. The behavior of marble and granite is definitely new and different though. Learn something new every day....

Man, I could really use some Spelunker Potions that work on code, since I want to go looking to see what's really happening. :confused:
 
We should make a suggestion to the dev clean up the code! :p
On a serious note, @Thiner did you notice anything special about the new underground desert?
Also, just a thought, do some biomes take precedence over there in spawns?
 
Back
Top Bottom