Jump to content
  • Advertisement
Sign in to follow this  
bjoerng

"Field-Of-View Arc" in 2D

This topic is 2191 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 developing a 2D game where the enemies have "FOV arcs" like e.g. in Desperados. I.e. an arc is displayed to show where the enemy is currently looking. The arc should intersect with walls and other obstacles correctly, and should test for player characters. Since this is for a mobile game, I'm trying to make do with as few resources as possible. So far, I've thought of doing this with Bresenham's algorithm for lines (emanating from the enemy character, forming a bundle of rays and stopping at obstacles) or with a circle Bresenham (a number of circle segments starting at the enemy character, narrowing the angle at obstacles). Both seem to be wasteful though. The line Bresenham will go over many pixels several times, esp. close to the character, and the circle Bresenham will calculate all points of the full circle even if only a segment is drawn.

Any other ideas? Advice is much appreciated!

Regards
Björn

Share this post


Link to post
Share on other sites
Advertisement
You could create a 1d shadow map, rendering this would be easy and using it to display your arc would be easy too.

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!