Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Thanks!  I've been messing with it for a while now.  I'm not going to dig into it tonight, but should be doing some coding Friday (if not sooner) I'll throw actual code up when I open it up again.

Not sure what you're coding in, but I'm using Unity, which helps a bit.  

On each Tile gameobject I have a SpriteRenderer and a custom class called Tile.

What that lets me do is figure out "OK, I want the torch to have a range of 3.  So all the tiles in the next square have an alpha channel value of their illumination * (distance from source)/3.   When I get more than source +/- range away I stop updating illumination values.   Initially, I set Illumination to a base of 1, but have been putting it at 1.25 because it looks better.

Now before I would then do a second pass on "Is this tile blocked from a nearby tile?" if so set alpha on the sprite to zero, otherwise set it to the illumination value stored in the Tile.   Circling out from the player object, but I'm going to start doing that as part of the alpha value pass so that I can set illumination targets other than the player and still have line of sight blocking objects block their light.  

The map controller would also have a base illumination value added to any tile in view.  So if you're outside, I could set it high, and dial it down towards evening, or in a dungeon just turn it off (as I did in the demo).

The upshot of all this is I don't have to create multiple sprites, or anything for different light values and I can basically have as many different shades as a c# float from 0 to 1.0 will give me.  Which is a lot.  Right now it only happens on my movement, but if I get ambitious, I may add a torch flicker for some extra style.

I may go back later and add a shader to the sprites that lets me kind of pixelate them out as well as shade them.  I think that will give more of that old school feel.  Eventually anyway.  Right now I'm so eager to be done with lighting and move on to ANYTHING else....