Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

"Field-Of-View Arc" in 2D


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 bjoerng   Members   -  Reputation: 103

Like
0Likes
Like

Posted 23 July 2012 - 12:04 AM

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

Sponsor:

#2 Ashaman73   Members   -  Reputation: 4605

Like
1Likes
Like

Posted 23 July 2012 - 01:04 AM

You could create a 1d shadow map, rendering this would be easy and using it to display your arc would be easy too.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS