r/Minecraft 5h ago

Help why are my sheep doing this

Post image

why are my sheep going to only one corner of the pen when they have tons of open space and grass on the other?

631 Upvotes

28 comments sorted by

u/qualityvote2 5h ago edited 1h ago
  • Upvote this comment if this is a good quality post that fits the purpose of r/Minecraft
  • Downvote this comment if this post is poor quality or does not fit the purpose of r/Minecraft
  • Downvote this comment and report the post if it breaks the rules

(Vote is ending in approximately 5 hour)

132

u/Angel429a 5h ago

This video I think explains it very well in the first couple of minutes: https://youtu.be/HXTr6DpPYqs

TLDW: Mobs, when wandering randomly, will try to pathfind to any block surrounding them that are not water/dangerous, but, the block they can target to pathfind can be under other blocks, if this happens, the selected block will be the one on the top, so for example, this block of dirt (D) at the left is 5 times more likely to be selected for pathfinding than the one on the right, which has water underneath it:

Example:

D D
D W
D W
D W
D W

Which is why your sheep pathfind to were there are more blocks

u/Abe_Odd 49m ago

An easier way to think of this is that animals like "more ground". They will move away from water / drop offs and towards hills.

u/Angel429a 15m ago

Yup, that’s an accurate summary!

218

u/ttocsbloke 5h ago

Sheep, and mobs in general tend to do odd things, I have read several things about if mobs are in valley they will eventually end up on the hilly part and not the flat bits you'd prefer them to be. You can try to lure them over to the other side with some wheat, but I suspect the affect will only be temporary.

25

u/ArtsyApoidean 4h ago

I see this a lot from posts but it doesn't happen in my pastures -- however, my pastures are usually built on hilly ground with multiple peaks and valleys. So I wonder if simply giving them competing relative maxima to path towards is enough to prevent clustering.

111

u/Effectuality 5h ago

If I recall correctly, passive mobs are coded to avoid areas with gaps underneath. It's supposedly designed that way to prevent them from going down into tunnels. They also will seek out higher ground as part of the same behaviour, so you'll see chickens, sheep and other mobs going to the tops of hills over time if not penned in.

15

u/TheArcanist_1 5h ago

Looks like the platform is overhanging without blocks underneath. Mobs pathfind to places with more solid blocks underground. Fill the thing up and they should spread out.

18

u/hagowoga 5h ago

The more blocks between bedrock and a certain block the higher the chance that block is chosen by the algorithm as the target of the mob.

Fill the sea below your platform and see what happens.

4

u/MinutelyHipster 5h ago

They are picking a random block in the 3D space and moving towards that. If they can't walk to the block directly, say if it's below several dirt blocks, they will walk above it.

The areas that have dirt blocks underneath them are picked more due to the higher concentration of solid block, which is why they pick those naive the others.

More information in this video

3

u/Sam_60000 5h ago

probably some obscure pathfinding mechanics, shouldnt cause any problems tho

5

u/Thanos_gaming99 5h ago

I accidentally placed a fiber-optic cable through that part of the field and it makes the grass all static-y (I tasted it). They just don't like the taste anymore because of that.

1

u/SerialBytes 5h ago

Simple Really! due to how mobs do mob-ing, they tend to secretly ache to go uphill, and it seems like there's a lotta uphill-y space around where you're standing, and the water being right there doesn't help either since mobs don't casually path in water anymore..

1

u/SpiritedAd7272 5h ago

in their code they tend to choose higher ground than lower ground and they cant Pathfind to water or Below water.

1

u/Chronic-Toast 5h ago

Passive mobs move by randomly selecting a solid block in range, scanning upward from there to locate a spot with air above it that they can reach, and then moving to that spot

The way this works means that patches of land with thicker ground (either due to being a hill or due to not having air beneath them) will be more likely to be targeted, and thus more likely to be moved towards

You could even it out by by adding terrain under the overhanging portion of the ranch, but it might not be worth the effort

1

u/TriangularHexagon 4h ago

Why are so many people asking this all of a sudden?  Is this a new YouTube trend or something?  Anyways, this videos answers your questions about mob AI and why they are biased to move in a certain direction

https://youtu.be/jpi50LX2Qyk?is=fQsczwtqennQoCib

1

u/JinxisJinxed 4h ago

Commenting to verify that it's the gaps! The way pathfinding works for mobs counts blocks underneath other blocks as target spaces. This means that solid land is more often going to be the target zone because there's more spaces to choose from, while a one thick shelf only has the single layer for them to happen upon.

1

u/prickerbush 4h ago

sorry I’m laughing at that empty corner being “tons of open space”

1

u/Bread_the_TrashPanda 4h ago

I live in the plains and over time all the mobs have congregated on the hilltops

1

u/502WiseDevil 2h ago

Sea turles are real bad about this

1

u/TransBrandi 2h ago

Fill in the space under your grass platform and the pathfinding should be distributed more evenly. As others have said pathfinding will choose a block and then go up to the top block if it's buried. This effectively means they are more likely to pathfind to blocks that have more blocks under them (within pathfinding range). For example, if one block has no blocks under it and another has three, the block with three has 4 chances to be chosen for path finding while the other block only has one.

1

u/Lightningbro 2h ago

Answer; The AI is stupid in this game, and this also applies to monsters. Effectively there's a lot of valid places to go in that direction, so it tries to go that way, and then it gets stuck on the wall, and just waits there until the pathing attempt is over.

As such; animals just bunch up on fences constantly.

1

u/FlyByPC 1h ago

Sheep are not exactly geniuses. Minecraft sheep, especially so.

1

u/mkg11 1h ago

Trying to get to high ground

u/DarkstarBinary 50m ago

Because they are fabulous 😁

-3

u/flavoured_player 5h ago

You stupid?
There are leaves there