Skip to content

Infrastructure

Jakub Kulich edited this page May 5, 2017 · 1 revision

Communication

Note: From GUI view moving cards is only operation that is visible right after doing it. If server responds that operation was illegal then card is moved back to the original place. Example: undo is operation where on the client side only request is sent and response is returned in the form of the moving card/cards.

After operations like moving cards/undo, GUI must be freezed while the respond comes back from the server.

New game

Client sends RegisterGameRequest, server generates UUID and sends it back to the client using RegisterGameResponse

Join game

Client sends JoinGameRequest with UUID of the game. Server checks if game exists, if no then it will be loaded from file. Then server sends multiple responses:

  • GameStateResponse where spectator means if player is spectator or not.
  • multiple UpdatePlayground where index is index of the playground and also there is state of the all decks in playground

Making move

Client sends GameMove to the server, server sends:

  • GameMoveResponse - which states that move was valid or not
  • GameMove - to propagate move to the all connected spectators

Adding playground

Client sends AddPlayground request. Server generates new playground and sends UpdatePlayground response to all connected clients, where index is index of the playground.

Closing playground

Client sends ClosePlayground request. Server closes playground base on the index and propagates this to all clients using ClosePlayground response.

Undo

Client sends UndoRequest, server sends GameMove to the all connected clients

Save

Client sends SaveRequest and server saves game

Load

Client sends LoadRequest, server loads game from file and propagates it to the all connected clients using UpdatePlayground

Hint

Clients sends HintRequest and server responds to the client with HintResponse

Clone this wiki locally