First, go to the part 3, Installing needed components and check if you have all the requisites one (cmake, sfml and valgrind if you want to check any memory leak [spoiler, there is no memory leak :)]
To see the UML, go to the directory UML or follow this link.
We created .sh files so simplify the launch of the game.
Go to the main directory and simply run the following bash files depending on what you want.
In the build directory, we kept the necessary files and executables. So if you only want to play the game, you can simply type : ./run_game.sh
In the build directory, we kept the necessary files and executables. So if you only want to play the game, you can simply type : ./run_test.sh
-
cmake_release_run.sh
: A shell script used to run the CMake build process in release mode. It will compile all necessary file and automaticaly launch the game just after.
Disclaimer : it takes a long time, especially due to the tests compiling process. -
cmake_release_simple.sh
: A shell script used to simply compile the project using CMake in release mode, but without running it.
Later if you want to run it you can simple typerun_game.sh
-
cmake_debug_run.sh
: A shell script used to run the CMake build process in debug mode. This will include additional debug information in the compiled binaries, especially -Wall for all warnings. It will automaticaly launch the game just after. -
cmake_debug_simple.sh
: A shell script used to simply compile the project using CMake in debug mode, but without running it.
Warning : a first cmake is necessary !! If you already did a cmake and for any reason changed some aspects of the code and also want to rebuild the game a cmake is not necessary. So you can :
make_run.sh
: A shell script to run the make command and execute the produced binary. It will automaticaly launch the game just after the make.make_simple.sh
: A shell script that just runs the make command to compile your project without launching the game after.
Warning, if you added files to the assets or the ressources directory, you need to do a new cmake to they will be copied to the good place later for the game.
clean_build.sh
: A shell script used to clean the entire build directory.clean_cmakefiles.sh
: A shell script used to remove all files generated by CMake. Only keep the .exe of the game and gametests. And keep the necessary ressources and assets directory.
valgrind_lunch.sh
: A shell script used to launch the Valgrind tool on the project binary. Warning, you need the .exe of the game to launch it so if you don't have it a first cmake_release_simple is necessary.
Either go to the help menu when lunching the game.
Or to resume the key aspects :
- Game with 2 players
- Movement for 1st player (on the left) : Z,Q,S,D
- Movement for 2st player (on the right) : Arrow keys
- Simply avoid obstacles and collect coins
- To pause the game, press Esc key. To resume, simply press again Esc. key
- You can select the number of lifes in the settings
- You can select the starting difficulty also in the settings (basicly it will change the stating speed of the obstacles)
Some pictures to see what was done:
MainMenu:
Help:
Settings default:
Settings maxlife example:
Game Default:
Game maxlife example:
GamePause:
GameOver:
To check the current version of SFML installed on your machine, use the following command in your terminal:
pkg-config --modversion sfml-all
This command will display the version number of SFML installed on your system.
The current version of SFML is : 2.5.1
[updated: 29.05.2023, Benito & Hamsa]
If you have installed individual SFML modules, you can replace sfml-all
with the specific module name (e.g., sfml-system
, sfml-graphics
, etc.) to check the version of that particular module.
Before we proceed, please note that for this process you need to have development tools (like gcc, autoconf, automake) installed on your system. If you are using a Debian-based Linux, you can install them with:
sudo apt-get install build-essential
-
Open a terminal.
-
Install SFML using your package manager:
-
Debian/Ubuntu:
sudo apt update sudo apt install libsfml-dev
-
For other distributions, please refer to your distribution's package manager.
-
-
Once the installation is complete, you can proceed to check the version of SFML.
To check the sfml version, simpy run :
pkg-config --modversion sfml-all
For more information on SFML, please refer to the official SFML documentation: https://www.sfml-dev.org/documentation
To check the current version of cmake installed on your machine, use the following command in your terminal:
cmake --version
This will print the current version of Cmake, e.g., 3.22.1
.
[updated: 29.05.2023, Benito & Hamsa]
If you don't have cmake installed on your machine, use the following command in your terminal:
sudo apt-get update
sudo apt-get install cmake
You can verify the installation, using cmake --version
To check the current version of Valgrind installed on your machine, use the following command in your terminal:
valgrind --version
This will print the current version of Valgrind, e.g., valgrind-3.18.1
.
[updated: 29.05.2023, Benito & Hamsa]
But there was some errors in our game : "Intercept strncmp for glibc ld.so v2.28+" that was observed in Valgrind was due to an update in the glibc library. In glibc v2.28, a call to strncmp was added which caused issues with Valgrind. The reason for this is that glibc's version of strncmp is highly optimized and can perform sixteen-byte reads on short strings. When Valgrind tries to track this, it raises an error.
This issue was fixed by intercepting the strncmp calls in ld.so and using Valgrind's version of the function instead. You can find more about the fix in this commit.
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=947388eb043ea1c44b37df94046e1eee790ad776
To resolve this, you can try installing Valgrind from Source.
Before we proceed, please note that for this process you need to have development tools (like gcc, autoconf, automake) installed on your system. If you are using a Debian-based Linux, you can install them with:
sudo apt-get install build-essential
Make sure you have gcc
, make
, and git
installed on your machine. You can verify the installation of these packages using the following commands:
gcc --version
make --version
git --version
Each command should return the version of the respective package. If not, you might need to install these packages first.
-
Clone the Valgrind repository:
git clone git://sourceware.org/git/valgrind.git
Note: If you get an error that the
valgrind
directory already exists, use a different name for the directory or remove the existing directory.To fix this, you have a couple options:
-
You can remove the existing "valgrind" directory if it is not needed. Be careful with this command, as it will delete the directory and all of its contents permanently:
rm -rf valgrind
-
You can clone the repository into a different directory. Simply give a different name at the end of the git clone command:
git clone git://sourceware.org/git/valgrind.git valgrind-new
This will create a new directory called "valgrind-new" with the cloned repository.
-
-
Navigate to the
valgrind
directory:cd valgrind
-
Prepare for the build:
./autogen.sh
-
Configure the build:
./configure
-
Build Valgrind:
make
Note: This step might take some time, depending on your machine.
-
Install Valgrind:
sudo make install
After these steps, the latest version of Valgrind should be installed on your machine.
You can verify the installation by running valgrind --version
again in the terminal. The version number should now reflect the latest version : valgrind-3.22.0.GIT [updated: 29.05.2023, Benito & Hamsa]