Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am writing a rogue-like 'zombie' management game. The game map will be similar to Prison Architect. A top-down 50 X 50 grid.

I want to implemented a day night cycle and during the night I would like the player to be able to position lights.

I would like to be able to lighten and dark to whole map to display the day and night cycle.

Then lights would be a circle of light blocked by game entities such as walls, players, trees etc.

How would I achieve and what is the standard way of achieving this?

share|improve this question
up vote 4 down vote accepted

Sorry for posting a collection of links but your problem has many possible solutions! :)

Various gridbased lighting algorithms traditionally used by roguelikes:

A solution I developed to support partial occlusion of grid cells:

Rather complicated pixel-perfect approach that calculates the Field of View as a Polygon:

A game I wrote a while ago using a similar math based approach:

Projecting each face outwards, kinda what Carmack did in Doom3 but in 2d space. Causes a lot of overdraw which doesn't matter so much if you have access to hardware acceleration.

share|improve this answer
Byte56 is right we should include answers in the posts for future readers but that is the reading i need thank you lithander. – LoveofSnow Oct 23 '12 at 18:08

there is also a link at teh bottom of the comments to an 'improved' version of this

share|improve this answer
Typically, answers with just a link are not very good. If the link were to go down, this answer would be useless. Creating a summary of the process here would make a much better answer. – Byte56 Oct 23 '12 at 16:22

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.