Stepmania Protocol¶
Introduction¶
Stepmania use his own protocol SMLan. It’s composed of 3 parts.
Size|Command|Payload
- Size: size of packets.
- Command: Command to use
- Payload: data which depend of the command used.
Size type:
- MSN: Most signifiant 4 bits. Eg. 11110000 -> 1111 represents the 4 most signifiant bits (15 in decimal)
- LSN: Least signifiant 4 bits. EG. 00001111 -> 1111 represents the 4 least signifiant bits (15 in decimal)
- NT: Null terminating string.
- X: Integer store in X bytes.
The protocol is implemented in smserver.smutils.smpacket module
SMClient Packet¶
002: Hello¶
This is the first packet from a client to server. It introduce the client to the server.
Payload:
| Size | Description |
|---|---|
| 1 | Client protocol version |
| NT | Name of the stepmania build |
003: Game Start Request¶
This command is called once after most loading is done, and again immediately before the sound starts.
Payload:
| Size | Description |
|---|---|
| MSN | Primary player difficulty (feet) (0 for no player) |
| LSN | Secondary player difficulty (feet) (0 for no player) |
| MSN | Primary player difficulty (0=Beginner, 1=easy, etc.) |
| LSN | Second player difficulty (0=Beginner, 1=easy, etc.) |
| MSN | Start Position (0 is pre-sync, 1 is for sync) |
| LSN | Reserved |
| NT | Song Title |
| NT | Song Subtitle |
| NT | Song Artist |
| NT | Course Title (If none exists; make it just a null) |
| NT | Song Options (in string-format) |
| NT | Primary Player’s options (Null if non-existant) |
| NT | Secondary Player’s Options (Null if non-existant) |
005: Game Status update¶
Updates game info for each step
| Size | Description |
|---|---|
| MSN | Player # |
| LSN | StepID:
|
| MSN | Projected Grade (StepMania enum int) |
| LSN | Reserved |
| 4 | Net-order long containing score. |
| 2 | Net-order int containing combo. |
| 2 | Net-order int containing health. |
| 2 | Net-order # containing offset. 32767 would be DEAD on the note. If the user is hitting late, the # will be higher. It if the user is exactly 0.25 seconds off, the number will be different by 500, if 0.5, it will be different by 1000.) |
006: Style Update¶
This is sent when a profile is choosed. It also indicates the number of players in the local client. (1 or 2)
Payload:
| Size | Description |
|---|---|
| 1 | Number of players in the client (1 or 2) |
| 1 | Player id. (0 or 1) |
| NT | Player name for this id |
007: Chat message¶
Sent when a user type a message on the general chat
Payload:
| Size | Description |
|---|---|
| NT | Message |
008: Request Start Game and Tell server existance/non existance of song.¶
The user selected a song on a Net-enabled selection
Payload:
| Size | Description |
|---|---|
| 1 | Usage of message
|
| NT | Song Title (As gotten by GetTranslitMainTitle) |
| NT | Song Artist (As Gotten by GetTranslitArtist) |
| NT | Song Subtitle (As gotten by GetTranslitSubTitle) |
010: User status¶
Indicate where the user is.
Payload:
| Size | Description |
|---|---|
| 1 | Indicate where the user is:
|
011: User has changed player options¶
Payload:
| Size | Description |
|---|---|
| NT | Player 0’s options |
| NT | Player 1’s options |
012: SMOnline Packet¶
Use to send custom SMO client packet.
Payload:
| Size | Description |
|---|---|
| SMOPacket | A SMO packet (Command + SMO payload). |
015: XMLPacket¶
This packet contains XML data. Don’t know yet when it is used.
Payload:
| Size | Description |
|---|---|
| NT | XML Data |
SMServer Packet¶
The command start at 128 for server response.
130: Hello¶
This command introduces the server. (In response of Client Hello command)
Payload:
| Size | Description |
|---|---|
| 1 | Server protocol version (128 for SMOnline server) |
| NT | Server name |
| 4 | Random key (at the moment only used for hash password on login) |
132: Game Over Stats¶
This packet is send in response to the game over packet. It contains information regarding how well each player did.
Payload:
| Size | Description |
|---|---|
| 1 | NB of players sent in this packet. This determine the lenght of all the list send after |
|
|
| 4..4 | Player’s scores |
| 1..1 | Player’s grades:
|
| 1..1 | Player’s difficulties:
|
| 2..2 | NB of Player’s flawless |
| 2..2 | NB of Player’s perfect |
| 2..2 | NB of Player’s great |
| 2..2 | NB of Player’s good |
| 2..2 | NB of Player’s boo |
| 2..2 | NB of Player’s miss |
| 2..2 | NB of Player’s held |
| 2..2 | NB of Player’s max_combo |
| NT..NT | Player’s Options |
133: Scoreboard update¶
This will update the client’s scoreboard.
Payload:
| Size | Description |
|---|---|
| 1 | Which section to update in the scoreboard
|
| 1 | NB of players sent in this packet. This determine the lenght of all the list send after |
| 1..1 | If usage is names: List of player’s index (determine by the NSCUUL packet) |
| 2..2 | If usage is combos: List of player’s combo |
| 1..1 | If usage is grades: List of player’s grades |
135: Chat message¶
Add a chat message to the chat window on some StepMania screens.
Payload:
| Size | Description |
|---|---|
| NT | Message |
136: Request Start Game¶
Tell client to start song/ask if client has song
Payload:
| Size | Description |
|---|---|
| 1 | Usage of message
|
| NT | Song Title (As gotten by GetTranslitMainTitle) |
| NT | Song Artist (As Gotten by GetTranslitArtist) |
| NT | Song Subtitle (As gotten by GetTranslitSubTitle) |
137: Update User List¶
This sends all the users currently connected
Pay attention of the user’s order in this packet. The index of each user will server for NSCGON and NSCGSU packet.
| Size | Description |
|---|---|
| 1 | Number max of player’s allowed |
| 1 | NB of players sent in this packet. This determine the lenght of all the list send after |
| 1 | First player’s status
|
| NT | First player’s name |
| ... | |
| 1 | Last player’s status |
| NT | Last player’s name |
138: Change to Select Music Screen¶
Force change to Networking select music screen.
Payload:
| Size | Description |
|---|---|
| NT | Set specified gametype |
| NT | Set specified style |
140: SMOnline Packet¶
The SMLan packet 140 is a wrapper for the SMOnline packet.
Payload:
| Size | Description |
|---|---|
| SMOPacket | A SMO packet (Command + SMO payload). |
141: Formatted information packet¶
Send formatted information regarding the server back to the player.
Payload:
| Size | Description |
|---|---|
| NT | Server Name |
| 2 | Port the server is listening on |
| 2 | Number of players connected |
142: Attack Client¶
Payload:
| Size | Description |
|---|---|
| 1 | Player # (0 or 1) |
| 4 | Time to last (in ms) |
| NT | Text describing modifiers |
143: XMLPacket¶
This packet contains XML data. Don’t know yet when it is used.
Payload:
| Size | Description |
|---|---|
| NT | XML Data |