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