shadow casting

Alternative content

Get Adobe Flash player

I recently found out my lighting system for my roguelike project was flawed. I looked up various field of view methods used by roguelikes. In this paper I found an excellent review of all the major field of view algorithms used in roguelikes. I chose Shadow Casting as it appeared the fastest and would be the easiest to implement and adapt. On the Rogue Basin site I found a Python implementation of the algorithm. I ported this code to AS3 and the above SWF is a demo of the unoptimised, unmodified code. I'm not especially impressed with the way the algorithm handles diagonal gaps or single tiles, but I think in all other areas it performs excellently and there is a great opportunity for optimisation.

source code