Villager spawning code not working effectively #2779

Open
opened 2022-10-14 17:48:13 +02:00 by ancientmarinerdev · 15 comments

I've found 2 villages, and only 1 villager, the second village has at least 7 red beds, possibly more, there is about 10 buildings. The code should spawn a villager per red bed, but it does not.

Code in buildings.lui is below:

local function spawn_villagers(minp,maxp)
	local beds=minetest.find_nodes_in_area(vector.offset(minp,-20,-20,-20),vector.offset(maxp,20,20,20),{"mcl_beds:bed_red_bottom"})
	for _,bed in pairs(beds) do
		local m = minetest.get_meta(bed)
		if m:get_string("villager") == "" then
			local v=minetest.add_entity(bed,"mobs_mc:villager")
			if v then
				local l=v:get_luaentity()
				l._bed = bed
				m:set_string("villager",l._id)
			end
		end
	end
end

Cora mentioned this spawn code sometimes fails. Villages already seem rarer than minecraft, and when the ones you find are non functional, it's quite demoralising and painfully grindy, especially without zoomed out maps, so feels quite a high priority bug. I'll try and add some debug logs in and see if anything is going wrong when I next discover one to give some more information.

I've found 2 villages, and only 1 villager, the second village has at least 7 red beds, possibly more, there is about 10 buildings. The code should spawn a villager per red bed, but it does not. Code in buildings.lui is below: ``` local function spawn_villagers(minp,maxp) local beds=minetest.find_nodes_in_area(vector.offset(minp,-20,-20,-20),vector.offset(maxp,20,20,20),{"mcl_beds:bed_red_bottom"}) for _,bed in pairs(beds) do local m = minetest.get_meta(bed) if m:get_string("villager") == "" then local v=minetest.add_entity(bed,"mobs_mc:villager") if v then local l=v:get_luaentity() l._bed = bed m:set_string("villager",l._id) end end end end ``` Cora mentioned this spawn code sometimes fails. Villages already seem rarer than minecraft, and when the ones you find are non functional, it's quite demoralising and painfully grindy, especially without zoomed out maps, so feels quite a high priority bug. I'll try and add some debug logs in and see if anything is going wrong when I next discover one to give some more information.
Member

here's something: we will always be updating, and the villages are currently, better than they have ever been.

here's something: we will always be updating, and the villages are currently, better than they have ever been.
cora added the
bug
mapgen
mobs
labels 2022-10-14 19:12:22 +02:00
Author
Owner

I'm not trying to criticise here. You've all done a great job. I'm raising a genuine bug to help isolate issues that could affect user experience.

I found a third village with something like 15 houses. When I got there, there was zero villagers despite the fact it seems to have tried to spawn them...

2022-10-14 17:25:07: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-14 17:25:07: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers
2022-10-14 17:25:07: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-14 17:25:07: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers
2022-10-14 17:25:07: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-14 17:25:07: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers
2022-10-14 17:25:07: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-14 17:25:07: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers
2022-10-14 17:25:07: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-14 17:25:07: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers
2022-10-14 17:25:07: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-14 17:25:07: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers
2022-10-14 17:25:07: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-14 17:25:07: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers
2022-10-14 17:25:08: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-14 17:25:08: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers
2022-10-14 17:25:08: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-14 17:25:08: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers
2022-10-14 17:25:08: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-14 17:25:08: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers
2022-10-14 17:25:08: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-14 17:25:08: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers
2022-10-14 17:25:08: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-14 17:25:08: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers
2022-10-14 17:25:08: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-14 17:25:08: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers
2022-10-14 17:25:08: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-14 17:25:08: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers

I don't know if the spawning them and they're dying. This one was a mountain village, and half was high and half was down, but even down I couldn't see anything. I did see a rabbit suicide after jumping from a height in front of me. I'm wondering if they're pathfinding to their death.

I did have a cave which ended up having loads of farm animals end up stuck in. The safety check before moving could have an issue.

I am adding more debug logging in and will keep reviewing.

