AndyStobirski/RogueLike

FOV leakage from between diagonal tiles

Opened this issue · 2 comments

Hi and thanks for sharing your shadowcasting implementation! I overall like its results better than other routines I've tried, but it has this funky feature that the visibility "leaks" from in between diagonal tiles. The previous routine I had in my current project also saw through diagonal corners, but it did it in a more natural way so that it had the more realistic outward widening sector. Your routine for some reason draws a one tile wide infinite "streak".

Basically I can get around this by just not having diagonal corners like this :-P But optimally, it would be great if the routine did not see through diagonal corners at all... I'm just wondering if you would have an easy solution to tweak it this way?

Attached a screenshot to illustrate. I also tweaked your routine a bit for my use so that you also see the tiles (the walls) that block your vision.

Thanks!
Leakage

Hi there and thanks for the message. It's been a while since I looked at this code to be honest.

Seeing through diagonal corners is intended behaviour due to how the rays emanate from the observer. I suppose if one where to check diagonal rays as they are emitted and look for the presence of two filled cells and stop building the ray at that point. The position of the filled cells would obviously vary depending upon the direction of the emitted ray.

That's all I've got at the moment, but I'll revisit this when I have more time.

Hey, thanks for the reply! Yeah... guess I'll dig into it and see if there's an easy (enough) tweak/hack I can figure out.

When it's close to 45 degrees, it's actually not so bad. Especially if instead of these square wall block graphics I have trees or similar objects that make more sense standing alone or diagonally and are not exactly square shaped. (So there's a visual gap in between the tile graphics.)

I guess the worst case is when the view angle gets close to 90 degrees. Seeing a monster at "X" feels a bit weird, for example. Buuut yeah, it's not a show stopper :-)

Leakage2