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?


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

Various gridbased lighting algorithms traditionally used by roguelikes: http://roguebasin.roguelikedevelopment.org/index.php?title=Category:LOS http://roguebasin.roguelikedevelopment.org/index.php?title=Field_of_Vision

A solution I developed to support partial occlusion of grid cells: http://blog.pixelpracht.net/?p=340

Rather complicated pixel-perfect approach that calculates the Field of View as a Polygon: http://www.redblobgames.com/articles/visibility/

A game I wrote a while ago using a similar math based approach: http://runehunt.pixelpracht.net/

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. http://forums.tigsource.com/index.php?topic=8803.0

  • 1
    \$\begingroup\$ Byte56 is right we should include answers in the posts for future readers but that is the reading i need thank you lithander. \$\endgroup\$
    – LoveofSnow
    Oct 23 '12 at 18:08


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

  • 5
    \$\begingroup\$ 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. \$\endgroup\$
    – House
    Oct 23 '12 at 16:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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