This is a chess game developed in C++ and C# with the goal of creating a fully-featured chess application. The project is currently in development and aims to provide a seamless chess-playing experience with a modern user interface.
-
Modern User Interface:
- A clean and intuitive interface built with the latest WinUI 3 framework for Windows.
- High-DPI Support: The UI automatically scales for a crisp and clear viewing experience on any display.
-
Enhanced Gameplay Experience:
- Captured Pieces Display: The UI keeps a visual tally of all captured pieces for both players.
- Game Controls: Easily undo your last move or reset the board to start a new game.
- Immersive Audio: A dynamic audio engine provides sound effects for moves and captures, along with ambient background tracks to enhance the atmosphere.
-
Intelligent CPU Opponent:
- Play Against the AI: Challenge yourself in a single-player mode against a computer-controlled opponent.
- Adjustable Difficulty: Choose from multiple difficulty levels, from random moves to advanced strategies using Minimax with Alpha-Beta pruning.
- Flexible Setup: Decide whether to play as White or Black when starting a game against the CPU.
- Performance Optimizations: The engine uses techniques like transposition tables to ensure responsive and intelligent AI gameplay.
-
Advanced Multiplayer:
- LAN Gaming: Host or join games on your local network.
- Automatic Discovery: Automatically finds other players hosting games on the network.
- Network Selection: For users with multiple network connections, you can choose the specific network for multiplayer games, ensuring a stable connection.
-
Personalization:
- Custom Styles: Tailor the look of the game by choosing from different styles for the board and pieces.
- Player Naming: Set your own name for multiplayer sessions.
- Audio Controls: Independently adjust the volume for sound effects, atmosphere, and the master output.
- Backend (Chess.Engine): C++20, utilizing the asio library for networking
- Frontend (Chess.UI): C# with .NET8 and WinUI 3 for the user interface
- Build System: CMake, with a Python script to automate the build process
- Testing:
- C++: GoogleTest
- C#: xUnit, Moq
- Communication: The C# frontend communicates with the C++ backend via P/Invoke
- Developer Tooling (optional, CMake-integrated):
- Doxygen with doxygen-awesome-css for documentation
- CppCheck for static analysis
- Clang-Format for automatic source formatting
- CPU Evaluation Algorithms
- Refine and improve positional and move evaluation algorithms for different CPU difficulties
- Onboarding
- Create onboarding process
- Create score
- Enhance the sound engine for playback of dynamic score
- Compose dynamic score
- Chess.UI:
- Chess.UI: The main WinUI 3 project containing the user interface, view models, and services for the application.
- Chess.UI.Test: Contains unit tests (xUnit, Moq) for the
Chess.UIproject to ensure the reliability of the frontend logic.
- Chess.Engine:
- cmake: Containing several cmake modules used in this project.
- src:
- Chess.Engine.API: A C++ DLL project that exposes the core engine functionalities through a C-style API, allowing the C# frontend to communicate with the C++ backend via P/Invoke.
- Chess.Engine.Core: The core of the chess engine, written in C++. It includes all the game logic, such as the chessboard representation, move generation, validation, and the game state machine.
- tests:
- Core.Tests: Contains unit tests (GoogleTest) for the C++ core engine, verifying the correctness and stability of the game logic.
- C++ Compiler: Compatible with C++20 or higher.
- CMake: Version 3.15 or higher.
- Git: For cloning the repository.
- .NET8: For Windows App SDK / WinUi3
- Visual Studio 2022: With C++ Desktop Development workload.
- Python: Version 3.x (for running
build.py).
The following developer tools are integrated into the CMake build.
They are optional, controlled by CMake options, and can be enabled/disabled explicitly.
If enabled but the tool is missing, CMake will warn or fail depending on the module.
-
Doxygen (
ENABLE_DOXYGEN):
Generates HTML documentation from source code. -
CppCheck (
ENABLE_CPPCHECK):
Runs CppCheck for static analysis.- Install (Windows with winget):
winget install cppcheck
- Disable in CMake:
set(ENABLE_CPPCHECK OFF)
- Install (Windows with winget):
-
Clang-Format (
ENABLE_FORMAT):
Automatically formats C++ sources using.clang-format.-
Install (Windows with winget):
winget install llvm
(which includes
clang-format) -
Disable in CMake:
set(ENABLE_FORMAT OFF)
-
Each module is guarded by its own CMake option, so builds will not fail if the tool is missing and the option is explicitly set to OFF.
Under Build
Clone the repository using the following command:
git clone git@github.com:Diversiam90815/Chess.gitThe Chess Game project uses a build.py script to automate the build process.
Navigate to the project directory and run:
python build.py -pFor a Debug build, include the --debug or -d option:
python build.py -pdThe build preperation is included within the build process of the application. So, to build the project, you can directly call
Debug build:
python build.py -bdRelease build:
python build.py -bThe build.py script simplifies the build process:
- Options:
--prepareor-p: Generates build files using CMake.--buildor-b: Compiles the project.--debugor-d: Sets the build configuration to Debug mode.--testor-t: Runs the C++ unit tests (via CTest).--docs: Generates Doxygen documentation (opens in your default browser).
The project includes a suite of tests for both the backend and the frontend UI to ensure code quality and reliability.
- Backend (Chess.Engine.Tests): The C++ engine is tested using the GoogleTest framework. Tests cover core functionalities such as move generation, validation and execution.
- Frontend (Chess.UI.Tests): The C# UI and its view models are tested using xUnit, with Moq for creating mock objects.
This project is licensed under the MIT License. See the LICENSE file for details.