Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Sight is broken on a map imported from v1.10.4 #3521

Closed
fw opened this issue Aug 5, 2022 · 3 comments
Closed

[Bug]: Sight is broken on a map imported from v1.10.4 #3521

fw opened this issue Aug 5, 2022 · 3 comments
Assignees
Labels
bug tested This issue has been QA tested by someone other than the developer.

Comments

@fw
Copy link

fw commented Aug 5, 2022

Describe the Bug

On a map containing VBL, imported from v1.10.4, the token's sight produce a strange and complex shape.
Alternatively, On a map imported from v.11.4, a strange sight shape is not produced.

To Reproduce

  1. Open the attached campaign file.
  2. Select the map named "a. made at v1.10.4".
  3. Sight produced by the "Hero" token will be a strange shape.

Sample campaign file: sight-is-broken.zip

-- or --

  1. Create a map with VBL on MapTool v1.10.4
  2. Export the map.
  3. Import the map on MapTool v1.12.0-alpha.1

Expected Behaviour

Show the token's sight correctly.

Screenshots

strange-sight-shape

MapTool Info

MapTool 1.12.0-alpha.1

Desktop

Windows 10 Pro 64bit

Additional Context

The map "b. made at v1.11.4" in the attached campaign file, the sight shape shows correctly.
On the map named "c. dungeon" and "d. shop", when changing the token's face, the sight shape will be transformed.

I think the problem is related to introducing "Topology" features (adding Pit and Hill).

I made these test maps (a and b) with v1.10.4 and v1.11.4 only. Other versions are not tested.
The maps c and d, those are taken from the campaign file that I run, and created version is not clear, but probably any v1.10.x.

All maps contain VBL only and do not have any map images.

@fw fw added the bug label Aug 5, 2022
@kwvanderlinde
Copy link
Collaborator

This is certainly due to the change of vision blocking algorithm I introduced in 1.12. Looks like a point is being projected the wrong direction for some reason. I'll investigate.

@kwvanderlinde kwvanderlinde self-assigned this Aug 6, 2022
@kwvanderlinde
Copy link
Collaborator

This seems to come down to a precision issue. E.g., on the map d. shop there are many points that lie extremely close to one another, such as two adjacent points whose y coordinates are identical and whose x coordinates are 1316.0 and 1316.0000000000002. Such small distances don't make for good calculations, and our vision blocking algorithm is particularly sensitive to such things. Previous versions may have hidden this because they used lesser precision when processing the VBL and also used a different approach to vision blocking.

Taking the bug report at face value, there must be some subtle difference in the VBL-drawing code between 1.10.4 and 1.11.4 such that 1.10.4 produces these tiny artifacts. I'm not aware of such a change, though I didn't go digging too deeply because there is a good way to handle this type of problem going forward.

The points we use for vision blocking are represented as JTS Coordinates, and JTS provides an easy way via a PrecisionModel to snap these to a grid with whatever precision we want. If we do that, points with such small differences will be treated as the same point, and so little artifacts like in this bug report won't make a difference.

@Phergus Phergus added the tested This issue has been QA tested by someone other than the developer. label Aug 7, 2022
@Phergus
Copy link
Contributor

Phergus commented Aug 7, 2022

Tested. Working as expected now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug tested This issue has been QA tested by someone other than the developer.
Projects
None yet
Development

No branches or pull requests

3 participants