A top-down roguelike game built in C++. This project demonstrates the integration of modern C++ techniques with libraries like Raylib, Box2D, and LDtk. The main goal is to showcase the versatility of C++ in game development by creating an efficient, and extensible game capable of handling physics, rendering, and automated systems.
- Play on Itch.io - Web assembly build or download
- Windows Build - Direct download from GitHub
Gameplay youtube link: https://www.youtube.com/watch?v=GlSLxQbG-0g
For building the game yourself, check the Building section below. Download Latest Release
- Top-down roguelike gameplay with automatic combat
- Level design powered by LDtk with automatic collision handling
- Physics-based movement and collisions using Box2D
- Dynamic enemy spawning system
- Dual Weapon System: Combine sword combat with a bullet-based magic system
- Debug visualization options for developers
- C++20: Modern features like constexpr, ranges, and smart pointers
- Raylib (v5.0): 2D graphics library
- Box2D (v2.4.1): Physics engine
- LDtkLoader (v1.5.3.1): LDtk level editor integration
- {fmt} (v10.2.1): String formatting library
βββ sources/
β βββ entities/ # Game entities
β βββ physics/ # Box2D integration
β βββ scenes/ # Scene management
β βββ utils/ # Utilities
β βββ Constants.hpp # Game constants
βββ assets/ # Game resources
βββ CMakeLists.txt # Build configuration
I recommend using CMake GUI to generate Visual Studio project files for a smoother build process.
- CMake 3.22 or higher
- Visual Studio (with C++ development tools installed)
- Git
- Open CMake GUI
- Set the source code path to the project folder
- Set the build directory to a new folder
- Click Configure and select the appropriate Visual Studio version
- Click Generate to create Visual Studio project files
- Open the generated
.slnfile in Visual Studio - Build the project by selecting **Build Solution
- Run the executable from the
build/Debugorbuild/Releasefolder
You can also build directly using the terminal:
mkdir build && cd build
cmake -G "Visual Studio 17 2022" ..
cmake --build . --config Release- CMake 3.22 or higher
- C++20 compatible compiler
- Git
These libraries are required for rendering and window management:
The following commands install essential system libraries needed for the game:
libgl1-mesa-dev: Provides OpenGL support for rendering graphics.libX11-devel,libXrandr-devel,libXinerama-devel,libXcursor-devel,libXi-devel: These libraries handle window creation, input events, and screen resizing using the X11 windowing system, which is standard for Linux graphical applications.
sudo apt-get install libgl1-mesa-dev # OpenGL support
sudo dnf install libX11-devel libXrandr-devel libXinerama-devel libXcursor-devel libXi-devel # X11 windowing systemmkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Debug ..
cmake --build . --config Debugmkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build . --config Releasecmake -DPLATFORM=Web ..
cmake --build .- Debug build:
-DCMAKE_BUILD_TYPE=Debug - Release build:
-DCMAKE_BUILD_TYPE=Release - Web build (requires Emscripten):
-DPLATFORM=Web
In release builds, make sure to move the assets folder into the build folder, where the executable is located.
After building, navigate to the build directory and run:
./BladeAndStone2On Windows:
- Find and run the executable in
build/Debugorbuild/Releasefolders.
- WASD - Movement
- Space - Start/Reset game
The game uses LDtk for level design. Here's how to edit maps:
- Player: Place the
Playerentity where you want them to start - Enemy Spawner: Add spawners and customize their properties in LDtk
- Place tiles in their correct layers
- Tiles in the
Groundlayer marked asSolidautomatically handle collision
Raylib provides fast 2D graphics with a clean API, while C++ offers the performance and control needed for development.
- Character sprites: Link
- Environment sprites: Link
- Weapon sprites: Link
- Thanks to the asset creators for providing the resources used in this game.
This project was built using the raylib-cpp-cmake-template as a starting point. Special thanks to tupini07 for providing this excellent template that helped jumpstart the development process.
- BladeAndStone - The first version of the game had a much simpler design and far fewer features compared to this.
