Skip to content

Commit 02f5ea1

Browse files
committed
Renamed and added Readme
Renamed and added Readme
1 parent 0826fc8 commit 02f5ea1

16 files changed

+168
-303
lines changed

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,18 @@
1-
libtcod-first-person
1+
**Libtcod-Painter's Algorithm**
2+
3+
*A libtcod example of the Painters Algorithm written in C++ and released under the MIT License*
4+
5+
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.
6+
7+
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>.
8+
9+
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.
10+
11+
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).
12+
13+
To compile in other editors/IDEs include the libtcod libraries.
14+
15+
Comments and criticisms and more info e-mail me at davemoore22@gmail.com
16+
17+
![Unoptimised Example](https://media.giphy.com/media/dYd8W2i9UWASg53L6r/giphy.gif)
18+

bin/Debug/libtodsampleproject

640 Bytes
Binary file not shown.

inc/actor.hpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
// Copyright 2019 Dave Moore
2+
//
3+
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
4+
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
5+
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
6+
// permit persons to whom the Software is furnished to do so, subject to the following conditions:
7+
//
8+
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
9+
// Software.
10+
//
11+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
12+
// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
13+
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
14+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15+
116
class Actor {
217
public :
318
int x,y; // position on map

inc/engine.hpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
// Copyright 2019 Dave Moore
2+
//
3+
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
4+
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
5+
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
6+
// permit persons to whom the Software is furnished to do so, subject to the following conditions:
7+
//
8+
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
9+
// Software.
10+
//
11+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
12+
// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
13+
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
14+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15+
116
class Engine {
217
public :
318
TCODList<Actor *> actors;

inc/map.hpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
// Copyright 2019 Dave Moore
2+
//
3+
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
4+
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
5+
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
6+
// permit persons to whom the Software is furnished to do so, subject to the following conditions:
7+
//
8+
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
9+
// Software.
10+
//
11+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
12+
// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
13+
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
14+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15+
116
struct Tile {
217
bool explored; // has the player already seen this tile ?
318
Tile() : explored(false) {}

libtodfirstperson.cbp renamed to libtod-painters-algorithm.cbp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<CodeBlocks_project_file>
33
<FileVersion major="1" minor="6" />
44
<Project>
5-
<Option title="libtod-firstperson" />
5+
<Option title="libtod-paintersalgorithm" />
66
<Option pch_mode="2" />
77
<Option compiler="gcc" />
88
<Build>

0 commit comments

Comments
 (0)