Friday, 2 May 2008

Oh what a lovely view we've got...

FOV Algorithms. Fun, aren't they?

Here's an example of the current Kharne FOV algorithm (which was lifted almost entirely from the old code), using tiles for clarity of display:



This has a light radius of 4 tiles (which the light radius of the original Kharne always was. Its...okay. However, last night, I played about with changing the light radius. Here is a radius of 5 tiles:



Whoops. The current FOV system is a crude ray-casting system using variations on Bresenham lines, and it looks atrocious when you change the light-radius. To any light-radius other than 4. I'm eventually going to have to change this. But for now, the light radius stays at 4 and any plans for dynamic light sources be damned.

A quick search of the web revealed many different FOV algorithms. The most promising one appears to be Björn Bergström's Recursive Shadowcasting methods. My C++ is extremely rusty, but there are a couple of FreePascal implementations out there that should^H^H^H^H^H^Hwill be easily portable to Delphi.

Should be a lot of fun when I get round to recoding the FOV.

No comments: