As you may know, LambdaRogue has no LOS. Now, I finally sucessfully
implemented a LOS algorithm in LambdaRogue. I used this one:
http://roguebasin.roguelikedevelopment.org/index.php?title=Simple_Line_of_Sight
It works rather good, although I did not test if it produces artifacts
or similar things.
Do any games use this algorithm? (So far it's the only one easy enough
for my intellectual caps).
Mario
its just an unoptimised breshenham algo
-stu
As mentioned on the KharneBlog, I've just implemented the Improved
Recursive Shadowcasting one @ Roguebasin into Kharne. I previously
used the Breshenham one, but it has certain artifacts at certain
distances (odd-numbered light radii, IIRC) which make it look
horrible.
I can send you the code of my implmentation of the IRS algorithm and
how I use it (along with the solution to some gotchas I encountered)
if you want. It's in Delphi so it will be pretty much cut and paste
into FreePascal if you do decide to put it in.
Best,
P.
> As mentioned on the KharneBlog, I've just implemented the Improved
> Recursive Shadowcasting one @ Roguebasin into Kharne. I previously
> used the Breshenham one, but it has certain artifacts at certain
> distances (odd-numbered light radii, IIRC) which make it look
> horrible.
I don't have a real light source. Light in my game only determines how
much of an undiscovered map is flagged as "known" at once. If the whole
map is discovered, light has no effect, and so I don't see any artifacts
for now.
> I can send you the code of my implmentation of the IRS algorithm and
> how I use it (along with the solution to some gotchas I encountered)
> if you want. It's in Delphi so it will be pretty much cut and paste
> into FreePascal if you do decide to put it in.
Yeah, you mentioned that and I sent you a mail to the address you use
for your r.g.r.d.-postings.
Mario
>> Do any games use this algorithm? (So far it's the only one easy enough
>> for my intellectual caps).
>>
>> Mario
>
> its just an unoptimised breshenham algo
And this means what for practical purposes ...?
*Noddles* Kharne operates in a similar fashion, although I use a layer
which contains "Currently Visible" and "Previously Visible" values
(and will probably implement a "Always visible" values soon).
>
> > I can send you the code of my implmentation of the IRS algorithm and
> > how I use it (along with the solution to some gotchas I encountered)
> > if you want. It's in Delphi so it will be pretty much cut and paste
> > into FreePascal if you do decide to put it in.
>
> Yeah, you mentioned that and I sent you a mail to the address you use
> for your r.g.r.d.-postings.
>
> Mario
Arsebiscuits, I don't check that email address regularily (its more of
a spamtrap, tbh). Apologies, Mario.
*reads your email*
Aha, you store things similar to how I do it.
I'll send you commented code this evening (and probably post the
gotchas to Roguebasin as well)
Best,
P.
As someone pointed out, it is basically a Bresengham algorithm, and most
roguelikes use something of the kind. You could use it on all squares
to make an inefficient but simple FOV algorithm, too.
- Gerry Quinn
--
Lair of the Demon Ape (a coffee-break roguelike)
<http://indigo.ie/~gerryq/lair/lair.htm>
for all practical purposes does it matter if nobody implements it
or if everyone implements it? If you like the end result do
you care what others think?
For all practical purposes it is a really simple routine
for line drawing that you can pretty much do anything
you want with? A lot of people use BL for a lot of
things, LOS being one of them.
-stu
> As mentioned on the KharneBlog, I've just implemented the Improved
> Recursive Shadowcasting one @ Roguebasin into Kharne. I previously
> used the Breshenham one, but it has certain artifacts at certain
> distances (odd-numbered light radii, IIRC) which make it look
> horrible.
I saw your screencaps on the blog, and I think its more
to do with your implementation than breshenhams line algo itself.
Most people use it without artifacts like you have in
the screenshots. If a real basic algo like BL is giving you
problems, I would first blame the implementation than
the algo itself.
I'm assuming? delphi uses pascal calling convention? If it
uses C calling conventions, have you tried libfov?
-stu
The artifacts in a Bresenham raycasting field of view can be easily
fixed by making a small change to the circle algorithm used.
Usually a Bresenham circle algorithm looks something like this:
initialize variables
loop until one octant of the circle done
shoot rays to the eight octants of the circle using x and y
increase x
adjust delta
if delta past certain limit
adjust delta
increase y
end if
end loop
The problem with that is the fact that when both x and y are increased
during a single execution of the loop, some of the required rays are not
shot. That's why you should also shoot rays inside the if, just before
you increase the y. Ie. the if should look like this:
if delta past certain limit
shoot rays to the eight octants of the circle using x and y
adjust delta
increase y
end if
(My pseudocode is not very good, so hopefully you can understand it :)
Of course this still doesn't fix some of the other problems with a
Bresenham raycasting field of view, but it looks quite good with small
radii.
Hope this helps,
Joni.
Apologies for the slight whiff of thread necromancy....
> I saw your screencaps on the blog, and I think its more
> to do with your implementation than breshenhams line algo itself.
>
> Most people use it without artifacts like you have in
> the screenshots. If a real basic algo like BL is giving you
> problems, I would first blame the implementation than
> the algo itself.
>
Almost certainly. The old implementation was a bit hideous, to be
frank (its amazing what 6 years of hindsight brings to you when you're
looking at old code).
I ripped that out, and now use the Improved Recursive Shadowcasting
from Roguebasin, modified to use standard Cartestian Coordinates (i.e.
the origin at the bottom left), and it works a treat.
> I'm assuming?delphiuses pascal calling convention? If it
> uses C calling conventions, have you tried libfov?
>
> -stu
Delphi uses Pascal Convention, yes, from left to right.
Best,
P.