Bladeren bron

Added initial versions of schemas for lobby protocol

Ivan Savenko 1 jaar geleden
bovenliggende
commit
ea04a84812

+ 26 - 0
config/schemas/lobbyProtocol/accountCreated.json

@@ -0,0 +1,26 @@
+{
+	"type" : "object",
+	"$schema" : "http://json-schema.org/draft-06/schema",
+	"title" : "Lobby protocol: accountCreated",
+	"description" : "Sent by server when player successfully creates a new account. Note that it does not automatically logs in created account",
+	"required" : [ "type", "accountID", "accountCookie" ],
+	"additionalProperties" : false,
+
+	"properties" : {
+		"type" :
+		{
+			"type" : "string",
+			"const" : "accountCreated"
+		},
+		"accountID" :
+		{
+			"type" : "string",
+			"description" : "Unique ID of account that client must remember for future login attempts"
+		},
+		"accountCookie" :
+		{
+			"type" : "string",
+			"description" : "Private access cookie of account that client must remember for future login attempts"
+		}
+	}
+}

+ 21 - 0
config/schemas/lobbyProtocol/accountJoinsRoom.json

@@ -0,0 +1,21 @@
+{
+	"type" : "object",
+	"$schema" : "http://json-schema.org/draft-06/schema",
+	"title" : "Lobby protocol: accountJoinsRoom",
+	"description" : "Sent by server to match server when new account joins the room",
+	"required" : [ "type", "accountID" ],
+	"additionalProperties" : false,
+
+	"properties" : {
+		"type" :
+		{
+			"type" : "string",
+			"const" : "accountJoinsRoom"
+		},
+		"accountID" :
+		{
+			"type" : "string",
+			"description" : "ID of account that have joined the room"
+		}
+	}
+}

+ 27 - 0
config/schemas/lobbyProtocol/activateGameRoom.json

@@ -0,0 +1,27 @@
+{
+	"type" : "object",
+	"$schema" : "http://json-schema.org/draft-06/schema",
+	"title" : "Lobby protocol: activateGameRoom",
+	"description" : "Sent by client when player wants to activate a game room",
+	"required" : [ "accountID", "accountCookie", "language", "version" ],
+	"additionalProperties" : false,
+
+	"properties" : {
+		"type" :
+		{
+			"type" : "string",
+			"const" : "activateGameRoom"
+		},
+		"hostAccountID" :
+		{
+			"type" : "string",
+			"description" : "Account ID that hosts match server that player wants to activate"
+		},
+		"roomType" :
+		{
+			"type" : "string",
+			"enum" : [ "public", "private" ],
+			"description" : "Room type to use for activation"
+		}
+	}
+}

+ 45 - 0
config/schemas/lobbyProtocol/activeAccounts.json

@@ -0,0 +1,45 @@
+{
+	"type" : "object",
+	"$schema" : "http://json-schema.org/draft-06/schema",
+	"title" : "Lobby protocol: activeAccounts",
+	"description" : "Sent by server to initialized or update list of active accounts",
+	"required" : [ "type", "accounts" ],
+	"additionalProperties" : false,
+
+	"properties" : {
+		"type" :
+		{
+			"type" : "string",
+			"const" : "activeAccounts"
+		},
+		"accounts" :
+		{
+			"type" : "array",
+			"description" : "List of accounts that are currently online"
+			"items" :
+			{
+				"type" : "object",
+				"additionalProperties" : false,
+				"required" : [ "accountID", "displayName", "status" ],
+
+				"properties" : {
+					"accountID" :
+					{
+						"type" : "string",
+						"description" : "Unique ID of an account"
+					},
+					"displayName" :
+					{
+						"type" : "string",
+						"description" : "Display name of an account"
+					},
+					"status" :
+					{
+						"type" : "string",
+						"description" : "Current status of an account, such as in lobby or in match"
+					}
+				}
+			}
+		}
+	}
+}

+ 59 - 0
config/schemas/lobbyProtocol/activeGameRooms.json

