Playaction
05-05-2009, 12:12 AM
I'm working on a small tile based game. My first game project, which actually seems to become playable some day.
On my tile based map there are a number of good guys and a number of bad guys and a number of walls and obstackles. The opponent AI is coming together nicely, but i have major trouble with creating some kind of FOW effect.
I've tried using a line of sight function, which checks 30 points between two points to see if i run into any obstackles along the way. But if i use that to check every tile from every character, i end up with a loop that takes about 4 seconds to complete (20 x 20 map x 5 heroes x 30 points). That just wont work, since it has to recalculate every time one of the good guys move.
Then i tried drawing shapes over every obstackle in a seperate layer, to try some hittest with a straight line vs the obstackle map to make it simpler. But since i found out that can only use bounding boxes on two shapes, that makes it just as complicated as my first approach.
Does this make any sense, and can anyone point me in the right direction? :eek:
On my tile based map there are a number of good guys and a number of bad guys and a number of walls and obstackles. The opponent AI is coming together nicely, but i have major trouble with creating some kind of FOW effect.
I've tried using a line of sight function, which checks 30 points between two points to see if i run into any obstackles along the way. But if i use that to check every tile from every character, i end up with a loop that takes about 4 seconds to complete (20 x 20 map x 5 heroes x 30 points). That just wont work, since it has to recalculate every time one of the good guys move.
Then i tried drawing shapes over every obstackle in a seperate layer, to try some hittest with a straight line vs the obstackle map to make it simpler. But since i found out that can only use bounding boxes on two shapes, that makes it just as complicated as my first approach.
Does this make any sense, and can anyone point me in the right direction? :eek: