Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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

2 Answers 2

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: 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

share|improve this answer
1  
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

http://www.catalinzima.com/2010/07/my-technique-for-the-shader-based-dynamic-2d-shadows/

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

share|improve this answer
3  
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

 
discard

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.