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

Sight multipliers do not increase the size of grid shaped lights correctly. #2508

Open
Ahnoold opened this issue Mar 30, 2021 · 2 comments
Open
Labels

Comments

@Ahnoold
Copy link

Ahnoold commented Mar 30, 2021

Describe the bug
When a sight type that has a multiplier as part of its definition interacts with a light source that is defined to be grid shaped, the resulting light radius is not multiplied correctly.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new map with a square grid.
  2. Set "Distance per cell" to 5.
  3. Set the map's vision to "Night"
  4. In "Campaign Properties", define a light source to be grid shaped with a radius of 5.
  5. Define a sight type to be either circle or grid shaped with a x10 multiplier.
  6. Place a token on the map.
  7. Make the token Medium size.
  8. Give the token the vision type defined in Step 5 above.
  9. Give the token the light source defined in Step 4 above.

Expected behavior
The light source would have an adjusted radius of 52.5 units, covering to the far edge of the 10th square away from the token.

Actual behavior
The light source has an adjusted radius of 75 units, covering to the middle of the 15th square away from the token.

Screenshots
image

MapTool Info

  • Version: 1.8.4
  • Install: Upgrade from 1.8.3 (same behavior observed in 1.8.3)

Desktop (please complete the following information):

  • OS: Windows
  • Version: 10 Pro, 20H2

Additional context
It appears that to make the grid shaped light source conform to the grid, its radius (5 in the above example) is increased by half the distance per cell (5/2 = 2.5). (The adjusted radius becomes 5 + 2.5 = 7.5). When a vision with a multiplier is applied, the adjusted radius is multiplied by the vision's multiplier (10 * 7.5 = 75). Instead, the original radius should be multiplied, and then the adjustment reapplied ( (10 * 5) + 2.5 = 52.5).

@Ahnoold Ahnoold added the bug label Mar 30, 2021
@Ahnoold
Copy link
Author

Ahnoold commented Jan 4, 2023

Still present in 1.12.2. Upon further observation, the shape of the expanded light is also incorrect after the vision multiplier is applied. In the above example, the area covered by the light remains square shaped when the vision multiplier is applied, although it should actually be a different shape at the expanded size. It appears to me (total guess here without looking at any of the actual code) that the algorithm that adapts the light source to the shape of the grid is applied before the algorithm that increases the radius of the light for the vision multiplier, and that the order of these two operations needs to be swapped.

Another idea that has occurred to me - what if adapting the light to the grid were handled differently than making "grid" a shape option in the light definition? Then it could be combined with other shapes as well. For example, a cone shape light could become grid shaped as well.

@kwvanderlinde
Copy link
Collaborator

This should be fixed after #4803 where we do exactly as suggested above: we increase the radius first, then figure out the corresponding grid shape.

Looks like this now:
fixed-grid-scale

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Merged
Development

No branches or pull requests

2 participants