Skip to content

Latest commit

 

History

History
200 lines (133 loc) · 3.7 KB

TCP_PROTOCOL.md

File metadata and controls

200 lines (133 loc) · 3.7 KB

TCP Protocol Documentation

Table of contents

Lobby Management


Create Lobby:

Request from client:

Ask to server to create a new Lobby instance. If it succeed, server return the Lobby code.

    LOBBY CREATE;
    €

Response from server:

Tell to the client action succeed or not with additional infos.


Succeed:

    LOBBY CREATE SUCCEED [CODE];
    €

Where [CODE] is replaced with the unique code of the Lobby


Failed:

    LOBBY CREATE FAILED;
    €

Join Lobby:

Request from the client:

Ask server to join Lobby with code.

    LOBBY JOIN [CODE] [PLAYER_NAME];
    €

Where [CODE] is replaced with the unique code of the Lobby,

[PLAYER_COUNT] is replaced by the number of player in the Lobby

Response from the server:

Tell to the client action succeed or not.


Succeed:

    LOBBY JOIN SUCCEED;
    €

Failed:

    LOBBY JOIN FAILED;
    €

Info Lobby:

Request from the client:

Ask for server to send updated Lobby infos.

    LOBBY INFO [CODE];
    €

Where [CODE] is replaced with the unique code of the Lobby.

Response from the server:

Tell to client the updated Lobby infos.

    LOBBY INFO [CODE] [PLAYER_COUNT];
    LOBBY PLAYERS;
    [PLAYER_NAME] [PLAYER_READY_STATUS];
    €

Where [CODE] is replaced with the unique code of the Lobby,

[PLAYER_COUNT] is replaced by the number of player in the Lobby, and

[PLAYER_NAME] is replaced by the name of the player in the Lobby and [PLAYER_READY_STATUS] is replaced by TRUE or FALSE


Set player ready:

Ask for server to set player ready in the Lobby.

    LOBBY READY [CODE] [PLAYER_NAME];
    €

Where [CODE] is replaced with the unique code of the Lobby, and

[PLAYER_NAME] is replaced by the name of the current player.


Server will send to each client an Info Response.


Start the game:

Request from the client:

Ask for server to start the game of the Lobby. It it succeed, server gonna send a Start Response to all client of the lobby, otherwise nothing append.

    LOBBY START [CODE];
    €

Response from server:

Tell to the client to switch to Game Mode. Server will send only one time a game this response.

    LOBBY START [PORT];
    €



Level Infos Management

Map Shape:

Response from the server:

Update Map Shape.

    LEVEL MAP SHAPE [MAP_ID];
    €

Map Position:

Response from the server:

Update Map Position.

    LEVEL MAP POSITION [POS_X];
    €