I'm not trying to criticise here. You've all done a great job. I'm raising a genuine bug to help isolate issues that could affect user experience. I found a third village with something like 15 houses. When I got there, there was zero villagers despite the fact it seems to have tried to spawn them... 2022-10-14 17:25:07: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-14 17:25:07: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers 2022-10-14 17:25:07: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-14 17:25:07: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers 2022-10-14 17:25:07: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-14 17:25:07: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers 2022-10-14 17:25:07: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-14 17:25:07: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers 2022-10-14 17:25:07: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-14 17:25:07: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers 2022-10-14 17:25:07: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-14 17:25:07: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers 2022-10-14 17:25:07: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-14 17:25:07: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers 2022-10-14 17:25:08: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-14 17:25:08: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers 2022-10-14 17:25:08: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-14 17:25:08: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers 2022-10-14 17:25:08: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-14 17:25:08: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers 2022-10-14 17:25:08: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-14 17:25:08: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers 2022-10-14 17:25:08: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-14 17:25:08: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers 2022-10-14 17:25:08: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-14 17:25:08: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers 2022-10-14 17:25:08: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-14 17:25:08: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers I don't know if the spawning them and they're dying. This one was a mountain village, and half was high and half was down, but even down I couldn't see anything. I did see a rabbit suicide after jumping from a height in front of me. I'm wondering if they're pathfinding to their death. I did have a cave which ended up having loads of farm animals end up stuck in. The safety check before moving could have an issue. I am adding more debug logging in and will keep reviewing.

Animals are dumb when it comes to heights. In my main lets play world, I have a cliff aply named the Suicide Cliffs because wolves constantly jump off to their death instead of taking the bridge I built. I also call it the Cliffs of Insanity, but you have to have watched a certain movie to know where that comes from.

Animals are dumb when it comes to heights. In my main lets play world, I have a cliff aply named the Suicide Cliffs because wolves constantly jump off to their death instead of taking the bridge I built. I also call it the Cliffs of Insanity, but you have to have watched a certain movie to know where that comes from.
Contributor

well the villagers are somewhat safe in their houses at least until they find a way out.

