A blazingly fast, bitboard-based C++ chess engine paired with a real-time 3D OpenGL renderer, multithreaded AI opponent, and full audio support.
A robust C++ Chess Engine featuring a dedicated 3D Renderer powered by raylib. Built on highly optimized bitboard architectures (utilizing both standard and magic bitboards), this engine offers a massive performance leap over traditional array-based structures. The front-end renders clean, 3D chess pieces and dynamic lighting, while the back-end runs a highly optimized AI on a separate thread. Combined with integrated background music and sound effects, it bridges low-level engine speed with a smooth, modern 60 FPS gameplay experience.
- Advanced AI Opponent:
- Features a custom engine utilizing Negamax with Alpha-Beta Pruning.
- Quiescence Search to prevent horizon effect blunders.
- MVV-LVA (Most Valuable Victim - Least Valuable Attacker) move ordering for highly efficient branch pruning.
- Mop-Up Heuristic allows the AI to force checkmates in endgames.
- Multithreaded Architecture: AI calculations run asynchronously via
std::thread, ensuring the UI and animations never freeze during deep searches. - Bitboard Architecture: Uses normal and magic bitboards for ultra-fast move generation and static evaluation.
- Raylib 3D Graphics & Audio: Full 3D board, piece models, custom shaders, dynamic lighting calculations, background music, and piece-movement sound effects.
- Game Modes: Features a fully interactive Main Menu with options for local Two Player or Player vs AI (with adjustable depth/difficulty settings).
- Comprehensive Rule Enforcement: Full implementation of standard chess rules including En Passant, Castling, Pawn Promotion, checkmate, and stalemate detection.
Navigate the menus using your mouse. During gameplay, the engine reads keyboard inputs to navigate the 3D board selector and handle selections.
- W -> Move selector Up
- A -> Move selector Left
- S -> Move selector Down
- D -> Move selector Right
- Enter -> Select/Place Piece
When a pawn reaches the final rank, input one of the following numbers to choose your promotion piece:
- 1 -> Knight
- 2 -> Bishop
- 3 -> Rook
- 4 -> Queen
This project uses CMake for clean, cross-platform out-of-source builds.
If you do not want to compile the source code yourself, a pre-compiled executable is available with the project so you don't have to.
Ensure you have g++, cmake, make, and the raylib library installed on your machine.
On Linux (Debian/Ubuntu), you can install the build essentials, CMake, and the necessary audio dependencies via:
sudo apt update
sudo apt install build-essential cmake libasound2-devTo compile the source code and generate the standalone static executable (chess_engine), run the following command in the root directory:
mkdir build
cd build
cmake ..
makeTo remove the compiled binary and prepare for a clean rebuild, run:
rm -rf build-
Legacy Version: Check out the original, array-based predecessor: (Chess V-1) Based on Arrays.
-
Raylib - Simple and easy-to-use library to enjoy videogames programming.
-
Music by Samuel F. Johanns from Pixabay
-
Sound Effect by freesound_community from Pixabay
-
Sound Effect by SoundShelfStudio from Pixabay
-
Sound Effect by CreatorsHome from Pixabay



