1
Programming / Re: Screenies of LOS :3
« on: February 14, 2013, 02:34:53 AM »
Thanks for the reply, I enjoyed reading it. As for the view distance, I am going to limit it too the width of the viewable screen (which is at the moment MAPSIZE). Once MAPSIZE increases, I will create a new constant called SCREENSIZE or something like that.
Also, the line is drawn from the player outward and the calculations stop when each line hits a wall. The bad thing though, is that at the moment it begins tracing a line from the player to every tile on the map until that "break" happens ...meaning a LOT of tiles are checked more than once -in particular those closest to the player.
For the time being, I am not going to look into efficiency until it starts to have an effect on gameplay.
As for mobs, I figure if the player can see them, then they can see the player. I will develop that further if I ever need the mobs to interact with each other.
I thought I could be clever with my lightsource and make the variable "int n" = 3 for a light radius of 3 ...but that only makes a diamond shape around the character because of the way bresenhams draws lines. I think therefore, I may have to write a completely new function for lamps and the like. Surely it can't be too difficult to write an algorithm that will draw a circle with tiles. If I get it right, I can use it in my mapgen too :3
Also, the line is drawn from the player outward and the calculations stop when each line hits a wall. The bad thing though, is that at the moment it begins tracing a line from the player to every tile on the map until that "break" happens ...meaning a LOT of tiles are checked more than once -in particular those closest to the player.
For the time being, I am not going to look into efficiency until it starts to have an effect on gameplay.
As for mobs, I figure if the player can see them, then they can see the player. I will develop that further if I ever need the mobs to interact with each other.
I thought I could be clever with my lightsource and make the variable "int n" = 3 for a light radius of 3 ...but that only makes a diamond shape around the character because of the way bresenhams draws lines. I think therefore, I may have to write a completely new function for lamps and the like. Surely it can't be too difficult to write an algorithm that will draw a circle with tiles. If I get it right, I can use it in my mapgen too :3