Thursday, 14 November 2019

Lighting issue

I'm working on fov and lighting as you should after 110 years of development. I have a new fov routine, but there is a problem in lighting. When each tile has independent fov and light values it will create a situation where the wall is lit from the opposite side. Imagine there is a lamp in a room and the room's door is closed. You can still see the wall lit when you are outside the room, because the lamp has to lit the "inside" walls of rooms as well. Obviously, the inside and outside walls are the same, since roguelike 2D maps usually have it that way.

I don't recall any games that have gradual lighting and how they solved it, if at all. I guess one way to try is have data for each facing of a wall, but it may get complicated. More so if the light source is on the wall itself, as some kind of wall lamp. Then things get even more complicated, unless you give the light source information about which side of the wall it is.

Whatever the solution, I have to do something about both fov and lighting finally, because in a weird way having both fov and lighting helps in dungeon design, because everything looks very different if you don't have fov on in particular.