minetest / minetest

Minetest is an open source voxel game-creation platform with easy modding and game creation
https://www.minetest.net/
Other
10.6k stars 2k forks source link

Pathfinder doesn't work on snow blocks #4192

Open MarkuBu opened 8 years ago

MarkuBu commented 8 years ago

I noticed that the pathfinder doesn't work if the player stands on a snow block like the one I am pointing on the screenshot.

If I stand on the dirt_with_snow block in front the pathfinder works

That means, just have a little bit snow in your pocket to be safe for mobs ;-)

screenshot_20160606_180024

est31 commented 8 years ago

Yeah its one of the many problems the pathfinder has. The issue is that if you add in nodeboxes, the pathfinder problem gets even harder.

tobyplowy commented 8 years ago

@est31 the Pathfinder really needs to be improved, it has a lot of problems :/

Wuzzy2 commented 3 years ago

This bug is still true, although not literally as described. You can verify this bug in DevTest by placing a slab, standing on it and trying to find a path towards anywhere else (using the pathfinder tester). It will fail. This test is functionally the same as the test with snow.

So the reason for this bug is the following:

First of all, I am going to assume back when this issue was created, snow in Minetest Game was a walkable block. This explains why it might no longer be happening exactly as described.

The pathfinder considers all walkable blocks to fully block the path, i.e. the pathfinder refuses to find a path through a walkable block. This includes even small slabs and show sheets. Meaning that if you stand on walkable snow (as seen above), the pathfinder thinks you're stuck inside a solid (=blocking) node. The pathfinder will immediately give up if the starting node is walkable.

The pathfinder only sees nodes as fully passable or fully blocked. All walkable nodes are fully blocked, no matter how small the nodebox actually is.

So, the fundamental issue essentially is a missing feature in the pathfinder, which doesn't understand nodeboxes yet. So is the solution to consider all walkable nodeboxes to be passalbe? No. While some of them (like carpets) can be passed, they can only be passed in a certain direction (you can go sideways, but you cannot go downwards on a walkable carpet). So, figuring out how to deal with walkable nodeboxes in the pathfinder is something that needs to be thought of eventually.

As for this particular issue, however, I think there can be simple workaround: If the starting point of the path is a solid node, try a 1-node jump (if jumps are permitted) to the node above, and if that node above is free, start the pathfinding from there, otherwise, fail.

est31 commented 3 years ago

Doors are the same problem really. You can pass them in some directions but in some you can't. You also can't just special case the opened door because an opened door makes some directions unpassable...

Then there is the issue of slabs on the floor plus slabs on the ceiling... depending on the height of the character this might make it impossible for them to pass... Or not! Or turned slabs right and left that leave a space of a full node inside (but the node boundary is right at the middle of the space, each side contributing a half node of space). You can walk there just fine.

There are solutions for this computational problem: mesh based pathfinders instead of node based ones.

That's why I said that introducing nodeboxes makes the problem so much harder :).

nininik0 commented 2 months ago

The pathfinder seems to consider any node that is at least has a collision that could be walked on even if it is tiny it is still considered a solid one.