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
"Field-Of-View Arc" in 2D
Started by bjoerng, Jul 23 2012 12:04 AM
1 reply to this topic
Sponsor:
#2 Members - Reputation: 4605
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.
Ashaman
My game: Gnoblins
Developer journal about Gnoblins
Small goodies: Simple alpha transparency in deferred shader
My game: Gnoblins
Developer journal about Gnoblins
Small goodies: Simple alpha transparency in deferred shader






