Hello all,
I'm creating a roguelike (as are we all I guess), which will have a lot of range combat.
Thing is, I'm trying to create a targeting line / projectile path, which seems pretty simple,
and I'm getting stuck creating one which matches the fov strategies.
The problem is, given a fov algorithm all the points in sight should be target-able. However
if I'm using Bresenham's algorithm, creating a line from a to b might fail due to obstacles,
but the line to c does go through point b.
Any suggestions on how to create such a targeting line.
For example:
The fov code finds B (anc C) from @, but my los does not.
@ . . . . . . . . .
. . . ### B . . C
The reason I'm trying this approach is because I'm fiddling with different fov
strategies and not all of them provide an easy method of los. So my idea is
to give the fov code precedence in deciding if something is target-able, by
how do I extract a nice projectile path out of it.
I have also looked at the digital lines strategy suggested at roguebasin,
but I do not have a good feeling how I should implement that. Any
suggestions on that would also be welcome.
Maybe I'm using a completely wrong approach here, but Im pretty stuck :S.
I am using plain old C, and am fiddling with both libfov and the digital fov
code used in kusumo.
Edit:
What I have now, is I use the los code of the digital fov, check which grid spaces
are touched, and then back-trace to get the targeting line suitable for that fov.
However, knowing that is can be seen, it seems like a lot of code to get the
targeting line...