destiny said:
If I understand that right LOS make a line between both points and checks every pixel of this line (or every 4th pixel, or whatever u want). If the pixel is in something that blocks then return false, else continue. If u are at the other point the first point can see it.
Yes. In your 2D-grid example, you have the two endpoints, and the line between them (meaning getting the squares that are on the line) is given by Bresenham's algorithm. Once you have those squares, you "walk" the list of squares hit by the line, and if something is in it, you determine if it blocks view or not. (Actually, you visit each square as you get the list, and end early if you hit a block.)
The potential problem with Bresenham's is that it can move diagonally via the vertex, so depending on the requirements of the game, this
may translate into a "view around a corner" issue or other oddity in the game.
One approach to solve that could be to "anti-alias" the line. You'd have to adapt
Xiaolin Wu's algo instead, and you can get more squares to what you'd get with Bresenham's. You'll note in the wikipedia's article that, in the function
plot(x, y, c), the value of c (where 0 ≤ c ≤ 1) could be used as an indicator of levels of partial or variable visibility.
Hyperbole is, like, the absolute best, most wonderful thing ever! However, you'd be an idiot to not think dogmatism is always bad.