### Author Topic: How to apply lighting to this FOV routine?  (Read 1157 times)

#### Krice

• Troll
• Protector of the @
• Posts: 2149
##### How to apply lighting to this FOV routine?
« on: August 22, 2017, 07:25:56 AM »
http://www.roguebasin.com/index.php?title=LOS_using_strict_definition

So I'd like to use lighting with this routine which seems to be quite nice. My lighting values are from 8 to 0 (dark). I have some kind of idea about distance and light value, but this routine is kind of strange and I'm having difficulties to figure out exactly how.

The closest I got was getting a distance from my Coords class like this: (oc = origin coordinates)
Code: [Select]
`   while (next.x != x1 || next.y != y1)    { int d=oc.Get_Distance(next); v=8-d; if (v<0) v=0;...`
But with this the light source is rectangular in shape.
« Last Edit: August 22, 2017, 09:39:45 AM by Krice »

#### Krice

• Troll
• Protector of the @
• Posts: 2149
##### Re: How to apply lighting to this FOV routine?
« Reply #1 on: August 22, 2017, 05:17:23 PM »
Well there is one solution and it's a "manual" array of data for the light intensity. It's bit more tedious way, but with that you can simply forget math, because you don't need it. You need only FOV part which in this case is already there. Then create light data for each radius size (shape of the light with intensity values from 0-8). There aren't that many of them so it's doable.

#### Tzan

• Bishop
• Posts: 156
##### Re: How to apply lighting to this FOV routine?
« Reply #2 on: August 22, 2017, 10:37:14 PM »
I do that too when its not a big area.

#### Krice

• Troll
• Protector of the @
• Posts: 2149
##### Re: How to apply lighting to this FOV routine?
« Reply #3 on: August 26, 2017, 11:24:28 AM »
Somehow I can't match the size of lighting data to the area of FOV in this routine. It looks like radius 5 is not 7x7 tiles (visible area) but 11x11, but it still wont match.