Jump to content
  • Advertisement
Sign in to follow this  
iliak

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.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!