Tutorial

Game creation

Some starter kits are available here

Regarding Swagger documentation, the main endpoint is /fights.

The creation of a game start with a first call to /fights with a POST, with the informations inside the request body :

  • name : name of your game
  • versus : a boolean (default at true === one against one). It details if you fight against the artificial intelligence on the server, or agains another player. This one should join the game.
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ \
   "name": "Ma partie", \
   "versus": true \
 }' 'https://coding-game.swat-sii.fr/api/fights'

The response of the API is a JSON with some informations like :

  • token : game token, use it for all the newt API calls
  • status : status of the game (WAITING, PLAYING or FINISHED)
  • countDown : count down in millisecondes which start when the 2 players join the game : at 0, you can attack !
  • me : informations for your character
  • foe : informations of your opponent
{
  "token": "9nrrx5",
  "status": "WAITING",
  "countDown": null,
  "me": null,
  "foe": null
}

results matching ""

    No results matching ""