mojira.dev
MCPE-49607

AI pathfinding never ends until their goal is reached

The bug

If an entity identifies a path, they will always attempt to execute it, even if it later becomes mostly (not fully) impossible, unless the player interacts with them via lead (moving them dozens of blocks), breeding, or leaving the world.

This report is not MCPE-46805 or MCPE-45527but does add to the problem.

 

There are many ways to reproduce this, including some that may not be listed here:

Method 1

  1. Make a large cubic area enclosed with any block or fence (suggested 11 x 11)

  2. Spawn about 32 of any equal sized mob

  3. Wait 1-3 minutes

At the end, every mob should be pushed towards one side or corner of the cube, constantly colliding off of each other, until the player interacts with them (in the ways listed above).

Method 2

  1. Make an enclosed 3 x 4 area

  2. Set up a tripwire on one of the two shortest sides

  3. Link it to a command block that teleports any mob (that will be used later) back into the box

  4. Place fences above the tripwire hooks, but leave the block above the tripwire (the string) clear

  5. Spawn a mob that's taller than one block

  6. Wait until they pathfind outside of the area

At the end, that mob should never stop attempting to leave the box until the player interacts with them (in the ways listed above).

Method 3

  1. Spawn a mob that can be leashed

  2. Leash the mob

  3. (optional) Place the lead on a fence

  4. Wait until they pathfind

At the end, that mob should never stop pathfinding in the same direction that they're attempting to, until the player interacts with them (in the ways listed above).

Method 4 (relates to method 3)

  1. Spawn a mob that can be leashed

  2. Leash the mob (do not place the lead on a fence)

  3. Place a fence and any full block next to each other

  4. Stand next to the fence as close as possible on any side (except for on top of the full block)

  5. Wait for the mob to pathfind

When the mob goes too far on the lead, they will come back and jump onto the fence (the block that the player is in) endlessly, until the player interacts with them (in the ways listed above).

Method 5

  1. Spawn a mob in a body of water (a generated ocean coastline or river is recommended)

  2. Wait until they pathfind onto land

  3. Quickly place a full block on land, directly in their way from leaving the water

At the end, they will endlessly jump in the water until the player interacts with them (in the ways listed above).

Linked issues

Attachments

Comments 26

This happens to me as well, I constructed a river/coral area and every AI (tropical fish, dolphin, turtle and drowned) pathfinding kept going towards a goal they will never reach on the other side of an iron bar wall.

attached is a photo with mobs headed one direction, all of them constantly pushing eachother and another of the same but all mobs in one. they want whatever is on the other side!

Playing Windows 10 bedrock on a Realm.

 

[media][media]

 

That's not exactly what this report is about. Although the aquatic mobs pathfind endlessly to the other side of the iron bars, something is making them pathfind to the other side in the first place.

That fact alone might need its own report.

I've noticed this for a long time in my livestock pens (but didn't report it). Mobs frequently path to a corner, particularly a northwest corner. When several do it at the same time, the first one in can't get out because of the crush of the ones behind it, and the ones behind just keep trying to push it through the fence to satisfy their pathfinding goal. If you lure them away with food, you can break it up and they scatter, but eventually it happens again. It happens most often with cows because their collision box is so big they have a high probability of blocking each other's path in a narrow space, but it also happens regularly with my sheep.

[media]

@unknown - That would be MCPE-39073.

Happen on me as well.  windows 10 bedrock v1.14.30

[media]
16 more comments

@unknown: The issue you're talking about was reported in MCPE-41092, which was fixed (finally!) in 1.17.10. It should no longer be occurring, and indeed, I saw it for years in my own world in cow and sheep pens but it has stopped happening now.

If you're still experiencing that issue, please comment about it and provide any additional information, such as screenshots, in MCPE-41092.

im still experiencing this issue in 1.18.2 just like in this picture : 

[media]

Based on younes smati's screenshot I retested MCPE-41092, and it's not that bug. So it looks like just mobs getting pinned into corners by other mobs. Mobs actually do stop pathfinding in that situation, and if you watch animals in pens like the ones shown for a while you will see that the ones pushing into the corners stop and the stuck ones wander toward another part of the pen. It is possible for them to get perpetually stuck if you have too many mobs enclosed in a small area. But that's not a bug, it's just a result of how the pen is built. If you want to see animals wander in a more natural looking way, you need to give them more space.

Consider the details given for Method 1 in the description. An 11 x 11 fenced area contains 9 x 9 = 81 grass blocks. If you spawn 32 animals, that's less than 3 blocks for each animal to move around in without bumping another. Looked at another way, any time an animal tried to wander within the pen, there would be a 32/80 = 40% chance the destination spot it chose would already be occupied.

I hope that corner problem in that screenshot gets fixed somehow.

Anyway, I'm still having a lot of problems in 1.18 with singular mobs getting stuck on non-full blocks like gates, fences, glass panes, hanging lanterns etc. They just freeze in place, it seems like they're trying to get through gates and glass panes but can't, so they just freeze forever. This is not limited to cows etc, but villagers as well, which causes them to lose job sites and beds. This gets much worse in the 1.18 update, my villagers are getting stuck in places they were previously okay with, such as walls with glass panes, and a line of wooden gates.

There are also cases of Iron Golems and horses jumping repeatedly on carpets, causing them to freeze, and chickens not moving at all when surrounded with dead corals. This has been a bug for a long time.


Reply from @unknown:

Mobs getting stuck on blocks line panes and fence posts is tracked at MCPE-46805.
I've reopened your report on dead corals (MCPE-128687) since it was not fixed by the fixed to pathing on partial blocks.

I cannot reproduce this in 1.18.10.26 beta. Method 4 still occurs, but it's no longer endless (it's a different issue).

Makzevu

(Unassigned)

244137

Confirmed

Multiple

1909 (18363.535)

1.18.0.22 Beta, 1.17.40.20 Beta, 1.17.11 Hotfix, 1.17.0.54 Beta, 1.16.220.50 Beta, ..., 1.17.0, 1.17.2 Hotfix, 1.17.41 Hotfix, 1.18.0, 1.18.2 Hotfix

1.18.10

Retrieved