Libtcod-Painter's Algorithm
A libtcod example of the Painters Algorithm written in C++ and released under the MIT License
The purpose of this code snippet to display a dungeon from a first person perspective using the so-called Painter's Algorithm using the libtcod (https://github.com/libtcod/libtcod/) truecolour console most often used for Roguelike development. This technique was often used by old school blobber/dungeon crawlers to fake a "2.5D" view and to avoid using any 3D graphical techniques.
The algorithm is quick and dirty and based upon the one used in the game Heroine Dusk (http://heroinedusk.com) by Clint Bellinger. Artwork/tiles used are by Clint Bellinger and are available here (https://opengameart.org/content/first-person-dungeon-crawl-art-pack). The codebase used for this demo is based upon the libtcod C++ tutorial here: http://www.roguebasin.com/index.php?title=Complete_roguelike_tutorial_using_C%2B%2B_and_libtcod_-_part_4:_field_of_view.
Apologies for the hideous code. It works, and should give you an idea of how to do this sort of stuff. Future enhancements include optimising it and converting it over to C++17.
Included is a Codeblocks project usable under Ubuntu Linux. It uses libtcod 1.11.1 (but I think it works as far back as libtcod 1.6).
To compile in other editors/IDEs include the libtcod libraries.
Comments and criticisms and more info e-mail me at [email protected]