@@ -0,0 +1,59 @@
+{
+	"type" : "object",
+	"$schema" : "http://json-schema.org/draft-06/schema",
+	"title" : "Lobby protocol: activeGameRooms",
+	"description" : "Sent by server to initialized or update list of game rooms",
+	"required" : [ "type", "gameRooms" ],
+	"additionalProperties" : false,
+
+	"properties" : {
+		"type" :
+		{
+			"type" : "string",
+			"const" : "activeGameRooms"
+		},
+		"gameRooms" :
+		{
+			"type" : "array",
+			"description" : "List of currently available game rooms"
+			"items" :
+			{
+				"type" : "object",
+				"additionalProperties" : false,
+				"required" : [ "gameRoomID", "hostAccountID", "hostAccountDisplayName", "description", "playersCount", "playersLimit" ],
+				"properties" : {
+					"gameRoomID" :
+					{
+						"type" : "string",
+						"description" : "Unique ID of game room"
+					},
+					"hostAccountID" :
+					{
+						"type" : "string",
+						"description" : "ID of account that created and hosts this game room"
+					},
+					"hostAccountDisplayName" :
+					{
+						"type" : "string",
+						"description" : "Display name of account that created and hosts this game room"
+					},
+					"description" :
+					{
+						"type" : "string",
+						"description" : "Auto-generated description of this room"
+					},
+					"playersCount" :
+					{
+						"type" : "number",
+						"description" : "Current number of players in this room, including host"
+					},
+					"playersLimit" :
+					{
+						"type" : "number",
+						"description" : "Maximum number of players that can join this room, including host"
+					}
+				}
+			}
+		}
+	}
+}

+ 49 - 0
config/schemas/lobbyProtocol/chatHistory.json

@@ -0,0 +1,49 @@
+{
+	"type" : "object",
+	"$schema" : "http://json-schema.org/draft-06/schema",
+	"title" : "Lobby protocol: chatHistory",
+	"description" : "Sent by server immediately after login to fill initial chat history",
+	"required" : [ "type", "messages" ],
+	"additionalProperties" : false,
+
+	"properties" : {
+		"type" :
+		{
+			"type" : "string",
+			"const" : "chatHistory"
+		},
+		"messages" :
+		{
+			"type" : "array",
+			"description" : "List of recent chat messages"
+			"items" :
+			{
+				"type" : "object",
+				"additionalProperties" : false,
+				"required" : [ "messageText", "accountID", "displayName", "ageSeconds" ],
+				"properties" : {
+					"messageText" :
+					{
+						"type" : "string",
+						"description" : "Text of sent message"
+					},
+					"accountID" :
+					{
+						"type" : "string",
+						"description" : "ID of account that have sent this message"
+					},
+					"displayName" :
+					{
+						"type" : "string",
+						"description" : "Display name of account that have sent this message"
+					},
+					"ageSeconds" :
+					{
+						"type" : "number",
+						"description" : "Age of this message in seconds. For example, 10 means that this message was sent 10 seconds ago"
+					}
+				}
+			}
+		}
+	}
+}

+ 38 - 0
config/schemas/lobbyProtocol/chatMessage.json

@@ -0,0 +1,38 @@
+{
+	"type" : "object",
+	"$schema" : "http://json-schema.org/draft-06/schema",
+	"title" : "Lobby protocol: chatMessage",
+	"description" : "Sent by server to all players in lobby whenever new message is sent to game chat",
+	"required" : [ "type", "messageText", "accountID", "displayName", "roomMode", "roomName" ],
+	"additionalProperties" : false,
+
+	"properties" : {
+		"type" :
+		{
+			"type" : "string",
+			"const" : "chatMessage"
+		},
+		"messageText" :
+		{
+			"type" : "string",
+			"description" : "Text of sent message"
+		},
+		"accountID" :
+		{
+			"type" : "string",
+			"description" : "ID of account that have sent this message"
+		},
+		"roomMode" :
+		{
+			"type" : "string",
+			"const" : "general",
+			"description" : "Type of room to which this message has been set. Right now can only be 'general'"
+		},
+		"roomName" :
+		{
+			"type" : "string",
+			"const" : "english",
+			"description" : "Name of room to which this message has been set. Right now only 'english' is used"
+		}
+	}
+}

