By | 17 décembre 2019

RESTful-DOOM

1/ Répertoire de travail.

util01@station01:~$ mkdir -p JEUX/DOOMAPI
util01@station01:~$ cd JEUX/DOOMAPI/
util01@station01:~/JEUX/DOOMAPI$

2/ Installation des paquets de base.

util01@station01:~/JEUX/DOOMAPI$ sudo apt-get install build-essential
util01@station01:~/JEUX/DOOMAPI$ sudo apt-get install autotools-dev autoconf
util01@station01:~/JEUX/DOOMAPI$ sudo apt-get install g++ make cmake libsdl2-dev git zlib1g-dev libbz2-dev libjpeg-dev libfluidsynth-dev libgme-dev libopenal-dev libmpg123-dev libsndfile1-dev libgtk-3-dev timidity nasm libgl1-mesa-dev tar libsdl1.2-dev libglew-dev libgtk2.0-dev libfluidsynth-dev libmpg123-dev libsndfile1-dev libgme-dev libglew-dev flex autoconf automake libsdl-sound1.2-dev libsdl1.2-dev libsdl-mixer1.2-dev libsdl-image1.2-dev libsdl-net1.2-dev libphysfs-dev libcurl4-openssl-dev libsdl-sound1.2-dev libsdl1.2-dev libsdl-mixer1.2-dev libsdl-image1.2-dev libsdl-net1.2-dev libsdl2-net-dev curl

3/ Téléchargement du code source.

util01@station01:~/JEUX/DOOMAPI$ git clone https://github.com/jeff-1amstudios/restful-doom.git

4/ Configuration et installation.

util01@station01:~/JEUX/DOOMAPI$ cd restful-doom/
util01@station01:~/JEUX/DOOMAPI/restful-doom$ ./configure-and-build.sh

5/ Vérification.

util01@station01:~/JEUX/DOOMAPI/restful-doom$ ls -l src/restful-doom
-rwxrwxr-x 1 util01 util01 3489232 déc. 16 20:05 src/restful-doom
util01@station01:~/JEUX/DOOMAPI/restful-doom$

6/ Configuration de Doom.

util01@station01:~/JEUX/DOOMAPI/restful-doom$ src/restful-doom-setup

7/ Lancement.

util01@station01:~/JEUX/DOOMAPI/restful-doom$ src/restful-doom -iwad ../../WAD/doom2.wad -apiport 6666

8/ Requête : Changement de niveau.

util01@station01:~$ curl -s -X PATCH localhost:6666/api/world -d '{"map": 1,"episode":1}'
{
"episode": 1,
"map": 1,
"lights": "on"
}
util01@station01:~$

9/ Requête : Ajout d’un objet.

util01@station01:~$ curl -s X POST localhost:6666/api/world/objects -d '{"type": "Barrel", "distance": 300 }'
{
"id": 90,
"position": {
"x": 1055.885498,
"y": -3316.004639,
"z": 158
},
"angle": 0,
"height": 42,
"health": 20,
"typeId": 2035,
"type": "Barrel",
"flags": {
"MF_SOLID": true,
"MF_SHOOTABLE": true,
"MF_NOBLOOD": true
}
}
util01@station01:~$

10/ Liens.

https://github.com/jeff-1amstudios/restful-doom
http://1amstudios.com/2017/08/01/restful-doom/