A modern, object-oriented chess game built with C++ and SFML, featuring a clean UI, multiple game modes, and an extensible architecture.
- Local Play: Play chess against another player on the same device.
- AI Opponent: Challenge a computer opponent with adjustable difficulty.
- Replay & History: View and replay previous games with move-by-move navigation.
- Time Controls: Support for chess clocks and custom time settings.
- Modern UI: Responsive, visually appealing interface using SFML.
- Extensible Design: Easily add new features, states, or UI components.
- Object-Oriented Programming (OOP): Clear separation of concerns (controllers, views, models), encapsulation, and inheritance.
- MVC Pattern: Model-View-Controller for maintainability and scalability.
- State Pattern: Manage game states (main menu, local game, AI game, replay, etc.) for easy transitions and extensibility.
- Singleton Pattern: Managers like
TextureManagerensure a single instance throughout the application. - Factory Pattern: State creation and management through flexible instantiation.
- Resource Management: Smart pointers (
std::shared_ptr,std::unique_ptr) for safe and efficient memory management. - Event-Driven Programming: Real-time response to user and system events.
- Advanced C++ (OOP, smart pointers, STL, RAII)
- UI programming with SFML (graphics, window, event handling)
- Modular code organization and separation of concerns
- Error handling and resource cleanup
- Cross-platform considerations (Windows API for workspace size, SFML for portability)
- Documentation and code comments for maintainability
- Compiler: g++ 13.1.0 (MinGW-W64)
- Graphics library: SFML 2.6.2
- Download link: https://www.sfml-dev.org/download/sfml/2.6.2 select GCC version 13.1.0 MinGW (SEH) - 64-bit
- After successful download, copy the include and lib folders to the same level as the source folder
- Copy all .dll files in the bin folder to the release folder so that the executable file can run without missing library errors
- Download the stockfish engine at https://stockfishchess.org/ and place the engine's exe file in the folder containing the game's exe file if playing with AI
- Clone the repository:
git clone https://github.com/yourusername/ChessGameOOP.git cd ChessGameOOP - Build the project:
- Using Makefile:
make
- Or with CMake:
mkdir build cd build cmake .. make
- Using Makefile:
- Run the compiled executable.
- Choose your game mode (Local, AI, Replay, etc.).
- Use the UI to interact with the chessboard, controls, and settings.
