Guys,
I posted this on another web site forum but always like a cross section of views. I appreciate some of you may groan when I raise this old chestnut but hopefully someone has the time to post a few ideas.
I have a visual basic 2D tile based engine (using Dx8.1 D3D) and have recently added a line of sight algorithim so that some of the tiles are not shown if the view is blocked.
I currently use a simple 360 degree ray trace algorithim where by I step out from the center at a specified angle plotting tiles until the ray hits a tile that is a wall. Having hit a wall tile I increase the angle and start again.
Unfortunately even with a single degree increment I still occasionally fail to scan all tiles. I.e. a few are missed out as the ray trace simply doesn't quite hit them all.
So as opposed to reduce the angle increment to .5 and then require 720 angle iterations I wanted to explore some other techniques. I've scanned the web but alas cant really find any working examples of other techniques.
If some one could please offer some advice or point me to the other techniques I'd be greatful. Of course I need it to be as fast as possible but more importantly it mustn't miss any tiles?
Thanks in advance, look forward to the ideas
: )
edit=typos
I posted this on another web site forum but always like a cross section of views. I appreciate some of you may groan when I raise this old chestnut but hopefully someone has the time to post a few ideas.
I have a visual basic 2D tile based engine (using Dx8.1 D3D) and have recently added a line of sight algorithim so that some of the tiles are not shown if the view is blocked.
I currently use a simple 360 degree ray trace algorithim where by I step out from the center at a specified angle plotting tiles until the ray hits a tile that is a wall. Having hit a wall tile I increase the angle and start again.
Unfortunately even with a single degree increment I still occasionally fail to scan all tiles. I.e. a few are missed out as the ray trace simply doesn't quite hit them all.
So as opposed to reduce the angle increment to .5 and then require 720 angle iterations I wanted to explore some other techniques. I've scanned the web but alas cant really find any working examples of other techniques.
If some one could please offer some advice or point me to the other techniques I'd be greatful. Of course I need it to be as fast as possible but more importantly it mustn't miss any tiles?
Thanks in advance, look forward to the ideas
: )
edit=typos