Rogues' Redemption - roguelike with pixel graphics

There are various ways to implement field of view functionality in a roguelike. Initially I attempted to project from each map tile back to the player unhiding the tile if the ray makes it back to the player without colliding with a solid tile. Although this kind of worked, it was problematic both technically and visually. There were a lot of artefacts and the code to sort this out was complicated and not eligant.

So I re-wrote the code to mimic a radar of sorts. Rays are projected out from the player and each tile that is reached is then unhidden. Once the ray hits a solid tile it stops.

Technically, this is a simple approach to the problem but provides good and consistent results. Initially, the radar did a full 360 degree sweep in one frame but this was very slow on Android so it’s now chopped into 16 slices; this still achieves nearly 4 full sweeps per second. I quite like the way this suggests the hero is quickly looking around the room rather than the whole room suddenly popping into view when the door is opened.

The gif is slower than the actual radar in the game.

3 Likes