foundryvtt-drag-ruler icon indicating copy to clipboard operation
foundryvtt-drag-ruler copied to clipboard

Pathfinding through the fog

Open dmrickey opened this issue 3 years ago • 8 comments

image Players can drag their movement around to get an idea of what the layout is under the fog of war. Is there any way to mitigate this? (left is GM view, right is player view)

dmrickey avatar Feb 04 '22 03:02 dmrickey

There is currently none. This is the main reason why the GM has to enable pathfinding before the players can use it

manuelVo avatar Feb 04 '22 08:02 manuelVo

No worries, the benefit far outweighs the downside.

The sight layer (unique to each client) has a method to test visibility (canvas.sight.testVisibility({ x, y })). Unfortunately I'm not seeing a same thing for something like "test has been revealed". The sight layer has the pixi container for the revealed areas so it probably wouldn't be too hard to make a method that checks that. It would be a lot simpler than the testVisibility method because that has a lot of extra stuff that relies on, well, that relies on things actually being visible

dmrickey avatar Feb 04 '22 19:02 dmrickey

The fog exploration is stored as a bitmap, which means that there are quite a few pixels to check per grid cell, which could easily become a performance issue. That's my main concern with implementing such a feature

manuelVo avatar Feb 04 '22 19:02 manuelVo

I think testing 3 pixels per square should be good enough (middle pixel, as well as the two pixels on the corner/edge where the token is passing through).

Merudo avatar Feb 04 '22 19:02 Merudo

https://github.com/dwonderley/lib-find-the-path/ offers a "configuration to enable non-omniscient path planning", which sounds like it may give some hints about not planing paths within fog?

Weissrolf avatar Mar 03 '22 19:03 Weissrolf

I might be wrong, but it seems to me that the only thing "non-omniscent path planning" offers is the ability to prevent pathfinding through ethereal walls.

manuelVo avatar Mar 03 '22 19:03 manuelVo

Hard to say with the wording. Since both sentences start with "Added", it seems to be two separate things, but I could be wrong.

Weissrolf avatar Mar 03 '22 19:03 Weissrolf

that library probably doesn't have that feature, but, I agree that this should be not too difficult to implement - the one obstacle is how exactly to get the fog pixel at a specific position.

shemetz avatar May 29 '22 17:05 shemetz