Showing posts with label FOV. Show all posts
Showing posts with label FOV. Show all posts

Sunday, 18 April 2010

Lighting Enhancements

Something I'd like to introduce in future releases of Kharne (mainly inspired by the visual sexiness of Brogue) is independent light sources. Fortunately Delphi implements the Win2k+ AlphaBlend WinAPI call which would make implementation quite easy (he says confidently).

Saturday, 3 May 2008

Recursive Shadowcasting FOV

Although strictly speaking, I should have left it until a move advanced stage of development, a combined case of insomnia and ever-increasing irritation with the old Field-of-View system (increased by metaphorically washing its dirty laundry in public) means last night/this morning I've implemented Recursive Shadowcasting (which works beautifully for any light radius.) Plugging in Henri Haki's implementation into Delphi (from Free Pascal) was quite simple (it almost compiled without making any changes), although the co-ordinate system he uses is different from mine - I use an origin(0,0) at the bottom left (in Cartesian fashion) whereas he follows the standard VCL/LCL convention and has the origin at the top left. This video shows it in action:



The main interface has changed to what I consider to be a more slicker and less intrusive one. I'll probably change my mind again over these elements time and time again before final release.

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.