Field of View

Field of View is very important decision for any game. How will it be rendered? What will the player be able to see?

I decided to make it very easy, by Raytracing. I have only a 2 dimensional space, so this should not pose a performance problem. I had to copy the basics by around 90% from a tutorial, but seriously... there aren't so many different ways on how to define a point or a Line. The Field of View now goes through each Point of a Line and tells if the tile is visible or not. Everything depends on a) the Vision radius, b) the tile itself and c) obstacles. For every point on the perimeter (of the vision's radius), a new Line is created. Then, for each line, we go from the player towards the end point.

Continue reading