mojira.dev
MCPE-41107

Fish and dolphins' pathfinding gets messed up when not in their natural spawn place

The pathfinding in a house I made leads the fish to either not move or try to get to a nearby river(I think)

the bottom picture the fish have not moved outside of one block, and the top three show the fish all in a corner, and where the room is in relation to the only other water body.

Edit:

just to clarify for anyone reading this in the future, we have deduced that dolphins prefer natural large water bodies (I.e. the ocean) to the water bodies they spawn in, which is part of the issue I found. 

Linked issues

Attachments

Comments 9

Having restarted the game a couple of times, the pond fish move, but the ones in the tank only push each other in the corner. They only come out of said corner if one is pushed into the bubble stream. I have also since found out that if a dolphin gets stuck on land due to a bubble stream, it will not pathfinder to the water. It has previously pathfound to a bedroom (with no water in)

The behaviors of fish and dolphins are separately defined and very different, so I'll address them separately.

Fish do not have a behavior that causes them to seek a river or ocean when they're in a tank or pool. The top priority behavior for fish is to avoid the player. Both cod and salmon will pathfind away from a player who is too close. For cod, that's 6 blocks, but salmon are more tolerant and will allow the player to get as close as 3 blocks before fleeing. It is probable that the crowding into a corner you observe is the result of you being close enough to scare them, and it stops because you move father away when you follow one up the bubble stream. To test it, you could observe from various positions to see whether they flee into different corners. They will only flee a certain distance, so you'll probably only see the corner crowding effect if the pond or tank is small, say less than 12 blocks in the direction they flee.

You're also reporting that the fish don't swim around as much as you expect. That's probably because they don't have much room. When fish are wander-swimming, they look up to 16 blocks away (and up to 4 blocks away vertically) for a random target block. If it's water and they can find a path to it, they swim in that direction. If your pond or tank is too small, they are seldom able to find a water block that's sufficiently far to swim toward, so they simply idle in place. (The reason they don't target a very close water block is that that would make them constantly jerk around in a small pond, which would look as if they were frightened all the time, very unnatural.)

Dolphin behavior is quite a bit more complicated. They don't avoid players, so it's not the same fish issue for them. They have different behaviors for when they're in water, on land drying out, on land in the rain, and fully dried out. When on land and not fully dried out, they do seek water, though not necessarily a river or ocean. When they're in water, they will occasionally beach themselves deliberately.

It may be that when a dolphin accidentally becomes beached (such as by a water stream or bubble column), its AI thinks that it's still in the water because it didn't beach itself deliberately. That could prevent it from trying to find water, and it would probably continue to move around as if it were swimming randomly. It has other behaviors in water as well, and how those would work out when it's actually on land is too random to predict. But there is a possibility that the developers didn't anticipate an accidentally beached dolphin and the AI may need an adjustment for it. We'll look into that possibility.

The dolphin and fish scenarios do seem correct in this instance, I will definitely check out expansion and movement ideas. The fish however also accidentally beached themselves.

to create a modern bridge, I had glass with carpet on top and trapdoors either side on the ceiling (“closed” position) to stop the player deliberately falling off. Could this affect pathfinding too?

I assume your fish accidentally beached themselves by getting trapped in a bubble column that dropped them on dry land. One stranded, they should be flapping around as if trying to get back to the water. I believe this is how they're intended to behave.

What I know about fish pathfinding is only what I can see in the vanilla behavior pack. I don't have access to the code and don't know any details about how they determine which paths are obstructed, so I can't answer your question with any certainty. That said, I see no obvious reason why glass, carpet, or trapdoors would be treated any differently from other non-water blocks. Is there something specific you observe that you think might be a bug?

After experimenting with dolphins "accidentally" beached by a bubble column, I think it's clear that the game does recognize this and alter the dolphin's behavior appropriately. It makes different sounds and seeks toward the nearest water when this happens. So as far as I can tell, there are no unexplained phenomena in this report that we might need to investigate as possible bugs. Do you agree?

I have yet to test this, as my iPad ran out of charge, but the couple of things I have noticed that have not been accounted for are on 3 occasions dolphins have not successfully returned to the water from a one wide bridge with water either side. Is it possible they find it hard to pathfinder on carpets in the same way zombies cannot pathfinder to or over carpet unless they are already on it? If this is the case, it’s up to you or another mod to close or leave it open as you feel necessary, but if all behaviour seems vanilla it can be closed. Will probably test the behaviour in a replicated room on another device later

I wasn't aware of issues with carpets, so I tested that and found that zombies do, in fact, pathfind over carpet. I then tested dolphins beached onto a 1-wide bridge covered with carpet and found that they, too, will pathfind over carpet, whether or not they start out on it.

Interestingly, I discovered that the dolphins pathfind toward the open ocean in preference to a pond or small pool, given the choice. I wasn't aware of that and don't know the parameters, such as how far away they can detect the ocean or how they distinguish between an ocean, a river, and a pool. They will pathfind to a pool if there is no other choice, so they're probably looking at more than just the biome ID.

Thus, it Is possible that in the cases you observed, the dolphins on the carpet were targeting an ocean or river that was too far away for them to reach it before they dried out and died. While not a certainty, this is a plausible explanation.

As I believe there are no more reported phenomena that can best be explained as a bug, I will close this ticket at this time.

I agree with your descicision, it is possible the zombie thing is an old or PC bug, if I find this bug is a thing I will search to see if it has been reported and possibly release a new ticket. Thanks for the help. The dolphin preference to pathfinder while beached to an ocean makes sense, and I will keep that in mind. 

Um...I didn't mean to imply that. The preference I described was meant to apply only to beached dolphins trying to get back into the water. In my test, they were beached right next to several small pools but chose to go a longer distance to get to the ocean if they had a path to it. I don't know whether that generalizes to their behavior while swimming (and it would be hard to test, given that their swim direction is largely random), but it's certainly plausible.

P

(Unassigned)

Unconfirmed

iOS

iOS 10.3.3

1.8.1

Retrieved