| 1 |
# multiplayer protocol |
| 2 |
|
| 3 |
this is a concept! it has not been implemented yet! |
| 4 |
|
| 5 |
the Furnace protocol is described here. |
| 6 |
|
| 7 |
# information |
| 8 |
|
| 9 |
all numbers are little-endian. |
| 10 |
|
| 11 |
the following fields may be found in "size": |
| 12 |
- `f` indicates a floating point number. |
| 13 |
- `STR` is a UTF-8 zero-terminated string. |
| 14 |
- `CFG` is the same as STR, but contains a config. |
| 15 |
- `???` is an array of variable size. |
| 16 |
- `S??` is an array of `STR`s. |
| 17 |
- `1??` is an array of bytes. |
| 18 |
- `2??` is an array of shorts. |
| 19 |
- `4??` is an array of ints. |
| 20 |
|
| 21 |
two player IDs are reserved: |
| 22 |
- 0: system |
| 23 |
- 1: host (console) |
| 24 |
|
| 25 |
two usernames are reserved: |
| 26 |
- SYSTEM |
| 27 |
- HOST |
| 28 |
|
| 29 |
some characters are not allowed in usernames: 0x00-0x1f, `@`, 0x7f-0x9f, 0xd800-0xdfff, 0xfeff, 0xfffe and 0xffff. |
| 30 |
|
| 31 |
# header |
| 32 |
``` |
| 33 |
size | description |
| 34 |
-----|------------------------------------ |
| 35 |
3 | "fur" header |
| 36 |
1 | packet type |
| 37 |
4 | sequence number |
| 38 |
``` |
| 39 |
the sequence number always starts at 0. |
| 40 |
|
| 41 |
# client to server packets (init) |
| 42 |
|
| 43 |
## 0x00: keep-alive |
| 44 |
|
| 45 |
this packet keeps a connection alive. |
| 46 |
the server shall respond with a packet of type 0x00 (keep-alive). |
| 47 |
if the client does not receive any packets during 30 seconds, it will disconnect from the server. |
| 48 |
likewise, if the server does not receive any packets during 30 seconds, it will disconnect the client. |
| 49 |
|
| 50 |
## 0x01: start connection |
| 51 |
``` |
| 52 |
size | description |
| 53 |
-----|------------------------------------ |
| 54 |
1 | reason |
| 55 |
| - 0: information |
| 56 |
| - 1: join |
| 57 |
3 | padding |
| 58 |
4 | client version |
| 59 |
STR | host name (may be blank) |
| 60 |
``` |
| 61 |
after sending, you will receive a packet of type 0x01 (information), 0x02 (disconnect) or 0x03 (authenticate). |
| 62 |
|
| 63 |
## 0x02: disconnect |
| 64 |
``` |
| 65 |
size | description |
| 66 |
-----|------------------------------------ |
| 67 |
STR | reason |
| 68 |
``` |
| 69 |
## 0x03: auth response |
| 70 |
``` |
| 71 |
size | description |
| 72 |
-----|------------------------------------ |
| 73 |
1 | type |
| 74 |
| - 0: open |
| 75 |
| - 1: password |
| 76 |
| - 2: token |
| 77 |
--- | **open response** |
| 78 |
STR | username |
| 79 |
--- | **password response** |
| 80 |
1 | password type |
| 81 |
| - 0: plain text |
| 82 |
| - 1: SHA-512 |
| 83 |
STR | account name |
| 84 |
??? | password |
| 85 |
--- | **token response** |
| 86 |
STR | token |
| 87 |
``` |
| 88 |
# server to client packets (init) |
| 89 |
|
| 90 |
## 0x00: keep-alive |
| 91 |
|
| 92 |
this packet keeps a connection alive. it is a response to a client's keep-alive packet. |
| 93 |
|
| 94 |
## 0x01: information |
| 95 |
``` |
| 96 |
size | description |
| 97 |
-----|------------------------------------ |
| 98 |
4 | server version |
| 99 |
2 | online players |
| 100 |
| - if it is 65535, this information is concealed. |
| 101 |
2 | maximum players |
| 102 |
| - 0 means unlimited. |
| 103 |
STR | server version (string) |
| 104 |
STR | server name |
| 105 |
STR | server description |
| 106 |
STR | project name |
| 107 |
``` |
| 108 |
the client may send a 0x00 (keep-alive) packet after receiving this one within 5 seconds. |
| 109 |
connection is then closed. |
| 110 |
|
| 111 |
## 0x02: disconnect |
| 112 |
``` |
| 113 |
size | description |
| 114 |
-----|------------------------------------ |
| 115 |
STR | reason |
| 116 |
``` |
| 117 |
after being sent, the connection is closed. |
| 118 |
|
| 119 |
## 0x03: authenticate |
| 120 |
``` |
| 121 |
size | description |
| 122 |
-----|------------------------------------ |
| 123 |
1 | authentication type |
| 124 |
| - 0: open |
| 125 |
| - 1: password |
| 126 |
| - 2: token |
| 127 |
``` |
| 128 |
## 0x04: authentication success |
| 129 |
``` |
| 130 |
size | description |
| 131 |
-----|------------------------------------ |
| 132 |
4 | player ID |
| 133 |
STR | username |
| 134 |
CFG | properties |
| 135 |
``` |
| 136 |
# client to server packets (session) |
| 137 |
|
| 138 |
## 0x10: request project |
| 139 |
|
| 140 |
the client may only send this once every minute. |
| 141 |
|
| 142 |
## 0x11: participate |
| 143 |
``` |
| 144 |
size | description |
| 145 |
-----|------------------------------------ |
| 146 |
1 | status |
| 147 |
| - 0: spectate |
| 148 |
| - 1: join |
| 149 |
``` |
| 150 |
## 0x12: send chat message |
| 151 |
``` |
| 152 |
size | description |
| 153 |
-----|------------------------------------ |
| 154 |
STR | message |
| 155 |
``` |
| 156 |
## 0x13: send command |
| 157 |
``` |
| 158 |
size | description |
| 159 |
-----|------------------------------------ |
| 160 |
STR | command |
| 161 |
2 | number of arguments |
| 162 |
S?? | arguments |
| 163 |
``` |
| 164 |
## 0x14: get player list |
| 165 |
|
| 166 |
no other information required. |
| 167 |
|
| 168 |
## 0x15: project submission request |
| 169 |
|
| 170 |
no other information required |
| 171 |
|
| 172 |
## 0x16: project submission information |
| 173 |
``` |
| 174 |
size | description |
| 175 |
-----|------------------------------------ |
| 176 |
4 | project size |
| 177 |
32 | SHA-256 sum of project |
| 178 |
STR | project name |
| 179 |
``` |
| 180 |
this is followed by several 0x17 (project data) packets representing a Furnace song. see [format.md](format.md) for more information. |
| 181 |
|
| 182 |
## 0x17: project submission data |
| 183 |
``` |
| 184 |
size | description |
| 185 |
-----|------------------------------------ |
| 186 |
4 | offset |
| 187 |
4 | length |
| 188 |
??? | data... |
| 189 |
``` |
| 190 |
the client will send a packet with project size as offset and 0 as length to indicate end of data. |
| 191 |
the server subsequently loads the project. |
| 192 |
|
| 193 |
# server to client packets (session) |
| 194 |
|
| 195 |
## 0x10: project information |
| 196 |
``` |
| 197 |
size | description |
| 198 |
-----|------------------------------------ |
| 199 |
4 | project size |
| 200 |
32 | SHA-256 sum of project |
| 201 |
STR | project name |
| 202 |
``` |
| 203 |
this is followed by several 0x13 (project data) packets representing a Furnace song. see [format.md](format.md) for more information. |
| 204 |
|
| 205 |
## 0x11: project data |
| 206 |
``` |
| 207 |
size | description |
| 208 |
-----|------------------------------------ |
| 209 |
4 | offset |
| 210 |
4 | length |
| 211 |
??? | data... |
| 212 |
``` |
| 213 |
the server will send a packet with project size as offset and 0 as length to indicate end of data. |
| 214 |
the client subsequently loads the project. |
| 215 |
|
| 216 |
## 0x12: participate status |
| 217 |
``` |
| 218 |
size | description |
| 219 |
-----|------------------------------------ |
| 220 |
1 | status |
| 221 |
| - 0: denied |
| 222 |
| - 1: allowed |
| 223 |
``` |
| 224 |
## 0x13: message |
| 225 |
``` |
| 226 |
size | description |
| 227 |
-----|------------------------------------ |
| 228 |
4 | player ID |
| 229 |
8 | time (seconds) |
| 230 |
4 | time (nanoseconds) |
| 231 |
4 | message ID |
| 232 |
1 | type |
| 233 |
| - 0: chat, public |
| 234 |
| - 1: chat, private |
| 235 |
| - 2: notification, info |
| 236 |
| - 3: notification, warning |
| 237 |
| - 4: notification, urgent |
| 238 |
STR | message |
| 239 |
``` |
| 240 |
## 0x14: system message |
| 241 |
``` |
| 242 |
size | description |
| 243 |
-----|------------------------------------ |
| 244 |
STR | message |
| 245 |
``` |
| 246 |
## 0x15: chat message edited |
| 247 |
``` |
| 248 |
size | description |
| 249 |
-----|------------------------------------ |
| 250 |
4 | message ID |
| 251 |
STR | message |
| 252 |
| - an empty message means deleted. |
| 253 |
``` |
| 254 |
## 0x16: player list |
| 255 |
``` |
| 256 |
size | description |
| 257 |
-----|------------------------------------ |
| 258 |
2 | number of players |
| 259 |
--- | **player entry** (×players) |
| 260 |
4 | ID |
| 261 |
2 | latency (ms) |
| 262 |
1 | participating? |
| 263 |
| - 0: no |
| 264 |
| - 1: yes |
| 265 |
1 | status |
| 266 |
| - 0: normal |
| 267 |
| - 1: away |
| 268 |
| - 2: busy |
| 269 |
STR | name |
| 270 |
STR | IP address |
| 271 |
| - if empty, then server is not disclosing IP addresses. |
| 272 |
``` |
| 273 |
this is sent after receiving 0x14 (get player list). |
| 274 |
|
| 275 |
## 0x17: project submission request status |
| 276 |
``` |
| 277 |
size | description |
| 278 |
-----|------------------------------------ |
| 279 |
1 | status |
| 280 |
| - 0: denied |
| 281 |
| - 1: allowed |
| 282 |
``` |
| 283 |
this is sent after a project submission request is accepted. |
| 284 |
if the status is 1, the client shall submit a project. |
| 285 |
|
| 286 |
## 0x18: project submission complete |
| 287 |
``` |
| 288 |
size | description |
| 289 |
-----|------------------------------------ |
| 290 |
1 | status |
| 291 |
| - 0: error |
| 292 |
| - 1: success |
| 293 |
STR | additional information |
| 294 |
``` |
| 295 |
## 0x19: player joined |
| 296 |
``` |
| 297 |
size | description |
| 298 |
-----|------------------------------------ |
| 299 |
4 | ID |
| 300 |
STR | name |
| 301 |
``` |
| 302 |
## 0x1a: player left |
| 303 |
``` |
| 304 |
size | description |
| 305 |
-----|------------------------------------ |
| 306 |
4 | ID |
| 307 |
``` |
| 308 |
# client to server packets (project) |
| 309 |
|
| 310 |
## 0x20: request orders |
| 311 |
|
| 312 |
## 0x21: request instrument |
| 313 |
|
| 314 |
## 0x22: request wavetable |
| 315 |
|
| 316 |
## 0x23: request sample |
| 317 |
|
| 318 |
## 0x24: request patterns |
| 319 |
|
| 320 |
## 0x25: request sub-song |
| 321 |
|
| 322 |
## 0x26: request song info |
| 323 |
|
| 324 |
## 0x27: request asset list |
| 325 |
|
| 326 |
## 0x28: request patchbay |
| 327 |
|
| 328 |
## 0x29: request grooves |
| 329 |
|
| 330 |
## 0x30: alter orders |
| 331 |
``` |
| 332 |
size | description |
| 333 |
-----|------------------------------------ |
| 334 |
4 | transaction ID |
| 335 |
``` |
| 336 |
## 0x31: alter instrument |
| 337 |
|
| 338 |
## 0x32: alter wavetable |
| 339 |
|
| 340 |
## 0x33: alter sample |
| 341 |
|
| 342 |
## 0x34: alter pattern |
| 343 |
|
| 344 |
## 0x35: alter sub-song |
| 345 |
|
| 346 |
## 0x36: alter song info |
| 347 |
|
| 348 |
## 0x37: alter asset list |
| 349 |
|
| 350 |
## 0x38: alter patchbay |
| 351 |
|
| 352 |
## 0x39: alter grooves |
| 353 |
|
| 354 |
## 0x3a: alter chips |
| 355 |
|
| 356 |
## 0x3b: alter chip settings |
| 357 |
|
| 358 |
# server to client packets (project) |
| 359 |
|
| 360 |
## 0x20: orders |
| 361 |
|
| 362 |
## 0x21: instrument |
| 363 |
|
| 364 |
## 0x22: wavetable |
| 365 |
|
| 366 |
## 0x23: sample |
| 367 |
|
| 368 |
## 0x24: pattern |
| 369 |
|
| 370 |
## 0x25: sub-song |
| 371 |
|
| 372 |
## 0x26: song info |
| 373 |
|
| 374 |
## 0x27: asset list |
| 375 |
|
| 376 |
## 0x28: patchbay |
| 377 |
|
| 378 |
## 0x29: grooves |
| 379 |
|
| 380 |
## 0x30: transaction response |
| 381 |
``` |
| 382 |
size | description |
| 383 |
-----|------------------------------------ |
| 384 |
1 | status |
| 385 |
| - 0: error |
| 386 |
| - 1: success |
| 387 |
| - 2: success but request again |
| 388 |
STR | additional information |
| 389 |
``` |
| 390 |
# client to server packets (interact) |
| 391 |
|
| 392 |
## 0x40: engine command |
| 393 |
|
| 394 |
## 0x41: playback |
| 395 |
|
| 396 |
# server to client packets (interact) |
| 397 |
|
| 398 |
## 0x40: engine command |
| 399 |
|
| 400 |
## 0x41: playback |
| 401 |
|
| 402 |
# client to server packets (extension) |
| 403 |
|
| 404 |
# server to client packets (extension) |