These are 2 of the best resources you can find... http://www-cs-students.stanford.edu/~amitp/gameprog.html and http://www.gameai.com/ai.html > > I'm doing work to make the viewable map a larger size (max size > settable by > config.h setting). > > The little difficulty I'm running into is the line of sight code. > > If you look at the common/los.c file, near the top you will > notice a whole > bunch of set_block calls - I'll copy a few below: > > set_block(5,4,4,3); > set_block(5,4,5,3); > set_block(5,4,6,3); > set_block(4,3,4,2); > > This is all 'hard coded' for an 11x11 map. Presume the player > is at 5,5 (as > would be the case for an 11x11 map). > > The first line basically says that if there is something at 5,4 > that blocks the > view, you can't see 4,3 (first line), 5,3 (second line), and 6,3. > > The next line then says that if something blocks view at 4,3 > that you can't see > 4,2. > > And so on. This creates a whole set of relations - so if 5,4 is > blocked, you > can pretty quickly figure out all the other spaces that get blocked by > traversing the structures set up. > > As evidenced in the current code, this works just fine for the 11x11 map. > > Ideally, I would like a more general solution. I certainly > don't want to have > a hard code in place for a 25x25 map (which would be hundreds of lines). > > I did a quick web search for a better LOS method, but didn't > find one. Most of > them are presuming the simpler cases (have point A and point B - > does anything > prevent them from seeing each other). > > I'm thinking of using something like that to initialize the > tables in a brute > force fashion - this table is only initialized at startup, so > something all that > efficient to initialize the table is not all that important. On > a 25x25 map, > there are 625 spaces. Worst case here is also that there could > still be a few > hard coded entries to fix up gaps or the like. > > But before I do that approach, just wanted to see if anyone had some more > clever solution. > _______________________________________________ > crossfire-devel mailing list > crossfire-devel at lists.real-time.com > https://mailman.real-time.com/mailman/listinfo/crossfire-devel >