Why animals like walking uphill in Minecraft

551,545
0
Published 2023-02-02

All Comments (21)
  • @2No2Name
    13:00 You wrote someone should check the code on this. I did now: Animals like to pathfind to grass blocks more than other blocks. Grass blocks have a score of 10. Other blocks have a score of: h = g - 0.5 . g = f / (4 - 3*f) with f = light level / 15 . In the nether: h = g * 0.9 + 0.1 - 0.5 When pathfinding 10 random positions in the search range are tested and scored. If the position fails the test, it will not be scored. The one with the highest score is chosen as destination (if any position was scored). This probably explains that they prefer surface blocks, because they have a higher light level, and thus the highest score. The position test is: Position not outside the world height. Position within some spherical range. Block below is opaque full cube. Position has no pathfinding penalty (cactus, lava, water, etc). I am not sure whether there is anything in the code that causes the animals to search upwards from the chosen destination. I did not find that at least. I think testing this in the end dimension where there is no skylight might be interesting to avoid this light dependent scoring. Edit: found the upwards search. After choosing the position using the scoring, the position is modified: While the block's material at the position is solid, move the position one up. If the position is outside the world height, exit the loop. If the resulting position doesn't have water and doesn't have a pathfinding penalty the animal pathfinds to it, otherwise no pathfinding
  • I wonder if the increase in likelihood to walk uphill was purposeful to keep peaceful mobs out of caves and on hills to be more visible
  • @amehwican
    You should do this with sheep and color them depending on their position to make it easier to see who went where
  • @Mogswamp
    New favorite type of Minecrafter unlocked: cool math substitute teacher
  • I'm making my farms out of glass now, so the animals will STAY PUT! I've never seen mobs so controlled and behaved in my entire 8 years of playing. Thank you for this.
  • When testing the way mobs behave on double-stacked carpet, I learned that information on MC wiki on it is old. As far back as 1.16, mobs are now fine with walking off cliffs as high as 3 blocks, and thus are not scared by the trench under carpets. What this means is that if a mob wonders about near a staircase that is more than a block steep, it will be able to randomly walk down the stairs, but will not be able to climb back up. This is a very annoying problem, I have dozens of villagers and iron golems of my village stuck inside a river with steep banks. They just keep replacing their stuck brethren with new ones. And any time I have a 2-block deep hole of any size for any reason within a chunk from a village, it soon begins filling up with villagers. They also keep falling off taller cliffs into a ravine, because they keep jumping onto ledges on the cliff where they can get to, but get stuck, and later the next villager jumps onto them and pushes the other down. I have a bunch of fall-damaged villagers down my ravine. I was hoping someone investigates why this self-destructive pathfinding is a thing, and maybe incentivises bugfixing it. If villagers were not trying to end themselves constantly, I would be perfectly fine with not locking them up in 1x1 holding cells.
  • @jonasl.4810
    I like how you could technically find caves by spawning sheep and seeing where they will go.
  • @Halal_Gaming
    I once had a small village with a hill in the centre, and for whatever reason all the villagers without fail would immediately gravitate towards that one hill. This video explains why perfectly.
  • @jackwoodhead
    Finally an answer for this phenomenon! I've seen this occur all the time in 2 scenarios: * Animals in my multiplayer survival world constantly get themselves stuck on a cliff face next to our base * In the survival map "Drehmal Primordial" if there are any hills near any towns/villages, they are always littered with cats (and often horses and other animals too) while the surrounding terrain is typically empty How weird to know that caves, and filling or not filling in terrain when landscaping, actually affects mob pathfinding! Also I never knew that mobs can pathfind across non-solid blocks but they don't pathfind TO said blocks.
  • @thegammakat
    My biggest issue with this pathfinding is that it also applies to bees. I'll have bees leaving their hives just to go to the mountian next door where they just get lost. Even when i built a glass roof around the forest, they found small ways to get out and just would go right up the mountain. Kinda werid ams suchs with animals that are more free roam with farming. (Given this is on 1.17, but i still have a degree of this issue on 1.19)
  • In the first experiment instead of tracking pigs tracking sheep dyed to match the color of the block they're standing on could've given more interesting results, since you could see the original position of a mob easily.
  • Maybe the reason mobs look up until they find air because that way they will try to swim in water or lava instead of just swimming to the bottom and drowning.
  • ahhh ive always wondered about this! my personal fav example of this is endermen in warped forests, the goobers will pathfind up to a tiny corner and just make a right mess with their blocks. i like to call them endermen play pens lmao. keep up the good work!!
  • @awfulroffle
    That explains why all of my animals tend to congregate on decorative hay in the farm pens. Still frustrating, wish I could fix that, but at least there's a study explaining it lol
  • @julesrules7
    Watching pigs pathfind to certain things wasn't the video I expected to watch today, but it's very welcome.
  • @EdgarsLS
    This could allow for some fence-less farm designs, tricking the pathfinder to never go outside a perimeter
  • @Cuestrupaster
    Another thing that might go into consideration is that when there's a 3 block fall mobs "don't path find" through it or at least cancel it, because they know it would cause them to take damage, so if they're standing on a hill where there is a 3 block fall it adds even more odds to going up.
  • This is giving me strong Gnembon vibes! I'm not sure if you've seen it, but he has a video about mob wandering for mob farms, including a couple of designs for blaze farms that use it pretty elegantly.
  • i've been wondering about this ever since i bred a wolf army and whenever i put down my crafting bench they all started jumping up onto it like it was the best thing ever
  • @taupi5246
    I think the checking for air mechanic was implemented specifically to avoid animals going in cave, which in turn makes them more likely to go uphill. That seems to make sense from an immersion point of view, you don't expect to see a pig wandering about when you're going to mine for iron.