Sign up ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have been trying to implement a simple form of lighting in my 2D game. In the screenshot, I don't think it looks very good, kind of just plastered over the top of the map. How would the wall effect how the lighting is displayed?

Just looking for tips on how to make my lighting look a bit better. Right now I gave each tile a light value and I change that depending on if there is a light source near by. I don't take in account if there are any objects near by.

Screenshot: enter image description here

share|improve this question

2 Answers 2

up vote 4 down vote accepted

Based on your sample image, I would say that you have to imagine the wall stopping the light. So on the tile for the wall, it would be lit, but past it (moving away from the light source) the light would not continue. In your example, the top tile of the emitted light (2 squares up from the source) would be dark but the wall tiles would stay the same.

Now, that said, if you have different layers, you may want light from a higher layer to transfer down a wall to a lower layer. But that depends on what you want and what looks good.

I guess the idea is, imagine yourself in that room, with that light source. What would happen when the light hit the wall? It would stop at the wall, right? Also, if you want to go wider with the emitted light, try and imagine the shadow it would cast as it passed the right and left edges of the wall. It would go off on an angle from there so maybe on the tiles that it crosses, you'd have partially lit tiles there.

Something you may also want to consider, if you haven't already, is that if emitted light overlaps, you may want it to get brighter. In that case, you'd want the light effect to be additive (i.e. the "light value" for a tile from one light source is ADDed to the "light value" on the same tile from the other light sources).

share|improve this answer
Thank you for your quick and thorough answer. Just what I was looking for! –  Milkboat Nov 28 '11 at 17:31
@Milkboat Glad I could help. :) –  Richard Marskell - Drackir Nov 28 '11 at 17:35

I quite realize that are asking how walls effect 2d lighting, and not what can I use to do simulate the effect, but I must insert my shameless plug here.

Another developer and I have created a very fast 2d lighting engine in XNA, using similar techniques to Orangy Tang (back in the day from and Catalina Zima. The Codeplex site has links to these articles, explaining how to do 2D lighting with vector based graphics. You can find the source, binaries, and the links to the articles at

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.