+ 37 - 0
config/schemas/lobbyProtocol/clientLogin.json

@@ -0,0 +1,37 @@
+{
+	"type" : "object",
+	"$schema" : "http://json-schema.org/draft-06/schema",
+	"title" : "Lobby protocol: clientLogin",
+	"description" : "Sent by client when player requests lobby login",
+
+	"required" : [ "type", "accountID", "accountCookie", "language", "version" ],
+	"additionalProperties" : false,
+
+	"properties" : {
+		"type" :
+		{
+			"type" : "string",
+			"const" : "clientLogin"
+		},
+		"accountID" :
+		{
+			"type" : "string",
+			"description" : "ID of existing account to login with"
+		},
+		"accountCookie" :
+		{
+			"type" : "string",
+			"description" : "Secret UUID for identification"
+		},
+		"language" :
+		{
+			"type" : "string",
+			"description" : "Language of client, see lib/Languages.h for full list"
+		},
+		"version" :
+		{
+			"type" : "string",
+			"description" : "Version of client, e.g. 1.5.0"
+		}
+	}
+}

+ 31 - 0
config/schemas/lobbyProtocol/clientProxyLogin.json

@@ -0,0 +1,31 @@
+{
+	"type" : "object",
+	"$schema" : "http://json-schema.org/draft-06/schema",
+	"title" : "Lobby protocol: clientProxyLogin",
+	"description" : "Sent by client when player attempt to connect to game room in proxy mode",
+	"required" : [ "type", "accountID", "accountCookie", "gameRoomID" ],
+	"additionalProperties" : false,
+
+	"properties" : {
+		"type" :
+		{
+			"type" : "string",
+			"const" : "clientLogin"
+		},
+		"accountID" :
+		{
+			"type" : "string",
+			"description" : "ID of existing account to login with"
+		},
+		"accountCookie" :
+		{
+			"type" : "string",
+			"description" : "Secret UUID for identification"
+		},
+		"gameRoomID" :
+		{
+			"type" : "string",
+			"description" : "ID of game room to connect to"
+		}
+	}
+}

+ 31 - 0
config/schemas/lobbyProtocol/clientRegister.json

@@ -0,0 +1,31 @@
+{
+	"type" : "object",
+	"$schema" : "http://json-schema.org/draft-06/schema",
+	"title" : "Lobby protocol: clientRegister",
+	"description" : "Sent by client when player attempts to create a new account",
+	"required" : [ "type", "displayName", "language", "version" ],
+	"additionalProperties" : false,
+
+	"properties" : {
+		"type" :
+		{
+			"type" : "string",
+			"const" : "clientLogin"
+		},
+		"displayName" :
+		{
+			"type" : "string",
+			"description" : "Desired name of a new account"
+		},
+		"language" :
+		{
+			"type" : "string",
+			"description" : "Language of client, see lib/Languages.h for full list"
+		},
+		"version" :
+		{
+			"type" : "string",
+			"description" : "Version of client, e.g. 1.5.0"
+		}
+	}
+}

+ 21 - 0
config/schemas/lobbyProtocol/declineInvite.json

@@ -0,0 +1,21 @@
+{
+	"type" : "object",
+	"$schema" : "http://json-schema.org/draft-06/schema",
+	"title" : "Lobby protocol: declineInvite",
+	"description" : "Sent by client when player declines invite to join a room",
+	"required" : [ "type", "gameRoomID" ],
+	"additionalProperties" : false,
+
+	"properties" : {
+		"type" :
+		{
+			"type" : "string",
+			"const" : "declineInvite"
+		},
+		"gameRoomID" :
+		{
+			"type" : "string",
+			"description" : "ID of game room to decline invite"
+		}
+	}
+}

+ 26 - 0
config/schemas/lobbyProtocol/inviteReceived.json

