Sign in to follow this  
bjoerng

"Field-Of-View Arc" in 2D

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this