This is a complete recreation of the classic board game Chess, all in C++. It also includes a custom GUI made from scratch using the Simple and Fast Multimedia Library (SMFL). This model includes every feature and move of the original game, such as castling, checking, checkmate/stalemate, pinning, and much more. This application also includes other non-core features such as a move history and game state saving/loading.
The following clips demonstrate some of the features this game has to offer.
To accomodate for all of the variety in piece movements and all the special rules/exceptions, this project relies on good design principles and solid architecture to manage complexity.
The core functionality of the game is completely separate from the method of input/output, meaning the game can essentially run "headless". This separation is what makes the save system possible. Loading a save recreates the game by simulating all of the moves in sequence, running the game in this "headless" mode. Only when the save file is finished loading does the game connect with the GUI, which outputs the model and allows for user input.
This view/model separation also helps keep core game logic decoupled fully from the GUI logic. In fact, the game is also fully playable from the console with no difference in the core chess gameplay.
This principle of separating view and model is a practice that translates very well to game engines. Good view/model separation reduces coupling between UI and gameplay elements and allows for easier unit testing.
The variety of the moves is handled using the command pattern. In essence, this involves turning operations into objects. In this case, each type of move on the chess board is represented as a subclass inheriting from an abstract Move class. By implementing the inherited virtual functions, each subclass is responsible for knowing how to execute and undo its operation. In exchange, the user code doesn't need to know any implementation details about the move. This creates for highly extensible and easily maintainable code.
This project makes strong use of many core C++ features, which demonstrates command of the language.
Move semantics happen to be applied very literally in this project. Move semantics are used to implement the "moving" of pieces on the board, which is a 2D array of unique pointers. Implementing the board through smart pointers allows 1. automatic memory management through RAII, 2. polymorphic behavior which is not possible with values due to object slicing, and 3. the possibility of nullptr on empty squares, which isn't possible with reference wrappers.
This project makes heavy use of operator overloading to allow for easy use of program-defined classes and smooth syntax. This project uses all three ways of implementing operator overloads, depending on the context: member functions, free functions, and free friend functions when necessary.
This project makes use with the standard C++ library, which is of course full of many, many template classes. This is leveraged to create containers and other custom-class related objects quickly and efficiently. While the standard library does not translate well into the Unreal ecosystem, which has alternatives for standard library classes, the ability to effectively use provided libraries does translate well.