- C++ 97%
- CMake 2.5%
- C 0.5%
| assets | ||
| images | ||
| src | ||
| tests | ||
| .clang-format | ||
| .gitignore | ||
| CMakeLists.txt | ||
| LICENSE | ||
| README.md | ||
| settings.json | ||
this->Eidolon
this->Eidolon is a top-down, tile and turn-based roguelike where you can morph into the foes that have fallen before you, using their strengths and abilities to your advantage.
Compiling
Linux / Windows with WSL
- In the root directory, run
cmake -B out. This will generate the platform-specific build files (makefiles, etc) from the CMakeLists.txt, and put them in a directory namedout. - Once it's finished,
cd outto enter the directory. - Run
make, which will run the platform-specific makefile(s) you generated with cmake. - Then, if you want to run the executable produced, type
./Eidolon. - Tip: when iterating changes you can remain in the
outdirectory and runmakeeach time you want to rebuild, and make itself will re-run cmake when necessary, saving you from moving between things all the time.
Visual Studio (NOT vscode)
Visual Studio should pick up that it's a cmake project. You should just be able to do Ctrl+B to build, or F5 to build and run.
You can also go the command line route if you don't have WSL, but use MSBuild as your build tool instead of make
See more about cmake in Visual Studio here
Helper classes/constructs
Direction
Directions are enums, in order of rotation, so you can use them as Direction::NORTH, NORTHWEST, etc. but you can also multiply it by 45 to get a rotation in degrees.
TileCoords
They have a Move helper function which returns a TileCoords moved one space in the Direction chosen.
GetRandomValue (from raylib)
Returns a random int between A and B. Very helpful for random behaviour, etc.
TileData
Contains an std::optional Creature, and a list of items. A Creature usually cannot move into a tile space that is Blocking(), i.e. there is an item in the space that has over 1000 weight.
Usages and abilities
ItemObjects have usages, CreatureObjects have abilities. Each one has a valid usages/abilities variable that is a key/value list of strings (the ability name) and Ability*/Usage*, which is a pointer to a derived class of Ability*/Usage*. (todo)
How To
Adding Sprites for Tiles
- First, add the sprite in to assets/tiles, with the name of the creature/item that it uses. For example, for humans, because the object's kind is "human", it uses the "./assets/tiles/human.png".
- Next, add the tile to the list of tiles at the top of Tiles.h. This will ensure every tile is only loaded into a texture once, and all of them are unloaded properly.
After this, the tile should appear properly. If it doesn't, check that the file extension of the image is .png, and convert it if not. Also double-check that the name of the file before the file extension, the GameObject::kind of the target creature/item, and the name mentioned in Tiles.h all match.
Testing
Follow the compilation steps above until after make, then run make test to run the tests.
To create new tests do the following:
- Derive a class from Test in Tests.cpp that implements
Run() - Add another
string/Test*pair toTest::tests. - Add a test to CMake with in the form
add_test(NAME <test-name> COMMAND TestSuite <test-name>). Make sure<test-name>matches the string inTest::tests. - Add the pass and fail regexes to the test using
set_property; see the tests in CMakeLists.txt.

