{
"Action":"gameList",
"Games":[
"Game":{
"id":[gameId],
"nbPlayers":[0|1|2|3|4],
},
"Game":{
...
}
]
}
{
"Action":"createGame"
}
Response from server :
{
"MapList": ["level1", "level2", ...]
}
{
"Action":"joinGame",
"GameId":[id]
}
Responses to join a game (server)
{
"Action":"joinedGame",
"GameId":[id],
"Players":[id, id, ...],
"PlayerId": id,
"Map": "name"
}
{
"Action":"cantJoinGame",
"GameId":[id],
"MoreInfo":["gameFull"|"communicationError"|"gameDoesNotExist"|...]
}
{
"Action":"roleChange",
"RoleId":[id]
}
Responses from server (broadcast)
{
"Action":"roleChange",
"PlayerId":[id],
"RoleId":[id]
}
OSEF
{
"Action":"cantChangeRole",
"MoreInfo":[...]
}
{
"Action":"changeMap",
"Map": "name"
}
Responses from server
{
"Action":"changedMap",
"Map": "name"
}
{
"Action":"startGame"
}
Responses from server
{
"Action":"loadLevel",
"Blocks":[[1,0,4,3,1,1,1,..],[...]],
"Objects":[{xPos:[val],yPos:[val],value:[val]},...],
"Players":[{xPos:0,yPos:0},{xPos:0,yPos:0},{xPos:0,yPos:0},{xPos:0,yPos:0}]
}
{
"Action":"cantStartGame",
"MoreInfo":["Not enough players"|"Dup role"|...]
}
{
"Action":"move",
"Direction":"up|down|left|right"
}
{
"Action":"move",
"PosX":[val],
"PosY":[val],
"Player":[id]
}
{
"Action":"action"
}
Response from server if action allowed (new map status)
{
"Action":"action",
"Changes":[{xPos:[val],yPos:[val],value:[val]},{xPos:[val],yPos:[val],value:[val]}]
}
{
"Action":"win"
}
{
"Action":"nextLevel"
}
Response from server : load level (see "Ask Start game" response)
{
"Action":"leaveGame"
}
Response from server (broadcast)
{
"Action":"leaveGame",
"Player":[id]
}
TODO