@@ -0,0 +1,26 @@
+{
+	"type" : "object",
+	"$schema" : "http://json-schema.org/draft-06/schema",
+	"title" : "Lobby protocol: inviteReceived",
+	"description" : "Sent by server when player receives an invite from another player to join the game room",
+	"required" : [ "type", "accountID", "gameRoomID" ],
+	"additionalProperties" : false,
+
+	"properties" : {
+		"type" :
+		{
+			"type" : "string",
+			"const" : "inviteReceived"
+		},
+		"accountID" :
+		{
+			"type" : "string",
+			"description" : "ID of account that sent an invite"
+		},
+		"gameRoomID" :
+		{
+			"type" : "string",
+			"description" : "ID of game room that this player is now allowed to join"
+		}
+	}
+}

+ 21 - 0
config/schemas/lobbyProtocol/joinGameRoom.json

@@ -0,0 +1,21 @@
+{
+	"type" : "object",
+	"$schema" : "http://json-schema.org/draft-06/schema",
+	"title" : "Lobby protocol: joinGameRoom",
+	"description" : "Sent by client when player attempts to join a game room",
+	"required" : [ "type", "gameRoomID" ],
+	"additionalProperties" : false,
+
+	"properties" : {
+		"type" :
+		{
+			"type" : "string",
+			"const" : "joinGameRoom"
+		},
+		"gameRoomID" :
+		{
+			"type" : "string",
+			"description" : "ID of game room to join"
+		}
+	}
+}

+ 26 - 0
config/schemas/lobbyProtocol/joinRoomSuccess.json

@@ -0,0 +1,26 @@
+{
+	"type" : "object",
+	"$schema" : "http://json-schema.org/draft-06/schema",
+	"title" : "Lobby protocol: joinRoomSuccess",
+	"description" : "Sent by server when player successfully joins the game room",
+	"required" : [ "type", "gameRoomID", "proxyMode" ],
+	"additionalProperties" : false,
+
+	"properties" : {
+		"type" :
+		{
+			"type" : "string",
+			"const" : "joinRoomSuccess"
+		},
+		"gameRoomID" :
+		{
+			"type" : "string",
+			"description" : "ID of game room that this player now participates in"
+		},
+		"proxyMode" :
+		{
+			"type" : "boolean",
+			"description" : "If true, account should use proxy mode and connect to server via game lobby"
+		}
+	}
+}

+ 21 - 0
config/schemas/lobbyProtocol/leaveGameRoom.json

@@ -0,0 +1,21 @@
+{
+	"type" : "object",
+	"$schema" : "http://json-schema.org/draft-06/schema",
+	"title" : "Lobby protocol: leaveGameRoom",
+	"description" : "Sent by server when player disconnects from the game room",
+	"required" : [ "type", "accountID" ],
+	"additionalProperties" : false,
+
+	"properties" : {
+		"type" :
+		{
+			"type" : "string",
+			"const" : "leaveGameRoom"
+		},
+		"accountID" :
+		{
+			"type" : "string",
+			"description" : "ID of account that have left the room"
+		}
+	}
+}

+ 26 - 0
config/schemas/lobbyProtocol/loginSuccess.json

@@ -0,0 +1,26 @@
+{
+	"type" : "object",
+	"$schema" : "http://json-schema.org/draft-06/schema",
+	"title" : "Lobby protocol: loginSuccess",
+	"description" : "Sent by server once player sucesfully logs into the lobby",
+	"required" : [ "type", "accountCookie", "displayName" ],
+	"additionalProperties" : false,
+
+	"properties" : {
+		"type" :
+		{
+			"type" : "string",
+			"const" : "loginSuccess"
+		},
+		"accountCookie" :
+		{
+			"type" : "string",
+			"description" : "Security cookie that should be stored by client and used for future operations"
+		},
+		"displayName" :
+		{
+			"type" : "string",
+			"description" : "Account display name - how client should display this account"
+		}
+	}
+}

+ 21 - 0
config/schemas/lobbyProtocol/operationFailed.json

