Line of view in a 2d maze (RPG)

Started by
2 comments, last by Zakwayda 15 years, 4 months ago
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 ?
- Iliak -
[ ArcEngine: An open source .Net gaming framework ]
[ Dungeon Eye: An open source remake of Eye of the Beholder II ]
Advertisement
Quote:Original post by iliak
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 ?
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 ?
- Iliak -
[ ArcEngine: An open source .Net gaming framework ]
[ Dungeon Eye: An open source remake of Eye of the Beholder II ]
Quote:Original post by iliak
Is DDA this ?
It may be (I didn't look too closely), but try this.

This topic is closed to new replies.

Advertisement