Launching the game
==================

When **launching a game session**, Octopod:Play does the following:

* sends the command defined in ``“templateCmdServer”`` to the Daemon running on the computer selected in the “Server” field, with variables names replaced by they value
* sends the command defined in ``“templateCmdClient”`` to the Daemon on each computer selected for the players, with variables names replaced by they value
* each Daemon that receives a command executes it locally

From this point, Octopod:Play no longer acts on the game session (except in case of issue that requires restarting a player). It waits for requests from the game to know that the session is complete and to receive the score board. The game must implement a way to send these requests.

It is recommended to also implement a system that automatically closes the game when the session is finished, once these requests have been successfully received.

Retrieving the scores (GET)
---------------------------

Scores that have been previously sent for the ongoing session can be retrieved using a GET request.

**URL**: ``{_ip_launcher}/session/{_session}/scores/``

**Reply:**

.. code::json

 {
 	“success”: <bool>,
	“scores”: <string>
 }

Where the “scores” field format is similar to the POST request above.

Ending a session (POST)
-----------------------

Once the game has ended, a request must be sent to **notify the session has ended** . One request per session required. This request is mandatory as it is required for tracking played time. Scores will be available for display only if the session has properly ended.

**Warning**: leave a 2 seconds delay between two requests, and ensure that the request
returned a success before closing the game (retry while not successful).

**URL**:​ ``{_ip-launcher}/session/{_session}/done/``
Reply:

.. code::json

  {
	“success”: <bool>
  }