Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • beckermar/wizard
1 result
Show changes
Commits on Source (6)
# Software Engineering Project - Wizard
Welcome to **Wizard**, a C++ implementation of the classic card game. Compete with your friends in exciting multiplayer gameplay!
Welcome to **Wizard**, a C++ implementation of the classic card game. Compete with your friends in exciting multiplayer
gameplay!
<div style="display: flex; align-items: center;">
<img src="./assets/wizard_logo.png" alt="Wizard Logo" style="height: 150px; margin-right: 20px;">
......@@ -15,16 +16,93 @@ Welcome to **Wizard**, a C++ implementation of the classic card game. Compete wi
---
You can read the game's rules [here](https://www.amigo.games/content/ap/rule/19420--031-2019-Wizard_Manual_002_LAYOUT[1].pdf). The implementation features a client/server architecture for multiplayer scenarios.
It uses [wxWidgets](https://www.wxwidgets.org/) for the GUI, [sockpp](https://github.com/fpagliughi/sockpp) for the network interface, [rapidjson](https://rapidjson.org/md_doc_tutorial.html) for object serialization, and [googletest](https://github.com/google/googletest) for the unit tests.
You can read the game's rules [here](https://www.amigo.games/content/ap/rule/19420--031-2019-Wizard_Manual_002_LAYOUT[1].pdf). The implementation features a client/server architecture for multiplayer
scenarios. It uses [wxWidgets](https://www.wxwidgets.org/) for the GUI, [sockpp](https://github.com/fpagliughi/sockpp) for the network interface, [rapidjson](https://rapidjson.org/md_doc_tutorial.html) for object
serialization, and [googletest](https://github.com/google/googletest) for the unit tests.
## 1 Overview
---
## 1 Overview
The game and source files is available on GitLab on the main branch. The game was developed based on the provided LAMA example project game. This project consists of a **server** and a **client**, each with their own main.cpp file. Each player can run his client and connect to the server in the same local network.
The game and source files are available on GitLab on the main branch. The game was developed based on the provided LAMA
example project game. This project consists of a **server** and a **client**, each with their own main.cpp file. Each
player can run their own client and connect to the same server in the same local network.
---
## 2 Compile Instructions
This project only works on UNIX systems (Linux / macOS). We thus only explain the how to compile the game on these
systems. The following description was tested on Ubuntu 20.04 and on macOS Sequoia.
### 2.1 Prepare OS Environment
If your OS does not yet have git installed, install git by running `sudo apt-get install git` on Ubuntu or by
running `xcode-select --install` on macOS (this installs git as well). The Wizard repository can then be cloned by
running `git clone https://gitlab.ethz.ch/beckermar/wizard.git` (clone with HTTPS) or by running
`git clone git@gitlab.ethz.ch:beckermar/wizard.git` (clone with SSH) inside the directory that should contain the game.
Cloning the game as a first step also makes provided scripts for preparing the OS environment and for compiling the code
available.
#### 2.1.1 Ubuntu 20.04
The necessary packages and software can either be installed manually or by running the provided script.
To use the provided script, run `bash scripts/prepare_ubuntu.sh` inside the **wizard** directory.
To manually prepare Ubuntu, execute the following commands:
1. `sudo apt-get update` (update package list)
2. `sudo apt-get install build-essential` (install software to build from source)
3. `sudo apt-get install libwxgtk3.0-gtk3-dev` (install wxwidgets, use libwxgtk3.2-dev on Ubuntu 24.04)
4. `sudo apt-get install cmake` (install cmake)
#### 2.1.2 macOS Sequoia
The necessary packages and software can either be installed manually or by running the provided script.
To use the provided script, run `zsh scripts/prepare_macos.sh` inside the **wizard** directory.
To manually prepare macOS, execute the following commands:
1. `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"` (install homebrew)
2. `brew install cmake` (install cmake)
3. `brew install wxwidgets` (install wxwidgets)
### 2.2 Compile Code
Compiling the code creates executables for the client (Wizard-client) and for the server (Wizard-server).
#### 2.2.1 Ubuntu 20.04
Compiling the code can be done by running the provided script.
To use the provided script, run `bash scripts/compile_ubuntu.sh` inside the **wizard** directory.
#### 2.2.1 macOS Sequoia
Compiling the code can be done by running the provided script.
To use the provided script, run `zsh scripts/compile_macos.sh` inside the **wizard** directory.
---
## 3 Run the Game
After compiling the code, navigate into the **cmake-build-debug** directory (if not yet there). To start a server, run
`./Wizard-server`. In new consoles, you can now start as many clients as you wish by running `./Wizard-client`.
---
## 4 Play the Game
Enjoy the game!
### 4.1 Connection Panel
The client renders the GUI that is presented to the player, whereas the server is a console application without a user interface. Every action a player performs in the client application (for example playing a card) is sent as a formatted message to the server application, which processes the request.
- If the **player's move was valid**, the server will update the game state (e.g. move a card from the player's hand to the discard pile) and broadcast this new game state to all players of the game. Whenever the client application receives a game state update, it will re-render the GUI accordingly and allow new interactions.
......
File added
File added
#!/bin/zsh
# path to the assets folder containing the .ttf files
ASSETS_DIR="./assets"
FONT_NAME1="JunicodeBold.ttf"
FONT_NAME2="MagicSchoolOne.ttf"
# path to the system fonts directory
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
FONT_DIR="$HOME/.fonts"
elif [[ "$OSTYPE" == "darwin"* ]]; then
FONT_DIR="$HOME/Library/Fonts"
else
echo "Unsupported operating system. Exiting."
exit 1
fi
# check if the .ttf files exists
if [[ ! -f "$ASSETS_DIR/$FONT_NAME1" ]]; then
echo "Font file $FONT_NAME1 not found in $ASSETS_DIR. Exiting."
exit 1
fi
if [[ ! -f "$ASSETS_DIR/$FONT_NAME2" ]]; then
echo "Font file $FONT_NAME2 not found in $ASSETS_DIR. Exiting."
exit 1
fi
# copy font 1
cp "$ASSETS_DIR/$FONT_NAME1" "$FONT_DIR"
# refresh cache
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
fc-cache -f -v
fi
# copy font 2
cp "$ASSETS_DIR/$FONT_NAME2" "$FONT_DIR"
# refresh cache
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
fc-cache -f -v
fi
# compile code
cd sockpp/ || exit
mkdir cmake-build-debug
cd cmake-build-debug || exit
cmake ..
make
cd ../..
mkdir cmake-build-debug
cd cmake-build-debug || exit
cmake ..
make
\ No newline at end of file
#!/bin/bash
# path to the assets folder containing the .ttf files
ASSETS_DIR="./assets"
FONT_NAME1="JunicodeBold.ttf"
FONT_NAME2="MagicSchoolOne.ttf"
# path to the system fonts directory
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
FONT_DIR="$HOME/.fonts"
elif [[ "$OSTYPE" == "darwin"* ]]; then
FONT_DIR="$HOME/Library/Fonts"
else
echo "Unsupported operating system. Exiting."
exit 1
fi
# check if the .ttf files exists
if [[ ! -f "$ASSETS_DIR/$FONT_NAME1" ]]; then
echo "Font file $FONT_NAME1 not found in $ASSETS_DIR. Exiting."
exit 1
fi
if [[ ! -f "$ASSETS_DIR/$FONT_NAME2" ]]; then
echo "Font file $FONT_NAME2 not found in $ASSETS_DIR. Exiting."
exit 1
fi
# copy font 1
cp "$ASSETS_DIR/$FONT_NAME1" "$FONT_DIR"
# refresh cache
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
fc-cache -f -v
fi
# copy font 2
cp "$ASSETS_DIR/$FONT_NAME2" "$FONT_DIR"
# refresh cache
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
fc-cache -f -v
fi
# compile code
cd sockpp/ || exit
mkdir cmake-build-debug
cd cmake-build-debug || exit
cmake ..
make
cd ../..
mkdir cmake-build-debug
cd cmake-build-debug || exit
cmake ..
make
\ No newline at end of file
#!/bin/zsh
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install cmake
brew install wxwidgets
\ No newline at end of file
#!/bin/bash
sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install libwxgtk3.0-gtk3-dev
sudo apt-get install cmake
\ No newline at end of file