@@ -0,0 +1,21 @@
+{
+	"type" : "object",
+	"$schema" : "http://json-schema.org/draft-06/schema",
+	"title" : "Lobby protocol: operationFailed",
+	"description" : "Sent by server whenever operation requested by client fails",
+	"required" : [ "type", "reason" ],
+	"additionalProperties" : false,
+
+	"properties" : {
+		"type" :
+		{
+			"type" : "string",
+			"const" : "operationFailed"
+		},
+		"reason" :
+		{
+			"type" : "string",
+			"description" : "Human-readable description of reason behind operation failure, in English"
+		}
+	}
+}

+ 21 - 0
config/schemas/lobbyProtocol/sendChatMessage.json

@@ -0,0 +1,21 @@
+{
+	"type" : "object",
+	"$schema" : "http://json-schema.org/draft-06/schema",
+	"title" : "Lobby protocol: sendChatMessage",
+	"description" : "Sent by client when player requests lobby login",
+	"required" : [ "accountID", "accountCookie", "language", "version" ],
+	"additionalProperties" : false,
+
+	"properties" : {
+		"type" :
+		{
+			"type" : "string",
+			"const" : "sendChatMessage"
+		},
+		"messageText" :
+		{
+			"type" : "string",
+			"description" : "Text of sent message"
+		}
+	}
+}

+ 21 - 0
config/schemas/lobbyProtocol/sendInvite.json

@@ -0,0 +1,21 @@
+{
+	"type" : "object",
+	"$schema" : "http://json-schema.org/draft-06/schema",
+	"title" : "Lobby protocol: sendInvite",
+	"description" : "Sent by client when player invites another player into his current game room",
+	"required" : [ "type", "accountID" ],
+	"additionalProperties" : false,
+
+	"properties" : {
+		"type" :
+		{
+			"type" : "string",
+			"const" : "sendInvite"
+		},
+		"accountID" :
+		{
+			"type" : "string",
+			"description" : "ID of account to invite into the room"
+		}
+	}
+}

+ 37 - 0
config/schemas/lobbyProtocol/serverLogin.json

@@ -0,0 +1,37 @@
+{
+	"type" : "object",
+	"$schema" : "http://json-schema.org/draft-06/schema",
+	"title" : "Lobby protocol: serverLogin",
+	"description" : "Sent by match server when starting up in lobby mode",
+
+	"required" : [ "type", "gameRoomID", "accountID", "accountCookie", "version" ],
+	"additionalProperties" : false,
+
+	"properties" : {
+		"type" :
+		{
+			"type" : "string",
+			"const" : "serverLogin"
+		},
+		"gameRoomID" :
+		{
+			"type" : "string",
+			"description" : "UUID generated by server to represent this game room"
+		},
+		"accountID" :
+		{
+			"type" : "string",
+			"description" : "Account ID of game host"
+		},
+		"accountCookie" :
+		{
+			"type" : "string",
+			"description" : "Security cookie of host account"
+		},
+		"version" :
+		{
+			"type" : "string",
+			"description" : "Version of match server, e.g. 1.5.0"
+		}
+	}
+}

+ 32 - 0
config/schemas/lobbyProtocol/serverProxyLogin.json

@@ -0,0 +1,32 @@
+{
+	"type" : "object",
+	"$schema" : "http://json-schema.org/draft-06/schema",
+	"title" : "Lobby protocol: serverProxyLogin",
+	"description" : "Sent by match server to establish proxy connection to be used by player",
+
+	"required" : [ "type", "gameRoomID", "guestAccountID", "accountCookie" ],
+	"additionalProperties" : false,
+
+	"properties" : {
+		"type" :
+		{
+			"type" : "string",
+			"const" : "serverProxyLogin"
+		},
+		"gameRoomID" :
+		{
+			"type" : "string",
+			"description" : "ID of server game room to login with"
+		},
+		"guestAccountID" :
+		{
+			"type" : "string",
+			"description" : "Account ID of player that should use this connection"
+		},
+		"accountCookie" :
+		{
+			"type" : "string",
+			"description" : "Secret UUID for identification of account that hosts match server"
+		}
+	}
+}