GameHub is a lightweight C++ game collection project designed to host multiple classic games such as Tic-Tac-Toe and Hangman under a single hub.
It is built entirely in C++ and uses CMake for cross-platform builds.
- Modular design with a
GameFactoryto easily add new games - Currently includes:
- Tic-Tac-Toe
- Hangman
- Lightweight, console-based interface
- Cross-platform (Windows, Linux, macOS)
The GameHub project follows a modular and extensible architecture:
-
GameHub (core manager):
The main application manager that orchestrates available games and handles user interaction. -
GameService (abstract game interface):
Defines the functions that all games must implement. Each game service inherits from this class to provide its own game logic. -
GameFactory (abstract factory class):
Responsible for creating game instances. Each game has a concrete factory to produce its correspondingGameService. -
Concrete Game Services:
Each game encapsulates its own rules, logic, and state. These are returned by their respective factories and managed by GameHub.
This architecture makes it simple to extend GameHub:
➡️ Create a new game service → Add a concrete factory for it → Register it in GameHub’s game directory.
Follow these steps to build and run the project.
- Install a C++ compiler:
- Windows: Visual Studio (MSVC) or MinGW
- Linux/macOS:
g++orclang(already available on most systems)
- Install CMake
cd path\to\GameHubmkdir build
cd build
cmake ..cmake --build .- If using Visual Studio / MSVC:
- The executable will be inside
build/Debugorbuild/Release
- The executable will be inside
- If using MinGW or NMake
- The executable wil be inside
build/
- The executable wil be inside
- If in
Debug:
./Debug/GameHub.exe- If in
build:
./GameHub.exe- If you encounter errors during build:
- Check that CMake and your C++ compiler are installed and available in your PATH
- Review the error messages printed during the build process
- Ensure your compiler version supports C++17 or later