node package manager
Stop writing boring code. Discover, share, and reuse within your team. Create a free org »


Precise Permissive Field Of View

A Precise Permissive FOV algorithm, based on the Python implementation.


npm install permissive-fov



In order to instantiate a PermissiveFov object, one needs to pass it the map dimensions and an isTransparent function that will determine whether a pair of coordinates points to a transparent (non-blocking) cell on the map.

const PermissiveFov = require("permissive-fov").PermissiveFov;
let width = 80;
let height = 50;
let isTransparent = (x, y) => { return map[x][y].transparent; };
let fov = new PermissiveFov(width, height, isTransparent);

Since Permissive FOV contains TypeScript typings, it can also be used within TypeScript applications, the only difference being, obviously, the import statement:

import {PermissiveFov} from "permissive-fov";

FOV computation

A FOV computation requires four parametres: the source coordinates x and y, maximum sight radius (use Infinity for unlimited sight radius) and a function that will mark a given pair of coordinates as seen.

let startX = 40;
let startY = 25;
let radius = 10;
let setVisible = (x, y) => { map[x][y].visible = true; };
fov.compute(40, 25, 10, setVisible);

Changing map dimensions

let newWidth = 100;
let newHeight = 60;
fov.setMapDimensions(newWidth, newHeight);

Changing the transparency check function

let newIsTransparent = (x, y) => {
    return map[x][y].transparent ||

About Permissive FOV

Precise Permissive Field Of View is a field of view (FOV) computation algorithm. Given a 2D grid with a source point S and n points marked as obstacles, it will determine all points visible from S.

Here's an example of a field of view calculated using the Permissive FOV algorithm:


Real life uses

As with most field of view algorithms, Precise Permissive Field Of View can be used in any game with a two dimensional grid layout, e.g. a roguelike.

Due to the permissive nature of this algorithm, it is well suited for situations where symmetry and permissiveness are the desired features, e.g. for reasons of gameplay balance.

Restrictiveness vs. permissiveness

As the name itself implies, this algorithm is permissive (as opposed to restrictive). It means that it will typically consider many more points to be in field of view than other algorithms would.

This also means that in some cases, the field of view will take an unnatural looking shape, including points that are considered to be visible despite being right behind an obstacle. Here are two examples that demonstrate this:




A FOV algorithm is considered symmetric given that the following is true:

Given any set of points A and B, when B is in FOV of A, then A is in FOV of B.

In other words, a field of view is symmetric when all of the points seen from source can also see the source, while all the points not seen by the source, cannot see the source either.

Permissive Precise FOV is perfectly symmetric.


Compared to other available FOV algorithms, Precise Permissive FOV is rather slow, with an average time required to compute a single field of view several times longer than that of the best performing alternatives.

This means that this algorithm may not be well suited for uses where the field of view computation is performed very frequently. That being said, the symmetric nature of Precise Permissive FOV allows for smart optimisations. For instance, if the FOV has already been calculated for origin point A, determining whether A is visible from B doesn't require another FOV computation: if A sees B, then B sees A.


FOV images have been generated by FOV Torture Chamber.


Python implementation's authorship and copyright notice:

Author:         Aaron MacDonald
Date:           June 14, 2007
Description:    An implementation of the precise permissive field
                of view algorithm for use in tile-based games.
                Based on the algorithm presented at
You are free to use or modify this code as long as this notice is
This code is released without warranty.