Skip to content
Snippets Groups Projects
Verified Commit cafeb182 authored by Jonas Zohren's avatar Jonas Zohren :speech_balloon:
Browse files

Update errorcodes + protocol docs from hackatron server repo

parent 2b374998
No related branches found
No related tags found
No related merge requests found
...@@ -3,62 +3,59 @@ ...@@ -3,62 +3,59 @@
Sometimes you will get error codes from the server. Sometimes you will get error codes from the server.
Here is a small documentation of those error codes. Here is a small documentation of those error codes.
## ERROR_SPAM ## ERROR_RATELIMIT
You are spamming the server. You sent to many packets per second.
## ERROR_PACKET_OVERFLOW ## ERROR_PACKET_OVERFLOW
You are sending more than 1024 bytes to the server. Your packet was larger than 1024 bytes.
## ERROR_NO_MOVE ## ERROR_NO_MOVE
You didnt send a move packet. You didn't send a move packet.
## ERROR_MAX_CONNECTIONS ## ERROR_MAX_CONNECTIONS
Your ip is already connected. IPv6 may workarounds this but please dont flood the server with connections :( Your ip is already connected.
## ERROR_JOIN_TIMEOUT ## ERROR_JOIN_TIMEOUT
You didnt send the join packet. You didn't send the join packet.
## ERROR_EXPECTED_JOIN ## ERROR_JOIN_EXPECTED
Instead of join you sent some other packet. Your first packet was not a join.
## ERROR_INVALID_USERNAME ## ERROR_USERNAME_INVALID
You used an invalid username. (e.g. not a string) You used an invalid username.
## ERROR_USERNAME_FORBIDDEN
You used a forbidden username.
## ERROR_USERNAME_TOO_SHORT ## ERROR_USERNAME_TOO_SHORT
Username is too short. Your Username is too short.
## ERROR_USERNAME_TOO_LONG ## ERROR_USERNAME_TOO_LONG
Username is too long. Your Username is too long.
## ERROR_USERNAME_INVALID_SYMBOLS
You used invalid symbols for the username.
## ERROR_INVALID_PASSWORD ## ERROR_PASSWORD_INVALID
You used an invalid password. (e.g. not a string) You used an invalid password.
## ERROR_PASSWORD_TOO_SHORT ## ERROR_PASSWORD_TOO_SHORT
Password is too short. Your Password is too short.
## ERROR_PASSWORD_TOO_LONG ## ERROR_PASSWORD_TOO_LONG
Password is too long. Your Password is too long.
## ERROR_NO_PERMISSION ## ERROR_NO_PERMISSION
You should not do this :^) (e.g. hijack bots) You don't have permission to do this.
## ERROR_WRONG_PASSWORD ## ERROR_WRONG_PASSWORD
Your password was wrong. Your password is wrong.
## ERROR_ALREADY_CONNECTED ## ERROR_ALREADY_CONNECTED
You are already connected with this player. You are already connected with this player.
## ERROR_ILLEGAL_MOVE
You tried to do something illegal :O
## WARNING_UNKNOWN_MOVE ## WARNING_UNKNOWN_MOVE
You did not send a valid move packet. You did not send a valid move packet.
## ERROR_DEAD_CANNOT_CHAT
You are dead so shush :^)
## ERROR_INVALID_CHAT_MESSAGE
Something is wrong with your chat message.
## ERROR_UNKNOWN_PACKET ## ERROR_UNKNOWN_PACKET
Server does not know what you want :D You sent an unknown command.
# Protocol # Protocol
The protocol is string based. The protocol is string based.
Every packet will end with a newline (\n), but the Hackathon wrapper handles them for you. Every packet must and will end with a newline (\n).
E.g: `pos|10|50|5` E.g: `pos|10|50|5\n`
**Note:** _All next examples in this documentation are given without \n. But dont forget it in your parsing!_
## Packet structure ## Packet structure
...@@ -21,7 +22,6 @@ motd means "Message of the day". ...@@ -21,7 +22,6 @@ motd means "Message of the day".
**Name:** motd **Name:** motd
**Sender:** Server **Sender:** Server
**Arguments:** **Arguments:**
| # | Type | Description | | # | Type | Description |
|---|--------|------------------------| |---|--------|------------------------|
| 1 | String | The message of the day | | 1 | String | The message of the day |
...@@ -36,7 +36,6 @@ Remember the password otherwise you cant use the username again! ...@@ -36,7 +36,6 @@ Remember the password otherwise you cant use the username again!
**Name:** join **Name:** join
**Sender:** Client **Sender:** Client
**Arguments:** **Arguments:**
| # | Type | Description | | # | Type | Description |
|---|--------|--------------| |---|--------|--------------|
| 1 | String | The username | | 1 | String | The username |
...@@ -51,9 +50,8 @@ The error packet is sent by the server if something went wrong. ...@@ -51,9 +50,8 @@ The error packet is sent by the server if something went wrong.
**Name:** error **Name:** error
**Sender:** Server **Sender:** Server
**Arguments:** **Arguments:**
| # | Type | Description | | # | Type | Description |
|---|--------|-------------------------------------------------------| |---|--------|--------------|
| 1 | String | The error according to [ERRORCODES.md](ERRORCODES.md) | | 1 | String | The error according to [ERRORCODES.md](ERRORCODES.md) |
**Example:** `error|INVALID_USERNAME` **Example:** `error|INVALID_USERNAME`
...@@ -66,7 +64,6 @@ It contains information about the map size and the current player id. ...@@ -66,7 +64,6 @@ It contains information about the map size and the current player id.
**Name:** game **Name:** game
**Sender:** Server **Sender:** Server
**Arguments:** **Arguments:**
| # | Type | Description | | # | Type | Description |
|---|--------|-------------------------------| |---|--------|-------------------------------|
| 1 | Number | The width of the current map | | 1 | Number | The width of the current map |
...@@ -82,9 +79,8 @@ The pos packet is sent by the server to inform the client about a players curren ...@@ -82,9 +79,8 @@ The pos packet is sent by the server to inform the client about a players curren
**Name:** pos **Name:** pos
**Sender:** Server **Sender:** Server
**Arguments:** **Arguments:**
| # | Type | Description | | # | Type | Description |
|---|--------|--------------------------| |---|--------|--------------------------------------------------------------------|
| 1 | Number | The player id | | 1 | Number | The player id |
| 2 | Number | x position of the player | | 2 | Number | x position of the player |
| 3 | Number | y position of the player | | 3 | Number | y position of the player |
...@@ -98,9 +94,8 @@ The player packet is sent by the server to share informations of an player. ...@@ -98,9 +94,8 @@ The player packet is sent by the server to share informations of an player.
**Name:** player **Name:** player
**Sender:** Server **Sender:** Server
**Arguments:** **Arguments:**
| # | Type | Description | | # | Type | Description |
|---|--------|------------------------| |---|--------|--------------------------------------------------------------------|
| 1 | Number | The player id | | 1 | Number | The player id |
| 2 | String | The name of the player | | 2 | String | The name of the player |
...@@ -123,9 +118,8 @@ The die packet is sent by the server to inform the client about a players who di ...@@ -123,9 +118,8 @@ The die packet is sent by the server to inform the client about a players who di
**Name:** die **Name:** die
**Sender:** Server **Sender:** Server
**Arguments:** **Arguments:**
| # | Type | Description | | # | Type | Description |
|------|--------|---------------| |---|--------|--------------------------------------------------------------------|
| 1... | Number | The player id | | 1... | Number | The player id |
**Example (1 dead player):** `die|5` **Example (1 dead player):** `die|5`
...@@ -138,7 +132,6 @@ The move packet is sent by the client to decide where to move. ...@@ -138,7 +132,6 @@ The move packet is sent by the client to decide where to move.
**Name:** move **Name:** move
**Sender:** Client **Sender:** Client
**Arguments:** **Arguments:**
| # | Type | Description | | # | Type | Description |
|---|--------|-------------------------| |---|--------|-------------------------|
| 1 | String | up, right, down or left | | 1 | String | up, right, down or left |
...@@ -152,9 +145,8 @@ The win packet is sent by the server to inform the client they won. ...@@ -152,9 +145,8 @@ The win packet is sent by the server to inform the client they won.
**Name:** win **Name:** win
**Sender:** Server **Sender:** Server
**Arguments:** **Arguments:**
| # | Type | Description | | # | Type | Description |
|---|--------|------------------| |---|--------|-----------------|
| 1 | Number | amount of wins | | 1 | Number | amount of wins |
| 2 | Number | amount of losses | | 2 | Number | amount of losses |
...@@ -167,9 +159,8 @@ The lose packet is sent by the server to inform the client they lost. ...@@ -167,9 +159,8 @@ The lose packet is sent by the server to inform the client they lost.
**Name:** lose **Name:** lose
**Sender:** Server **Sender:** Server
**Arguments:** **Arguments:**
| # | Type | Description | | # | Type | Description |
|---|--------|------------------| |---|--------|-----------------|
| 1 | Number | amount of wins | | 1 | Number | amount of wins |
| 2 | Number | amount of losses | | 2 | Number | amount of losses |
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment