william15 Posted July 22, 2008 Share Posted July 22, 2008 I am coding a browser based 2d tile military combat engine. I need to implement a way to do Line of Sight (If you can see the enemy over the hills and terrain). After a ton of searching I found Bresenham's Algorithm. I would use it to find the coordinates of the tiles in the line between the units, and then use a 2 dimensional array to see if that tile blocks LOS. I only have one problem, since it is used to draw lines, I can only find implementations of the necessary code in C etc, but not in PHP, any help/links you can give me would be much appreciated. Link to comment https://forums.phpfreaks.com/topic/116083-bresenhams-line-drawing-algorithm/ Share on other sites More sharing options...
john-formby Posted July 22, 2008 Share Posted July 22, 2008 Have a look at: http://uk.php.net/imagesetpixel Link to comment https://forums.phpfreaks.com/topic/116083-bresenhams-line-drawing-algorithm/#findComment-596899 Share on other sites More sharing options...
william15 Posted July 22, 2008 Author Share Posted July 22, 2008 thankyou, but that is not what I was asking for : ) I just need to find a link where Bresenham's algorithm is implemented in PHP Link to comment https://forums.phpfreaks.com/topic/116083-bresenhams-line-drawing-algorithm/#findComment-596939 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.