Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HackaTron Wrapper
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FOSS-AG
Events
HackaTRON
HackaTron Wrapper
Commits
10b90395
Verified
Commit
10b90395
authored
1 year ago
by
David Mehren
Browse files
Options
Downloads
Patches
Plain Diff
Add docs
parent
baa6c4c4
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
ERRORCODES.md
+64
-0
64 additions, 0 deletions
ERRORCODES.md
PROTOCOL.md
+176
-0
176 additions, 0 deletions
PROTOCOL.md
README.md
+3
-0
3 additions, 0 deletions
README.md
with
243 additions
and
0 deletions
ERRORCODES.md
0 → 100644
+
64
−
0
View file @
10b90395
# Error codes
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_PACKET_OVERFLOW
You are sending more than 1024 bytes to the server.
## ERROR_NO_MOVE
You didnt send a move packet.
## ERROR_MAX_CONNECTIONS
Your ip is already connected. IPv6 may workarounds this but please dont flood the server with connections :(
## ERROR_JOIN_TIMEOUT
You didnt send the join packet.
## ERROR_EXPECTED_JOIN
Instead of join you sent some other packet.
## ERROR_INVALID_USERNAME
You used an invalid username. (e.g. not a string)
## ERROR_USERNAME_TOO_SHORT
Username is too short.
## ERROR_USERNAME_TOO_LONG
Username is too long.
## ERROR_USERNAME_INVALID_SYMBOLS
You used invalid symbols for the username.
## ERROR_INVALID_PASSWORD
You used an invalid password. (e.g. not a string)
## ERROR_PASSWORD_TOO_SHORT
Password is too short.
## ERROR_PASSWORD_TOO_LONG
Password is too long.
## ERROR_NO_PERMISSION
You should not do this :^) (e.g. hijack bots)
## ERROR_WRONG_PASSWORD
Your password was wrong.
## ERROR_ALREADY_CONNECTED
You are already connected with this player.
## 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
This diff is collapsed.
Click to expand it.
PROTOCOL.md
0 → 100644
+
176
−
0
View file @
10b90395
# 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`
## Packet structure
The general packet structure looks like this:
\<
packet type
\>\<
...arguments
\>
E.g:
`game|5|1|2|3`
Where game is the packet type, 5 the first argument, 1 the second, 2 the third and 3 the fourth
## Packet types
### motd
The motd packet is sent by the server when you connect to it.
motd means "Message of the day".
**Name:**
motd
**Sender:**
Server
**Arguments:**
| # | Type | Description |
|---|--------|------------------------|
| 1 | String | The message of the day |
**Example:**
`motd|Hello how are you? :)`
### join
The join packet is the first packet the client has to send to the server when connecting.
Remember the password otherwise you cant use the username again!
**Name:**
join
**Sender:**
Client
**Arguments:**
| # | Type | Description |
|---|--------|--------------|
| 1 | String | The username |
| 2 | String | The password |
**Example:**
`join|Cool Guy|mysupersecret`
### error
The error packet is sent by the server if something went wrong.
**Name:**
error
**Sender:**
Server
**Arguments:**
| # | Type | Description |
|---|--------|-------------------------------------------------------|
| 1 | String | The error according to
[
ERRORCODES.md
](
ERRORCODES.md
)
|
**Example:**
`error|INVALID_USERNAME`
### game
The game packet is sent by the server to inform the client about the new game round.
It contains information about the map size and the current player id.
**Name:**
game
**Sender:**
Server
**Arguments:**
| # | Type | Description |
|---|--------|-------------------------------|
| 1 | Number | The width of the current map |
| 2 | Number | The height of the current map |
| 3 | Number | The current player id |
**Example:**
`game|100|100|5`
### pos
The pos packet is sent by the server to inform the client about a players current position.
**Name:**
pos
**Sender:**
Server
**Arguments:**
| # | Type | Description |
|---|--------|--------------------------|
| 1 | Number | The player id |
| 2 | Number | x position of the player |
| 3 | Number | y position of the player |
**Example:**
`pos|5|3|8`
### player
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 |
| 2 | String | The name of the player |
**Example:**
`player|3|Coolguy`
### tick
The tick packet is sent by the server after a turn has been done. Its the best to send a move packet after this!
**Name:**
tick
**Sender:**
Server
**Arguments:**
None
**Example:**
`tick`
### die
The die packet is sent by the server to inform the client about a players who died.
**Name:**
die
**Sender:**
Server
**Arguments:**
| # | Type | Description |
|------|--------|---------------|
| 1... | Number | The player id |
**Example (1 dead player):**
`die|5`
**Example (4 dead player):**
`die|5|8|9|13`
### move
The move packet is sent by the client to decide where to move.
**Name:**
move
**Sender:**
Client
**Arguments:**
| # | Type | Description |
|---|--------|-------------------------|
| 1 | String | up, right, down or left |
**Example:**
`move|up`
### win
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 |
| 2 | Number | amount of losses |
**Example:**
`win|1|20`
### lose
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 |
| 2 | Number | amount of losses |
**Example:**
`lose|1|20`
This diff is collapsed.
Click to expand it.
README.md
0 → 100644
+
3
−
0
View file @
10b90395
# Hackatron Demo Client
This is a simple Java client implementation for the FOSS-AG Hackatron.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment