Skip to main content
Expanded on the explanation.
Source Link
Tim C
  • 645
  • 3
  • 11

This is a partial answer. I can explain the cause of the problem you're seeing, but I don't have any proposal to fix it.

Subsets of valid sightlights are not guaranteed to be valid sightlines

This is, I think, the property that's causing you trouble (and resulting in your asymmetry). I'll illustrate with a diagram.

Consider a line pointing 9 tiles to the right, and 1 square up:

##########
.....xxxxx
@xxxx.....
##########

Now add a wall right before the crossover point. Walking through the supercover algorithm, this line of sight is still valid. decision is exactly 0 at the crossover point (nx = 9, ny = 1, ix = 4, iy = 0), so it will make the diagonal step.

##########
....#xxxxx
@xxxx.....
##########

However, the following, shorter sightline is not valid, despite being a subset of the other sightlight.

##########
....#x....
@xxxx.....
##########

Why does this matter?

These algorithms are symmetric end-to-end. If you can see an endpoint, the endpoint can see you. However, there is no guarantee that every point along that sightline can see you. For example, in the following

##########
....#@...b
a.........
##########

The Supercover algorithm will not allow any sightline from @ to reach a, even though a can see @ through its sightline to b

I believe this is the reason you are seeing the behavior that you are.

Described mathematically, "You can see a space if you can draw a line from the center of your space to the center of another space, which passes through any part of the intervening space." If you take this to the limit as vision range increases, the meaningfulness of the distant target space falls away and the definition becomes result would be, "You can see a space if you can draw a line from the center of your space to any part of the target space"

Because your sight-lines are from the center, but you allow visibility by even the smallest corner, the result will be asymmetric visibility even when using symmetric line-rasterizing algorithms.

This is a partial answer. I can explain the cause of the problem you're seeing, but I don't have any proposal to fix it.

Subsets of valid sightlights are not guaranteed to be valid sightlines

This is, I think, the property that's causing you trouble (and resulting in your asymmetry). I'll illustrate with a diagram.

Consider a line pointing 9 tiles to the right, and 1 square up:

##########
.....xxxxx
@xxxx.....
##########

Now add a wall right before the crossover point. Walking through the supercover algorithm, this line of sight is still valid. decision is exactly 0 at the crossover point (nx = 9, ny = 1, ix = 4, iy = 0), so it will make the diagonal step.

##########
....#xxxxx
@xxxx.....
##########

However, the following, shorter sightline is not valid, despite being a subset of the other sightlight.

##########
....#x....
@xxxx.....
##########

Why does this matter?

These algorithms are symmetric end-to-end. If you can see an endpoint, the endpoint can see you. However, there is no guarantee that every point along that sightline can see you. For example, in the following

##########
....#@...b
a.........
##########

The Supercover algorithm will not allow any sightline from @ to reach a, even though a can see @ through its sightline to b

I believe this is the reason you are seeing the behavior that you are.

This is a partial answer. I can explain the cause of the problem you're seeing, but I don't have any proposal to fix it.

Subsets of valid sightlights are not guaranteed to be valid sightlines

This is, I think, the property that's causing you trouble (and resulting in your asymmetry). I'll illustrate with a diagram.

Consider a line pointing 9 tiles to the right, and 1 square up:

##########
.....xxxxx
@xxxx.....
##########

Now add a wall right before the crossover point. Walking through the supercover algorithm, this line of sight is still valid. decision is exactly 0 at the crossover point (nx = 9, ny = 1, ix = 4, iy = 0), so it will make the diagonal step.

##########
....#xxxxx
@xxxx.....
##########

However, the following, shorter sightline is not valid, despite being a subset of the other sightlight.

##########
....#x....
@xxxx.....
##########

Why does this matter?

These algorithms are symmetric end-to-end. If you can see an endpoint, the endpoint can see you. However, there is no guarantee that every point along that sightline can see you. For example, in the following

##########
....#@...b
a.........
##########

The Supercover algorithm will not allow any sightline from @ to reach a, even though a can see @ through its sightline to b

I believe this is the reason you are seeing the behavior that you are.

Described mathematically, "You can see a space if you can draw a line from the center of your space to the center of another space, which passes through any part of the intervening space." If you take this to the limit as vision range increases, the meaningfulness of the distant target space falls away and the definition becomes result would be, "You can see a space if you can draw a line from the center of your space to any part of the target space"

Because your sight-lines are from the center, but you allow visibility by even the smallest corner, the result will be asymmetric visibility even when using symmetric line-rasterizing algorithms.

Source Link
Tim C
  • 645
  • 3
  • 11

This is a partial answer. I can explain the cause of the problem you're seeing, but I don't have any proposal to fix it.

Subsets of valid sightlights are not guaranteed to be valid sightlines

This is, I think, the property that's causing you trouble (and resulting in your asymmetry). I'll illustrate with a diagram.

Consider a line pointing 9 tiles to the right, and 1 square up:

##########
.....xxxxx
@xxxx.....
##########

Now add a wall right before the crossover point. Walking through the supercover algorithm, this line of sight is still valid. decision is exactly 0 at the crossover point (nx = 9, ny = 1, ix = 4, iy = 0), so it will make the diagonal step.

##########
....#xxxxx
@xxxx.....
##########

However, the following, shorter sightline is not valid, despite being a subset of the other sightlight.

##########
....#x....
@xxxx.....
##########

Why does this matter?

These algorithms are symmetric end-to-end. If you can see an endpoint, the endpoint can see you. However, there is no guarantee that every point along that sightline can see you. For example, in the following

##########
....#@...b
a.........
##########

The Supercover algorithm will not allow any sightline from @ to reach a, even though a can see @ through its sightline to b

I believe this is the reason you are seeing the behavior that you are.