sarkahn / dots-roguelike

A "traditional" ascii roguelike built using Unity's ECS/DOTS framework.
Other
164 stars 14 forks source link

FOV system sometimes goes through walls #2

Closed aymericfraise closed 3 years ago

aymericfraise commented 4 years ago

I'm on part 1.5 of the tutorial, and i noticed that sometimes the fov system sometimes shows tiles that aren't supposed to be seen. Here's a configuration where it happens : Capture And on the full map you can see a lot of places where it happened : Capture2

I'm on RLTK 0.2.9 and Unity 2019.3.2f1.

Thanks for the tutorial and for the package btw, they're great 👍

sarkahn commented 4 years ago

Hey, thanks for bringing this up! I did notice this but have put it on the backburner for now since it seems like it only affects walls and never lets you see an non-wall tile. It's 100% incorrect behaviour though so definitely needs to be fixed at some point.

I'm just working on pathfinding right now so it may be a while until I get to this. The culprit causing it is this algorithm from RLTK, which is just my implementation of this algorthim created by Adam Milazzo. I will get to it at some point but if anyone wants to take a look and see where I messed up my implementation, feel free!

AdamMil commented 4 years ago

While I haven't verified the whole thing, try changing "return true" to "return false" on line 135.

if (BlocksLight(x + 1, y + 1, octant, origin, map))
    nx++;
if (bottom.GreaterOrEqual(ny, nx))
    return true;
top = new Slope(ny, nx);
sarkahn commented 3 years ago

Sorry I left this for so long. You were correct though, that seems to have fixed the issue!