IT lexicon › Programming › Recursive shadowcasting

Recursive shadowcasting

Programming På svenska → Updated: 2026-10-25

A field-of-view algorithm for grid games that scans each of eight octants tracking visible angle ranges, where blocking cells cast shadows that hide the cells behind them.

The problem is working out exactly which cells a character can see in a walled grid world — the field often drawn as fog of war. Recursive shadowcasting splits the view into eight symmetric octants and scans each one row by row (or column by column). For every row it carries a range of visible "slopes"; a blocking cell cuts that range in two and the algorithm recurses on the halves, so cells in its shadow are never visited.

Björn Bergström described the method in 2001. It is fast and symmetric — if A sees B, B sees A — and has become standard in roguelikes. Alternatives exist: permissive FOV and per-cell raycasting.

← Back to the lexicon