diff --git a/papers/multiplayer.md b/papers/multiplayer.md index 96012e4d1..5f87bdba4 100644 --- a/papers/multiplayer.md +++ b/papers/multiplayer.md @@ -29,13 +29,13 @@ two usernames are reserved: some characters are not allowed in usernames: 0x00-0x1f, `@`, 0x7f-0x9f, 0xd800-0xdfff, 0xfeff, 0xfffe and 0xffff. # header - +``` size | description -----|------------------------------------ 3 | "fur" header 1 | packet type 4 | sequence number - +``` the sequence number always starts at 0. # client to server packets (init) @@ -48,7 +48,7 @@ if the client does not receive any packets during 30 seconds, it will disconnect likewise, if the server does not receive any packets during 30 seconds, it will disconnect the client. ## 0x01: start connection - +``` size | description -----|------------------------------------ 1 | reason @@ -57,17 +57,17 @@ size | description 3 | padding 4 | client version STR | host name (may be blank) - +``` after sending, you will receive a packet of type 0x01 (information), 0x02 (disconnect) or 0x03 (authenticate). ## 0x02: disconnect - +``` size | description -----|------------------------------------ STR | reason - +``` ## 0x03: auth response - +``` size | description -----|------------------------------------ 1 | type @@ -84,7 +84,7 @@ size | description ??? | password --- | **token response** STR | token - +``` # server to client packets (init) ## 0x00: keep-alive @@ -92,7 +92,7 @@ size | description this packet keeps a connection alive. it is a response to a client's keep-alive packet. ## 0x01: information - +``` size | description -----|------------------------------------ 4 | server version @@ -104,35 +104,35 @@ size | description STR | server name STR | server description STR | project name - +``` the client may send a 0x00 (keep-alive) packet after receiving this one within 5 seconds. connection is then closed. ## 0x02: disconnect - +``` size | description -----|------------------------------------ STR | reason - +``` after being sent, the connection is closed. ## 0x03: authenticate - +``` size | description -----|------------------------------------ 1 | authentication type | - 0: open | - 1: password | - 2: token - +``` ## 0x04: authentication success - +``` size | description -----|------------------------------------ 4 | player ID STR | username CFG | properties - +``` # client to server packets (session) ## 0x10: request project @@ -140,27 +140,27 @@ size | description the client may only send this once every minute. ## 0x11: participate - +``` size | description -----|------------------------------------ 1 | status | - 0: spectate | - 1: join - +``` ## 0x12: send chat message - +``` size | description -----|------------------------------------ STR | message - +``` ## 0x13: send command - +``` size | description -----|------------------------------------ STR | command 2 | number of arguments S?? | arguments - +``` ## 0x14: get player list no other information required. @@ -170,51 +170,51 @@ no other information required. no other information required ## 0x16: project submission information - +``` size | description -----|------------------------------------ 4 | project size 32 | SHA-256 sum of project STR | project name - +``` this is followed by several 0x17 (project data) packets representing a Furnace song. see [format.md](format.md) for more information. ## 0x17: project submission data - +``` size | description -----|------------------------------------ 4 | offset 4 | length ??? | data... - +``` the client will send a packet with project size as offset and 0 as length to indicate end of data. the server subsequently loads the project. # server to client packets (session) ## 0x10: project information - +``` size | description -----|------------------------------------ 4 | project size 32 | SHA-256 sum of project STR | project name - +``` this is followed by several 0x13 (project data) packets representing a Furnace song. see [format.md](format.md) for more information. ## 0x11: project data - +``` size | description -----|------------------------------------ 4 | offset 4 | length ??? | data... - +``` the server will send a packet with project size as offset and 0 as length to indicate end of data. the client subsequently loads the project. ## 0x12: participate status - +``` size | description -----|------------------------------------ 1 | status @@ -222,7 +222,7 @@ size | description | - 1: allowed ## 0x13: message - +``` size | description -----|------------------------------------ 4 | player ID @@ -236,23 +236,23 @@ size | description | - 3: notification, warning | - 4: notification, urgent STR | message - +``` ## 0x14: system message - +``` size | description -----|------------------------------------ STR | message - +``` ## 0x15: chat message edited - +``` size | description -----|------------------------------------ 4 | message ID STR | message | - an empty message means deleted. - +``` ## 0x16: player list - +``` size | description -----|------------------------------------ 2 | number of players @@ -269,42 +269,42 @@ size | description STR | name STR | IP address | - if empty, then server is not disclosing IP addresses. - +``` this is sent after receiving 0x14 (get player list). ## 0x17: project submission request status - +``` size | description -----|------------------------------------ 1 | status | - 0: denied | - 1: allowed - +``` this is sent after a project submission request is accepted. if the status is 1, the client shall submit a project. ## 0x18: project submission complete - +``` size | description -----|------------------------------------ 1 | status | - 0: error | - 1: success STR | additional information - +``` ## 0x19: player joined - +``` size | description -----|------------------------------------ 4 | ID STR | name - +``` ## 0x1a: player left - +``` size | description -----|------------------------------------ 4 | ID - +``` # client to server packets (project) ## 0x20: request orders @@ -328,11 +328,11 @@ size | description ## 0x29: request grooves ## 0x30: alter orders - +``` size | description -----|------------------------------------ 4 | transaction ID - +``` ## 0x31: alter instrument ## 0x32: alter wavetable @@ -378,7 +378,7 @@ size | description ## 0x29: grooves ## 0x30: transaction response - +``` size | description -----|------------------------------------ 1 | status @@ -386,7 +386,7 @@ size | description | - 1: success | - 2: success but request again STR | additional information - +``` # client to server packets (interact) ## 0x40: engine command