Preparing the Entities Field of View

Learn how to prepare components that store visibility data. Then, we'll make a system that runs a field of view algorithm.

Plotting fields of view

There are many different implementations of field of view algorithms, often optimized to the needs of a specific game. bracket-lib includes a relatively simple one based on path tracing. It works by drawing an imaginary circle around the starting point and then plotting a line to each of the points on the circle’s exterior. Each tile encountered along the line is visible, and the line plot stops when it hits an opaque tile, represented by #. The algorithm may be visualized like this:

Get hands-on with 1200+ tech skills courses.