-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.md.backup
312 lines (206 loc) · 10.1 KB
/
README.md.backup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# HOW TO LAUNCH THE GAME
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](https://lucid.app/lucidchart/86ec54ef-a183-4e0a-813c-dbcd92edf129/edit?viewport_loc=-1418%2C-277%2C13178%2C6122%2CHWEp-vi-RSFO&invitationId=inv_10ac6a67-0946-46c7-8b12-b112de21222d).
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.
### I. Just launch the game
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`
<p align="center">
<img src="./ress_readme/BuildDirectory.png" alt="Main Menu" width="400"/>
</p>
<p align="center">
<img src="./ress_readme/GameRun.png" alt="Main Menu" width="400"/>
</p>
<p align="center">
<img src="./ress_readme/MainMenu.png" alt="Main Menu" width="400"/>
</p>
### II. Just launch the gametests
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`
<p align="center">
<img src="./ress_readme/Runtests.png" alt="Main Menu" width="400"/>
</p>
### III. Others commands
#### Cmake for the files
1. `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.
2. `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 type `run_game.sh`
3. `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.
4. `cmake_debug_simple.sh`: A shell script used to simply compile the project using CMake in debug mode, but without running it.
#### Make for the files
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 :
1. `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.
2. `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.
#### Cleaning stuff
1. `clean_build.sh`: A shell script used to clean the entire build directory.
2. `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.
#### Testing Valgrind leaks
1. `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.
<p align="center">
<img src="./ress_readme/Valgrind1.png" alt="Main Menu" width="400"/>
</p>
<p align="center">
<img src="./ress_readme/Valgrind2.png" alt="Main Menu" width="400"/>
</p>
# HOW TO PLAY THE GAME
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.
\- 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:
<p align="center">
<img src="./ress_readme/MainMenu.png" alt="Main Menu" width="400"/>
</p>
Help:
<p align="center">
<img src="./ress_readme/Help.png" alt="Help" width="400"/>
</p>
Settings default:
<p align="center">
<img src="./ress_readme/Settings.png" alt="Settings" width="400"/>
</p>
Settings maxlife example:
<p align="center">
<img src="./ress_readme/SettingsMaxLife.png" alt="Settings Max Life" width="400"/>
</p>
Game Default:
<p align="center">
<img src="./ress_readme/Game.png" alt="Game" width="400"/>
</p>
Game maxlife example:
<p align="center">
<img src="./ress_readme/GameMaxLife.png" alt="Game Max Life" width="400"/>
</p>
GamePause:
<p align="center">
<img src="./ress_readme/Pause.png" alt="Pause" width="400"/>
</p>
GameOver:
<p align="center">
<img src="./ress_readme/GameOver.png" alt="Game Over" width="400"/>
</p>
# INSTALLING NEEDED COMPONENTS
---
## Checking Your Current SMFL Version
To check the current version of SFML installed on your machine, use the following command in your terminal:
```bash
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.
---
## Installing SFML
### Prerequisites
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:
```bash
sudo apt-get install build-essential
```
### Installation
1. Open a terminal.
2. Install SFML using your package manager:
- **Debian/Ubuntu**:
```bash
sudo apt update
sudo apt install libsfml-dev
```
- For other distributions, please refer to your distribution's package manager.
3. Once the installation is complete, you can proceed to check the version of SFML.
### Checking the SFML Version
To check the sfml version, simpy run :
```bash
pkg-config --modversion sfml-all
```
### Additional Resources
For more information on SFML, please refer to the official SFML documentation: [https://www.sfml-dev.org/documentation](https://www.sfml-dev.org/documentation)
---
## Checking Your Current Cmake Version
To check the current version of cmake installed on your machine, use the following command in your terminal:
```bash
cmake --version
```
This will print the current version of Cmake, e.g., `3.22.1`.
[updated: 29.05.2023, Benito & Hamsa]
---
## Installing Cmake
If you don't have cmake installed on your machine, use the following command in your terminal:
```bash
sudo apt-get update
sudo apt-get install cmake
```
You can verify the installation, using `cmake --version`
---
## Checking Your Current Valgrind Version
To check the current version of Valgrind installed on your machine, use the following command in your terminal:
```bash
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.
---
## 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:
```bash
sudo apt-get install build-essential
```
### Prerequisites
Make sure you have `gcc`, `make`, and `git` installed on your machine. You can verify the installation of these packages using the following commands:
```bash
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.
### Installation Steps
1. Clone the Valgrind repository:
```bash
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:
```bash
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:
```bash
git clone git://sourceware.org/git/valgrind.git valgrind-new
```
This will create a new directory called "valgrind-new" with the cloned repository.
2. Navigate to the `valgrind` directory:
```bash
cd valgrind
```
3. Prepare for the build:
```bash
./autogen.sh
```
4. Configure the build:
```bash
./configure
```
5. Build Valgrind:
```bash
make
```
Note: This step might take some time, depending on your machine.
6. Install Valgrind:
```bash
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]
---