The USC Multiplayer server uses JSON packets with topics.
Each packet consists of a serialized JSON object with a topic field. This topic field will direct the packet to the correct subscriber.
This documentation lists defined topics for both the server and the client as well as their fields and other information.
To see how to JSON send packets over the network see tcp_protocol.md
These are the packets a client can send to the server
Unathenticated users can only send user.auth
Start the game, triggers a 6 second countdown
Change the room's host
| Field | Type | Label | Description |
| host | string | required | The UUID of the user to make host |
Leave the current room
Toggle host rotation for the room
Tell the server the user's final score
| Field | Type | Label | Description |
| score | int32 | required | The user's final score at the end of the game |
| combo | int32 | required | The user's max combo during the game |
| clear | int32 | required | The user's clear status for the game |
Tell the server user's current score
| Field | Type | Label | Description |
| time | int32 | required | The map time for the last score tick |
| score | int32 | required | The current score at the chosen score tick |
Select a song as host
Future: This will be changing to better find songs
| Field | Type | Label | Description |
| song | string | required | The folder name of the selected song |
| diff | int32 | required | The index of the chosen difficulty |
| level | int32 | required | The level of the chosen difficulty |
| hash | string | required | Selective hash of the song file (0x8000 bytes) *Deprecated |
| audio_hash | string | required | Selective hash of the song file (0x8000 bytes) *Deprecated |
| chart_hash | string | required | Normalized hash of chart file (see USC for more details) |
Have the server send the lobby status. Responds with room.update
Join a room by a given UUID. Responds with server.room.join
| Field | Type | Label | Description |
| id | string | optional | UUID of the room to join |
| password | string | optional | Password for the string if has one |
| token | string | optional | Use a token instead of and id and password to join a room |
Create a new room and join the user as the host
| Field | Type | Label | Description |
| name | string | required | Name for the room |
| password | string | optional | Password for the room |
Have the server send the client the list of rooms. Responds with server.rooms
Authenticate the user. Responds with server.rooms
| Field | Type | Label | Description |
| password | string | required | Password to authenticate with Future: This will be moved to a digest system |
| name | string | required | The display name for the user |
| version | string | required | Current version of the client |
Attach or update a string of extra data to your user
| Field | Type | Label | Description |
| data | string | required | The data too attach. The specific format of this data is user defined |
Toggle the excessive rate for the user
Toggle the mirror option for the user
Tell the server the client could not find the map
Toggle the user's ready state
Select which level the user is playing
| Field | Type | Label | Description |
| level | int32 | required | The level to play |
Tell the server that the client is ready sync