Hi Guys,
Even though I'm a gamer and a game developer I have to admit I never developed (or even played) a rogue like game. I'm here cause I'm trying to implement the x-com gameplay and for this I need to implement fog of war / field of view.
My researches lead me to this article (
http://www.robotacid.com/flash/red_rogue/shadow_casting/fov.pdf), that lead me to Roguebasin, that finally lead me here.
My first problem is that the link for the algorithm called DIAMOND (
http://www.geocities.com/temerra/los_rays.html) is broken and I just can't find it, so I have no idea about how to implement it. It has another name? Were can I find an article about it?
I guess it's Ray Casting (
http://roguebasin.roguelikedevelopment.org/index.php/Ray_casting) but I'm not sure.
My second problem is that each algorithm has his flaws, and (for my case, at least) that flaws are unacceptable. After a fast look I realized that a logic AND between the SHADOW and DIAMOND (the tile is visible if it's considered unblocked by both algorithms) would result in a better result.
The easiest way to imagine the result is to "sum" both shadows.
Let's take a look in each case:
Adjacent to the pillar behavior: Just like SHADOW, a nice V shaped shadow.
Away form the pillar behavior: The sum of the algorithms create a nice V shaped shadow. Better than any of the algorithms alone.
Corner peeking: Not allowed, just like SHADOW.
Inverted corner peeking: Not allowed, just like DIAMOND, making the corner peeking symmetric.
Diagonal Wall: Blocks view, like DIAMOND. What is the expected result for me, cause I allow diagonal movement but only when the 3 tiles involved are unblocked.
Symmetry: As long it's not implemented yet, I did not calculate the symmetry, but at least in the corner peeking special case it's symmetric.
Performance: My idea is to call SHADOW, and cast the rays (DIAMOND) only for the tiles considered visible. On the worst case it would roughly be the sum of the cost of both algorithms, what is in most of cases it's still faster than DIGITAL.
I would like to hear opinions about that.