Skip to main content
gamedev.net
🔒 Locked

Calculating attack points

Started by Davaris Nov 30, 2001 at 4:55 PM 0 replies 750+ views
Original Post
Davaris
Davaris
Hi guys. I''ve got this problem I''m working on and I''ll try to explain it without a diagram. I''ve got a target creature that I want to attack and there are other creatures in my way. What I want to do is calculate a point that I can path to that gives me line of sight to my target. Heres an idea I''m working on: 1) Create a list of all creatures inside the attack range of the target. 2) Create sectors for each creature. The pointy end of the sector is on the target''s centre point and the fat end points are tangent to the creature''s outer edges. 3) For each sector arm (on each creature), if it intersects another sector (on a different creature) eliminate it. 4) Using the list of remaining arms (vectors) create a list of open sectors. Open sectors have no creatures inside them. 5) Use the list of open sectors to find the closest point you can path to that gives you line of sight to your target. If anyone has a faster method let me know. Mine looks like its going to be very costly.
"I am a pitbull on the pantleg of opportunity."George W. Bush
LilBudyWizer
LilBudyWizer
Rather than considering all possible creatures why not just start with the one between you and the target. So you start with an arc that is blocked. As you move clockwise and counterclockwise around the target other creatures may increase the arc that is blocked. If you can''t get to one of the edges of that arc with a clear line of sight then you have a new problem. View that problem as a new task rather than a need to make this task more elaborate. You have a goal of shooting the target, but you can''t because you don''t have a line of sight. So that gave you a goal of moving into a line of sight, but you can''t for some reason. So now you have a new goal to resolve that problem so that you can move into line of sight.
Keys to success: Ability, ambition and opportunity.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.