diasurgical / devilutionX

Diablo build for modern operating systems
Other
7.99k stars 782 forks source link

Pathing to unreachable locations leads to an Austin Powers impression #2407

Open ephphatha opened 3 years ago

ephphatha commented 3 years ago

Important information Operating system / DevilutionX master

Describe

https://user-images.githubusercontent.com/357684/126022599-e75a9fc4-4202-4c5d-b674-d8666c1468a9.mp4

To Reproduce Position yourself between the rock and the wall in town then click and hold to move.

Expected behavior Probably shouldn't attempt to move when the destination is unreachable and the entity is already as close to the destination as possible?

Additional context I haven't tracked down the cause for why the entity moves away from the destination but I'm guessing this was to avoid monsters getting stuck.

AJenbo commented 3 years ago

is this vanilla or something new?

ephphatha commented 3 years ago

This is a bug in vanilla Diablo (and devilutionX), but not in Hellfire.

AJenbo commented 3 years ago

Curious that Hellfire isn't affected

ephphatha commented 3 years ago

From playing around with it a bit more I think what's happening is the first click tells the player character to navigate to the other side of the rock. The pathfinding logic determines the shortest path is to walk around the rock to the right, and as it's two tiles wide the character needs to walk away from the destination for a step so it can round the corner. This shifts the viewport and changes the tile the mouse is over to the rock that was directly in front of the player.

In hellfire, navigating to a solid tile appears to use the last valid target instead so the player character continues to walk to the front of the rock.

In diablo having a solid tile as a target is valid so the pathfinding is rerun and the character takes the shortest path to the new target.

AJenbo commented 3 years ago

Yeah that is my assumption as well

FitzRoyX commented 3 years ago

This seems like an ultra rare obstacle placement that probably has no dungeon equivalent. It's also easily avoided by clicking further away from the rock. I'd be careful of causing unforeseen issues by trying to "fix" such a thing.

ephphatha commented 3 years ago

I was able to reproduce this in dungeons, though as you say it's easy enough to avoid by moving the mouse further away from the player. I also shouldn't call this a bug, it's consistent vanilla behaviour (Hellfire even acts the same with visually open tiles like walls) that would be more of a personal preference whether it should change.

https://user-images.githubusercontent.com/357684/126234252-05b8f6b1-59de-422e-af02-a06639811ea1.mp4

I did notice the behaviour Chance4us mentions in #2431, where the player stops moving if you attempt to path to a truly unreachable tile (there are solid tiles surrounding the destination). This could potentially be something that is worth accounting for and would delay this behaviour by a tile as well.

https://user-images.githubusercontent.com/357684/126234549-c61e3eba-338a-403a-8eca-dd01a0fcd88d.mp4

These captures are both from devilutionX but I did test them with Hellfire and the same situations have the same behaviour, the player even stops moving in Hellfire when trying to path to a tile deep in a wall. I have no idea why the rock in town is treated differently by hellfire 😓