caewok / fvtt-token-visibility

Advanced token visibility rules for Foundry VTT
MIT License
4 stars 8 forks source link

Vision points are inside token even when 0 is specified causing situations where tokens can't see things they should #76

Open Zamrod opened 8 months ago

Zamrod commented 8 months ago

This is tested in 0.6.0. The vision works great for the most part but under certain circumstances one token can see another but cannot be seen in return. When there is light of sight to a token, there should always be line of sight back.

Here is an example:

image

image

image

Because the test from the ogre to the smaller token happens inside the token, it collides with the wall right next to it and is therefore considered to be blocked. The elf on the other hand can test to the corner in the middle of the Ogre and therefore sees it.

This is incorrect two ways. The elf should be able to see the bottom left corner of the Ogre, but that is listed as blocked. That's as per this DMG picture: image

Notice how all lines that pass directly through a corner count as visible in both pictures?

The second way it is incorrect is that the Ogre should be able to use the same corner the elf can see it with as the origin point of all of its line of sight, allowing it to see the elf in return since you can use the corner of any square you occupy, not just the outside corners. The corner at the very center of the Ogre should also be able to see the elf if it tested from there.

caewok commented 7 months ago

Under DMG rules, whether or not two tokens will both always share the same line-of-sight result depends, I think, on whether subtargeting is enabled. The DMG rules seem to use it (see DMG picture 1) but it is a bit performance heavy to just turn on by default. (Plus, it is not all that intuitive that "corner" might not mean the actual token corner when subtargeting is on.)

DMG Picture 1

Subtargeting

DMG 1 subtargeting

No subtargeting

DMG 1 no subtargeting

DMG Picture 2

Subtargeting

DMG 2 subtargeting

No subtargeting

DMG 2 no subtargeting

Example of non-parallel line-of-sight

I added a small wall that blocks the ogre's corner, which causes line-of-sight to be blocked for the ogre only, under DMG rules with subtargeting enabled. (Without, the PC vision would also be blocked.)

Subtargeting from ogre Subtargeting to ogre

Issue with corner vision

I opened issue #77 to look more at corners for vision. For example, here you would expect the ogre to have vision, but his corner point is getting blocked.

Corner error

The bigger problem here is that you would probably not expect the ogre to be able to see around the corner. So if the PC was hugging the bottom wall, you would probably expect ogre to not be able to see the PC until the ogre actually rounds the corner. Geometrically, there is no real difference between the two situations, however, so I don't know what I could do about it. If you extend the corner points beyond the ogre token, it would always see around corners. If you shrink the corner points slightly, it will never see around the corner.

Zamrod commented 7 months ago

Under DMG rules, whether or not two tokens will both always share the same line-of-sight result depends, I think, on whether subtargeting is enabled. The DMG rules seem to use it (see DMG picture 1) but it is a bit performance heavy to just turn on by default. (Plus, it is not all that intuitive that "corner" might not mean the actual token corner when subtargeting is on.)

The DMG definition is:

"To determine whether a target has cover against an attack or other effect on a grid, choose a corner of the attacker’s space or the point of origin of an area of effect. Then trace imaginary lines from that corner to every corner of any one square the target occupies."

You always use one of your outside corners no matter how big you are as the origin point for your line of sight. However, you always pick one square occupied by the target and trace to all 4 corners of that square.

I guess this means in really weird situations there might be a line of sight to the corner of one of the middle squares but not to the outside corner, which would allow you to see a large token without it seeing back. However, in 95% of circumstances, since there is a line from the source token to at least one corner of the target's squares, it should be able to trace that same line back.