-
Notifications
You must be signed in to change notification settings - Fork 1
Communication Protocol
The following document showcase the design of the communication protocol used for the CardGames project.
Class used to transfer data across the network.
Type | Member | Description |
---|---|---|
string | Name | The name of the emitter |
PacketType | type | The real type of Data |
Object | Data | The Object which contains the transmission data which can be of the following types: EnvCall, SysCall, ErrCall, GameCall. Each of these objects contains a Type (also called Action or Command) and an associated object. These Types are defined in appropriates enum defined below |
bool | Registration | This boolean must be set to true only if the type is PacketType.SYS and the data's command is of value SysCommand.C_REGISTER |
uint | Key | The locker key |
Enum for the ENV part of the communication protocol. (Must be attached to an EnvCall object)
Communication direction: Server => Client.
Give to the client the scores for the two teams.
The object associated with the command must a List of integer of size 2
Communication direction: Server => Client.
Give to the client the remaining time before the end of the round.
The object associated with the command must a System.Int32
Communication direction: Server => Client.
Give to the client the information about the teams' composition.
The object associated with the command must a Dictionary which link a player name with its team number
Communication direction: Server => Client.
Give to the clients the name of the current player.
The object associated to the command must be a System.String
Communication direction: Server => Client.
Give to the client the list of connected users
The object associated with the command must a List of string of size 1 to 4
Enum for the ERROR part of the communication protocol.
Communication direction: Server => Client.
Inform the client that the server has received a bad argument on one of the client's request.
The object associated with the command must be null
Communication direction: Server => Client.
Inform the client that he broke a rule by one of its action.
The object associated with the command must be null
Communication direction: Server => Client.
Inform the client that the action he did was not allowed.
The object associated with the command must be null
Communication direction: Server => Client.
Inform the client that the card he played was not valid.
The object associated with the command must be null
Communication direction: Server => Client.
Inform the client that he can't register to the server because it has no remaining slot.
The object associated with the command must be null
Communication direction: Server => Client.
Inform the client that an unexpected error has been thrown on the server.
The object associated with the command must be null
Enum for the GAME part of the communication protocol.
Communication direction: Client => Server.
Inform the server that the client want to play a specific CardGameResources.Game.Card of its CardGameResources.Game.Deck.
The object associated to the command must be a CardGameResources.Game.Card
Communication direction: Client => Server.
This is the answer to the first lap of the trump phase.
The client uses this command to inform if want (or not) to take the trump.
The object associated with the command must be a System.Boolean
Communication direction: Client => Server.
This is the answer to the second lap of the trump phase.
The client uses this command to inform if want (or not) to take the trump as the color of its choice.
The object associated with the command must be a System.String (either empty or with the name of the wanted color)
Communication direction: Server => Client.
The server uses this command to ask if a client wants to take the trump or not.
Following the lap number (1 or 2), the answer might be either GameAction.C_TAKE_TRUMP or GameAction.C_TAKE_TRUMP_AS.
The object associated with the command must be a KeyValuePair(int, string) where the key is the lap number and the string the player targeted.
Communication direction: Server => Client.
The server use this command to send the updated board CardGameResources.Game.Deck.
The object associated to the command must be a CardGameResources.Game.Deck.
Communication direction: Server => Client.
The server uses this command to send the updated CardGameResources.Game.Deck for the last played round.
The object associated with the command must be a Dictionary(string, Card) of size 4 where each key represents the name of the player which play the card in Value.
Communication direction: Server => Client.
The server uses this command to send the information about the trump to clients.
The object associated to the command must be a CardGameResources.Game.TrumpInfos
Communication direction: Server => Client.
The server use this command to send the updated user CardGameResources.Game.Deck to the client.
The object associated to the command must be a CardGameResources.Game.Deck.
Enum for the SYS part of the communication protocol.
Communication direction: Client => Server.
Request a registration to the server from a client.
This command must be called only once by game.
The object associated with the command must be null.
Communication direction: Client => Server.
Request a registration to the server from a client.
This command must be called only once by game.
The object associated with the command must be null.
Communication direction: Server => Clien
Inform the client that he has been disconnected from the server.
The object associated with the command must be null.
Communication direction: Client => Server.
Inform the client that a client is about to be ejected from the server.
The object associated with the command must be the name of a client.
Communication direction: Server => Client.
Inform the client that the game has ended.
The object associated with the command must be null.
Communication direction: Client => Server.
Indicate to the server that you have successfully received a message. It also unlocks the next action for the server.
You must send this request less than one second after you received the server message with the same key.
The key of the Packet must match the Locker key you want to unlock.
The object associated with the command must be null.
Communication direction: Server => Client.
Inform the client that the game has begun.
The object associated with the command must be null.