Effecient finding of long-range spotting targets

Posted by nihohit on Game Development See other posts from Game Development or by nihohit
Published on 2013-07-07T22:49:51Z Indexed on 2013/11/05 10:15 UTC
Read the original article Hit count: 208

Filed under:
|

I'm creating a top-down 2d strategy game, with a square grid map. So far, I've used Bresenham's line drawing algorithm in a circle to determine what's in LOS of each unit, and then targedt one of the targets in the circle. Now I find that this limits my units to shoot only at targets that they see. I want to extend my targeting algorithm to target any other unit in range of my weapon, even if they're out of sight range of this given unit, if they're "spotted" by another friendly unit. In other words, I want to enable usage of weapons with ranges longer than sight range. Is there a better way than iterating over all sighted units and computing range and LOSto each of them?

© Game Development or respective owner

Related posts about 2d

Related posts about line-of-sight