Wednesday 9 July 2014

Field of field of vision

Roguelike developers have long struggled to invent good and fast FOV routines. I've had some good results with a regular line of sight (line drawing) and then fixing errors with a special routine. What I've also found out is that clearing the FOV map first is slower than setting visible and blocked tiles using only line drawing (drawing to the end of FOV area) at least in large open areas, because there are then two iterations through the map (even though line drawing visits a number of same tiles).

One day I had an idea about new type of fix routine that takes place first, before line drawing. It also sets each tile of FOV map to a preset value. Then line drawing takes care of the rest. But let's not get excited, because there is not yet a working implementation. In theory with advanced type of routine it would be possible to limit line drawing only to places where it's needed after the initial FOV routine.

I also wondered would it be possible to draw the level with the FOV routine itself (without having to copy the FOV data first to a map) using an update map to prevent multiple drawing of a tile. It could be something to try, because it seems always that you need to iterate the map or visible area several times to get things done before drawing.

No comments: