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.


Anonymous said...

The new LOS code looks flawless; good pick.

As an aside, I noticed the mixture of graphics along the right despite text-mode emulation. I have come to dislike this as it breaks the oldschool feeling. It's one thing to use graphics *or* text, but to mix them feels inconsistent, wrong even.

Dave said...

That's an interesting point. I'm still in two minds about the layout of the interface. I'm quite satisfied with the icons along the top, but I'm pondering reducing the information window in size - maybe even removing it altogether and putting the important information (HP/MP/AR/EV etc) in a text bar somewhere.

vdweller said...

I'd like to ask a question about your implementation of this FOV algorithm. On some spots, where only a single obstruction is found, do you get behavior like this?

As you can see in the image, the "shadow line" on some specific places behind a single obstruction is not consistent. If it occured to you as well, have you found any workarounds for this or you have left it as it is?

Dave said...

sorry for the late reply, if you're reading this after all these months, then you deserve a prize!

Alas, the FOV radius I've chosen isn't big enough for artifacts such as this to come into play, though I will have to test this out on a radius equal to yours.