# Line of view in a 2d maze (RPG)

This topic is 3498 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi I'm making a clone of Eye of the Beholder and I'm stuck when I need to detect if the team (the player position ie) can see a given location (or for example, does a monster can see the team). The maze is a simple 2d grid with 1 = wall and 0 = empty place. Team and monsters can't see through walls. My first attempt was to use bresenham algorithm but with this, team virtualy can see in through wall in diagonal. Do you have any suggestion or better idea ?

##### Share on other sites
Quote:
 Original post by iliakHiI'm making a clone of Eye of the Beholder and I'm stuck when I need to detect if the team (the player position ie) can see a given location (or for example, does a monster can see the team). The maze is a simple 2d grid with 1 = wall and 0 = empty place. Team and monsters can't see through walls. My first attempt was to use bresenham algorithm but with this, team virtualy can see in through wall in diagonal.Do you have any suggestion or better idea ?
Try doing a search for '3D-DDA', '3DDDA', '2D-DDA', and '2DDDA'. This algorithm is a pretty good choice for line-of-sight queries.

Another option would be simple SAT-based line-segment vs. axis-aligned-box queries, perhaps with a quadtree- or grid-based broad phase to speed things up.

Is DDA this ?

##### Share on other sites
Quote:
 Original post by iliakIs DDA this ?
It may be (I didn't look too closely), but try this.

1. 1
Rutin
23
2. 2
3. 3
JoeJ
20
4. 4
5. 5

• 29
• 40
• 23
• 13
• 13
• ### Forum Statistics

• Total Topics
631740
• Total Posts
3001959
×