see if the add_entity returns a valid object (e.g. put some debug code into the "if v then"

well the villagers are somewhat safe in their houses at least until they find a way out. see if the add_entity returns a valid object (e.g. put some debug code into the "if v then"
Author
Owner

I've been reading through the mobs code for walk, and it seems that mobs will walk if they aren't scared of the height of the block. Villagers have that at 4, so if it's a 3 drop, they'll still have a chance of going down, and not going back up. In this case, they'll always eventually end up at the lowest point.

I don't think they check for a cliff unless in danger.

I saw this with a cave near my base that all farm animals ended up in (see screenshot).

I don't believe mobs should (when calm and not in danger), walk down from a block that is more than 1 high, and they can't get back up.

With farm animals, they struggle to jump up when lead (can fail 5 jumps first before getting up), so I suspect fail to jump, change direction, go down, fail to jump, change direction go down, etc.

This is even more important if it's a villager and needs to get back to it's job block or bed.

Please can someone validate I have understood this correctly?

I've been reading through the mobs code for walk, and it seems that mobs will walk if they aren't scared of the height of the block. Villagers have that at 4, so if it's a 3 drop, they'll still have a chance of going down, and not going back up. In this case, they'll always eventually end up at the lowest point. I don't think they check for a cliff unless in danger. I saw this with a cave near my base that all farm animals ended up in (see screenshot). I don't believe mobs should (when calm and not in danger), walk down from a block that is more than 1 high, and they can't get back up. With farm animals, they struggle to jump up when lead (can fail 5 jumps first before getting up), so I suspect fail to jump, change direction, go down, fail to jump, change direction go down, etc. This is even more important if it's a villager and needs to get back to it's job block or bed. Please can someone validate I have understood this correctly?
Member

then at a midly high slope have mobs just not even moving on at all, it would be a nightmare trying to lura a tamagble mob into your animal pen.

then at a midly high slope have mobs just not even moving on at all, it would be a nightmare trying to lura a tamagble mob into your animal pen.
Author
Owner

It is already a nightmare trying to lure a cow to your pen. Any uphill is agony. They don't struggle to jump like the in Minecraft.

It is already a nightmare trying to lure a cow to your pen. Any uphill is agony. They don't struggle to jump like the in Minecraft.
Contributor

they do have some tendency to end up at low points yes. But if that was the case with your villagers you should be able to still find them ... I think the spawning actually doesn't work out sometimes. Not sure why though i thought its maybe if the player is too far away or something but i could not reproduce that so far.

I mean we could make a minetest.after loop and keep trying to spawn them until the object is there if that's actually the case.

they do have some tendency to end up at low points yes. But if that was the case with your villagers you should be able to still find them ... I think the spawning actually doesn't work out sometimes. Not sure why though i thought its maybe if the player is too far away or something but i could not reproduce that so far. I mean we could make a minetest.after loop and keep trying to spawn them until the object is there if that's actually the case.
Member

They don't struggle to jump like the in Minecraft.

I am working on this.

> They don't struggle to jump like the in Minecraft. I am working on this.
Author
Owner

I'm watching them operate on creative.

They are jumping down 3 blocks, maybe more into water.
They jump down more than 3 blocks on to land.
They also walk onto flowing lava.
They get off of water on to flowing lava.
They also walk diagonally onto lava source.

It could be that they don't spawn, but if they are suicidal, then it wouldn't matter if they did spawn because they might not last long enough for you to find them.

Edited.

I'm watching them operate on creative. They are jumping down 3 blocks, maybe more into water. They jump down more than 3 blocks on to land. They also walk onto flowing lava. They get off of water on to flowing lava. They also walk diagonally onto lava source. It could be that they don't spawn, but if they are suicidal, then it wouldn't matter if they did spawn because they might not last long enough for you to find them. Edited.
Contributor

well as i said they usually take some time to get out of their houses - and even more now that far mobs don't move anymore.

well as i said they usually take some time to get out of their houses - and even more now that far mobs don't move anymore.
Author
Owner

A bit of an update on this, I added some logging in:

local function spawn_villagers(minp,maxp)
	minetest.log("warning", "[mcl_villages] Attempted to spawn villagers" .. minp.x .. ":" .. minp.z)
	local beds=minetest.find_nodes_in_area(vector.offset(minp,-20,-20,-20),vector.offset(maxp,20,20,20),{"mcl_beds:bed_red_bottom"})
	for _,bed in pairs(beds) do
		minetest.log("warning", "[mcl_villages] Attempted to spawn villager for this bed")
		local m = minetest.get_meta(bed)
		if m:get_string("villager") == "" then
			minetest.log("warning", "[mcl_villages] Meta set, try to spawn")
			local v=minetest.add_entity(bed,"mobs_mc:villager")
			if v then
				minetest.log("warning", "[mcl_villages] Successfully added villager entity")
				local l=v:get_luaentity()
				l._bed = bed
				m:set_string("villager",l._id)
			end
		end
	end
end

Obviously, I made a slight error on the meta set, log should say meta for villager blank, but it gives better information on what is happening.

One issue is that I played on a version that probably doesn't have the code you added so mobs far away don't move, so by the time I got there, villagers probably suicided. I was exploring (checking logs every 3 to 4 mins and ran there as soon as I could. But when I got there, I found 4 in their house, and 1 roaming away (that eventually dissappeared) out of 10 spawns, so villagers could be emotionally unstable and do not want to live. It was a mountain village so definitely more risky (the village spawn code for houses may be something that could be adapted eventually).

Summary :

20 houses
?? beds (will verify and update)
10 attempts
10 successful spawns
5 villager found

Log result:

2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Place beltower
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 1
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 2
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 3
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 4
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 5
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 6
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 7
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 8
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 9
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 10
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 11
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 12
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 13
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 14
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 15
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 16
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 17
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 18
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 19
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 20
2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic
2022-10-16 02:18:46: ACTION[Emerge-0]: [mcl_structures] mineshaft placed at (815,-33,1963)
2022-10-16 02:18:46: ACTION[Emerge-0]: [mcl_structures] mineshaft placed at (815,-59,1963)
2022-10-16 02:18:46: ACTION[Emerge-0]: [mcl_structures] mineshaft placed at (721,-9,1864)
2022-10-16 02:18:46: ACTION[Emerge-0]: [mcl_dungeons] Placing new dungeon at (817,-50,2080)
2022-10-16 02:18:46: ACTION[Emerge-0]: [mcl_dungeons] Filling chest 2 at (820,-49,2085)
2022-10-16 02:18:46: ACTION[Emerge-0]: [mcl_dungeons] Filling chest 1 at (819,-49,2085)
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Spawn iron golum
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers706:2028
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers713:2003
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Meta set, try to spawn
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Successfully added villager entity
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Meta set, try to spawn
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Successfully added villager entity
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers727:2007
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Meta set, try to spawn
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Successfully added villager entity
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Meta set, try to spawn
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Successfully added villager entity
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers741:2007
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers742:2033
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers721:2031
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers731:2021
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Meta set, try to spawn
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Successfully added villager entity
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Meta set, try to spawn
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Successfully added villager entity
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers717:2017
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers723:1993
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers736:1991
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers747:2019
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers709:1989
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers749:1995
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers757:2007
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Meta set, try to spawn
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Successfully added villager entity
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Meta set, try to spawn
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Successfully added villager entity
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers698:1999
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers719:1978
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Meta set, try to spawn
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Successfully added villager entity
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers735:1978
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers752:2032
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers727:2045
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers690:2017
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Meta set, try to spawn
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Successfully added villager entity
2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed

My view:

The moving far away is one issue (solved by Cora)
The villager path finding needs refinement (I think they should move on a square that is no more than 1 square drop, so they can get back up, also that block shouldn't be lava or flowing lava). This way, I think there livecycle will dramatically improve. Happier villagers make happier players :D.

A bit of an update on this, I added some logging in: ``` local function spawn_villagers(minp,maxp) minetest.log("warning", "[mcl_villages] Attempted to spawn villagers" .. minp.x .. ":" .. minp.z) local beds=minetest.find_nodes_in_area(vector.offset(minp,-20,-20,-20),vector.offset(maxp,20,20,20),{"mcl_beds:bed_red_bottom"}) for _,bed in pairs(beds) do minetest.log("warning", "[mcl_villages] Attempted to spawn villager for this bed") local m = minetest.get_meta(bed) if m:get_string("villager") == "" then minetest.log("warning", "[mcl_villages] Meta set, try to spawn") local v=minetest.add_entity(bed,"mobs_mc:villager") if v then minetest.log("warning", "[mcl_villages] Successfully added villager entity") local l=v:get_luaentity() l._bed = bed m:set_string("villager",l._id) end end end end ``` Obviously, I made a slight error on the meta set, log should say meta for villager blank, but it gives better information on what is happening. One issue is that I played on a version that probably doesn't have the code you added so mobs far away don't move, so by the time I got there, villagers probably suicided. I was exploring (checking logs every 3 to 4 mins and ran there as soon as I could. But when I got there, I found 4 in their house, and 1 roaming away (that eventually dissappeared) out of 10 spawns, so villagers could be emotionally unstable and do not want to live. It was a mountain village so definitely more risky (the village spawn code for houses may be something that could be adapted eventually). Summary : 20 houses ?? beds (will verify and update) 10 attempts 10 successful spawns 5 villager found Log result: 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Place beltower 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 1 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 2 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 3 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 4 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 5 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 6 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 7 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 8 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 9 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 10 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 11 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 12 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 13 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 14 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 15 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 16 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 17 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 18 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 19 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Build house 20 2022-10-16 02:18:46: WARNING[Emerge-0]: [mcl_villages] Get ready to place schematic 2022-10-16 02:18:46: ACTION[Emerge-0]: [mcl_structures] mineshaft placed at (815,-33,1963) 2022-10-16 02:18:46: ACTION[Emerge-0]: [mcl_structures] mineshaft placed at (815,-59,1963) 2022-10-16 02:18:46: ACTION[Emerge-0]: [mcl_structures] mineshaft placed at (721,-9,1864) 2022-10-16 02:18:46: ACTION[Emerge-0]: [mcl_dungeons] Placing new dungeon at (817,-50,2080) 2022-10-16 02:18:46: ACTION[Emerge-0]: [mcl_dungeons] Filling chest 2 at (820,-49,2085) 2022-10-16 02:18:46: ACTION[Emerge-0]: [mcl_dungeons] Filling chest 1 at (819,-49,2085) 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Spawn iron golum 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers706:2028 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers713:2003 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Meta set, try to spawn 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Successfully added villager entity 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Meta set, try to spawn 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Successfully added villager entity 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers727:2007 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Meta set, try to spawn 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Successfully added villager entity 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Meta set, try to spawn 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Successfully added villager entity 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers741:2007 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers742:2033 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers721:2031 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers731:2021 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Meta set, try to spawn 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Successfully added villager entity 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Meta set, try to spawn 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Successfully added villager entity 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers717:2017 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers723:1993 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers736:1991 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers747:2019 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers709:1989 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers749:1995 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers757:2007 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Meta set, try to spawn 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Successfully added villager entity 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Meta set, try to spawn 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Successfully added villager entity 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers698:1999 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers719:1978 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Meta set, try to spawn 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Successfully added villager entity 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers735:1978 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers752:2032 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers727:2045 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Init nodes called 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villagers690:2017 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Meta set, try to spawn 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Successfully added villager entity 2022-10-16 02:18:47: WARNING[Emerge-0]: [mcl_villages] Attempted to spawn villager for this bed My view: The moving far away is one issue (solved by Cora) The villager path finding needs refinement (I think they should move on a square that is no more than 1 square drop, so they can get back up, also that block shouldn't be lava or flowing lava). This way, I think there livecycle will dramatically improve. Happier villagers make happier players :D.
Contributor

They should in theory try to go back to the village when they go too far away – but ig in a lot of cases they simply can't. I've thought about teleporting them back before tbh.

The biggest problem with the pathfinding is that it does not take y space on the path into account (1 high holes are enough for it).

But actually implementing pathfinding is prob beyond me honestly - i just used the minetest function.

I'm wondering how you're able to reproduce this so seemingly consistently though because i've tried all kinds of things and could not (p sure i have seen the issue "in the wild" though).

If you think they move away too quickly you could try fast/flying there ... or use a more convenient client like dragonfire (it can show you where entities are, make everything bright and much more).

https://github.com/dragonfireclient/dragonfireclient

They should in theory try to go back to the village when they go too far away – but ig in a lot of cases they simply can't. I've thought about teleporting them back before tbh. The biggest problem with the pathfinding is that it does not take y space on the path into account (1 high holes are enough for it). But actually implementing pathfinding is prob beyond me honestly - i just used the minetest function. I'm wondering how you're able to reproduce this so seemingly consistently though because i've tried all kinds of things and could not (p sure i have seen the issue "in the wild" though). If you think they move away too quickly you could try fast/flying there ... or use a more convenient client like dragonfire (it can show you where entities are, make everything bright and much more). https://github.com/dragonfireclient/dragonfireclient

It could be that they don't spawn, but if they are suicidal, then it wouldn't matter if they did spawn because they might not last long enough for you to find them.

I created a new issue #4141, as this was mostly about the question of spawning and is already two years old, but I recently came upon the same problem. @ancientmarinerdev: You may be right that it may just be the tendency of villagers being suicidal. You have a better oversight over the code and the villager behavior.

If village life starts even when the player does not see the village and still has some distance between and they "live" out their full suicidal potential, it may result in "village death" when the player finally discovers the village.

It would be great if this could be improved! :-)

> It could be that they don't spawn, but if they are suicidal, then it wouldn't matter if they did spawn because they might not last long enough for you to find them. I created a new issue #4141, as this was mostly about the question of spawning and is already two years old, but I recently came upon the same problem. @ancientmarinerdev: You may be right that it may just be the tendency of villagers being suicidal. You have a better oversight over the code and the villager behavior. If village life starts even when the player does not see the village and still has some distance between and they "live" out their full suicidal potential, it may result in "village death" when the player finally discovers the village. It would be great if this could be improved! :-)

[…] I added some logging […]

@ancientmarinerdev: Is this something we could use, too, with some kind of setting or option in the MCL2 option page in Minetest options? It would be great to have some kind of way to see what the cause was for villagers disappearing, "ghost villages" and so on. Just to make sure it is not a bug but some "natural" cause.

Like a ravine or mobs the player has not already detected, but roam inside the village or beside the paths villagers take.

> […] I added some logging […] @ancientmarinerdev: Is this something we could use, too, with some kind of setting or option in the MCL2 option page in Minetest options? It would be great to have some kind of way to see what the cause was for villagers disappearing, "ghost villages" and so on. Just to make sure it is not a bug but some "natural" cause. Like a ravine or mobs the player has not already detected, but roam inside the village or beside the paths villagers take.
Sign in to join this conversation.
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: VoxeLibre/VoxeLibre#2779
No description provided.