View Single Post
Old June 19, 2009, 16:17   #21
jv123
Scout
 
Join Date: May 2009
Posts: 37
jv123 is on a distinguished road
I think it's clear that a new system for line-of-sight is needed, and this excellent new proposal has some very good features. But I don't think it's quite right yet: surely we don't want to give up the intuitively-familiar idea that you can hide behind a single pillar.

Here's a refinement of PowerDiver's suggestion which solves this problem. Suppose that monsters (and the character, and items) aren't thought of as 'filling' their entire square, but instead are located in a smaller square area inside it. So it the entire square is located with x- and y-coordinates between 0 and 1, then we can imagine a monster (and the character, and items) only occupying the space between 0.25 and 0.75 on each axis. Isolated walls would work the same way. Continuous blocks of wall would only work this way around their edges.

To test if the @ can see a monster, you just test to see if there are any lines that can pass from any point in the @'s area, to any point in the monster's area, without passing through an area occupied by a wall. This test is obviously symmetrical. There is a non--floating point algorithm that can perform this check.

This is slightly more complicated than the original suggestion, but still intuitive. It maintains all of the good aspects, but behaves better in terms of single isolated wall elements. Let me know what you all think!
jv123 is offline   Reply With Quote