Skip to content
Snippets Groups Projects
Verified Commit d3480010 authored by Lucy ⁢'s avatar Lucy ⁢
Browse files

fix

parent 9619b2dd
No related branches found
No related tags found
No related merge requests found
Pipeline #195431 passed
...@@ -422,554 +422,6 @@ ...@@ -422,554 +422,6 @@
</tbody> </tbody>
</table> </table>
<p><strong>Example:</strong> <code>lose|1|20</code></p> <p><strong>Example:</strong> <code>lose|1|20</code></p>
<h1>
Protocol
</h1>
<p>
The protocol is string based.<br> Every packet must and will end with a newline ().<br> E.g:
<code>pos|10|50|5</code><br> <strong>Note:</strong> <em>All next examples in this documentation
are given without . But dont forget it in your parsing!</em>
</p>
<h2 class="anchored" data-anchor-id="lose">
Packet structure
</h2>
<p>
The general packet structure looks like this:<br> &lt;packet type&gt;&lt;…arguments&gt;<br> E.g:
<code>game|5|1|2|3</code><br> Where game is the packet type, 5 the first argument, 1 the second,
2 the third and 3 the fourth
</p>
<h2 class="anchored">
Packet types
</h2>
<h3 class="anchored">
motd
</h3>
<p>
The motd packet is sent by the server when you connect to it.<br> motd means “Message of the
day”.
</p>
<p>
<strong>Name:</strong> motd<br> <strong>Sender:</strong> Server<br> <strong>Arguments:</strong>
</p>
<table>
<thead>
<tr>
<th>
#
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
1
</td>
<td>
String
</td>
<td>
The message of the day
</td>
</tr>
</tbody>
</table>
<p>
<strong>Example:</strong> <code>motd|Hello how are you? :)</code>
</p>
<h3 class="anchored">
join
</h3>
<p>
The join packet is the first packet the client has to send to the server when connecting.<br>
Remember the password otherwise you cant use the username again!
</p>
<p>
<strong>Name:</strong> join<br> <strong>Sender:</strong> Client<br> <strong>Arguments:</strong>
</p>
<table>
<thead>
<tr>
<th>
#
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
1
</td>
<td>
String
</td>
<td>
The username
</td>
</tr>
<tr>
<td>
2
</td>
<td>
String
</td>
<td>
The password
</td>
</tr>
</tbody>
</table>
<p>
<strong>Example:</strong> <code>join|Cool Guy|mysupersecret</code>
</p>
<h3 class="anchored">
error
</h3>
<p>
The error packet is sent by the server if something went wrong.
</p>
<p>
<strong>Name:</strong> error<br> <strong>Sender:</strong> Server<br> <strong>Arguments:</strong>
</p>
<table>
<thead>
<tr>
<th>
#
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
1
</td>
<td>
String
</td>
<td>
The error according to <a href="ERRORCODES.md">ERRORCODES.md</a>
</td>
</tr>
</tbody>
</table>
<p>
<strong>Example:</strong> <code>error|INVALID_USERNAME</code>
</p>
<h3 class="anchored">
game
</h3>
<p>
The game packet is sent by the server to inform the client about the new game round.<br> It
contains information about the map size and the current player id.
</p>
<p>
<strong>Name:</strong> game<br> <strong>Sender:</strong> Server<br> <strong>Arguments:</strong>
</p>
<table>
<thead>
<tr>
<th>
#
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
1
</td>
<td>
Number
</td>
<td>
The width of the current map
</td>
</tr>
<tr>
<td>
2
</td>
<td>
Number
</td>
<td>
The height of the current map
</td>
</tr>
<tr>
<td>
3
</td>
<td>
Number
</td>
<td>
The current player id
</td>
</tr>
</tbody>
</table>
<p>
<strong>Example:</strong> <code>game|100|100|5</code>
</p>
<h3 class="anchored">
pos
</h3>
<p>
The pos packet is sent by the server to inform the client about a players current position.
</p>
<p>
<strong>Name:</strong> pos<br> <strong>Sender:</strong> Server<br> <strong>Arguments:</strong>
</p>
<table>
<thead>
<tr>
<th>
#
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
1
</td>
<td>
Number
</td>
<td>
The player id
</td>
</tr>
<tr>
<td>
2
</td>
<td>
Number
</td>
<td>
x position of the player
</td>
</tr>
<tr>
<td>
3
</td>
<td>
Number
</td>
<td>
y position of the player
</td>
</tr>
</tbody>
</table>
<p>
<strong>Example:</strong> <code>pos|5|3|8</code>
</p>
<h3 class="anchored">
player
</h3>
<p>
The player packet is sent by the server to share informations of an player.
</p>
<p>
<strong>Name:</strong> player<br> <strong>Sender:</strong> Server<br>
<strong>Arguments:</strong>
</p>
<table>
<thead>
<tr>
<th>
#
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
1
</td>
<td>
Number
</td>
<td>
The player id
</td>
</tr>
<tr>
<td>
2
</td>
<td>
String
</td>
<td>
The name of the player
</td>
</tr>
</tbody>
</table>
<p>
<strong>Example:</strong> <code>player|3|Coolguy</code>
</p>
<h3 class="anchored">
tick
</h3>
<p>
The tick packet is sent by the server after a turn has been done. Its the best to send a move
packet after this!
</p>
<p>
<strong>Name:</strong> tick<br> <strong>Sender:</strong> Server<br> <strong>Arguments:</strong>
None
</p>
<p>
<strong>Example:</strong> <code>tick</code>
</p>
<h3 class="anchored">
die
</h3>
<p>
The die packet is sent by the server to inform the client about a players who died.
</p>
<p>
<strong>Name:</strong> die<br> <strong>Sender:</strong> Server<br> <strong>Arguments:</strong>
</p>
<table>
<thead>
<tr>
<th>
#
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
1…
</td>
<td>
Number
</td>
<td>
The player id
</td>
</tr>
</tbody>
</table>
<p>
<strong>Example (1 dead player):</strong> <code>die|5</code><br> <strong>Example (4 dead
player):</strong> <code>die|5|8|9|13</code>
</p>
<h3 class="anchored">
move
</h3>
<p>
The move packet is sent by the client to decide where to move.
</p>
<p>
<strong>Name:</strong> move<br> <strong>Sender:</strong> Client<br> <strong>Arguments:</strong>
</p>
<table>
<thead>
<tr>
<th>
#
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
1
</td>
<td>
String
</td>
<td>
up, right, down or left
</td>
</tr>
</tbody>
</table>
<p>
<strong>Example:</strong> <code>move|up</code>
</p>
<h3 class="anchored">
win
</h3>
<p>
The win packet is sent by the server to inform the client they won.
</p>
<p>
<strong>Name:</strong> win<br> <strong>Sender:</strong> Server<br> <strong>Arguments:</strong>
</p>
<table>
<thead>
<tr>
<th>
#
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
1
</td>
<td>
Number
</td>
<td>
amount of wins
</td>
</tr>
<tr>
<td>
2
</td>
<td>
Number
</td>
<td>
amount of losses
</td>
</tr>
</tbody>
</table>
<p>
<strong>Example:</strong> <code>win|1|20</code>
</p>
<h3 class="anchored">
lose
</h3>
<p>
The lose packet is sent by the server to inform the client they lost.
</p>
<p>
<strong>Name:</strong> lose<br> <strong>Sender:</strong> Server<br> <strong>Arguments:</strong>
</p>
<table>
<thead>
<tr>
<th>
#
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
1
</td>
<td>
Number
</td>
<td>
amount of wins
</td>
</tr>
<tr>
<td>
2
</td>
<td>
Number
</td>
<td>
amount of losses
</td>
</tr>
</tbody>
</table>
<p>
<strong>Example:</strong> <code>lose|1|20</code>
</p>
</section>
</section>
</section> </section>
</section> </section>
...@@ -979,7 +431,8 @@ ...@@ -979,7 +431,8 @@
<p>FOSS AG der TU Dortmund, 2023</p> <p>FOSS AG der TU Dortmund, 2023</p>
</div> </div>
<div class="flex flex-row gap-4"> <div class="flex flex-row gap-4">
<a href="https://fsinfo.cs.tu-dortmund.de/impressum" class="text-gray-400 hover:text-gray-300">Impressum</a> <a href="https://fsinfo.cs.tu-dortmund.de/impressum"
class="text-gray-400 hover:text-gray-300">Impressum</a>
<a href="https://fsinfo.cs.tu-dortmund.de/datenschutz/start" <a href="https://fsinfo.cs.tu-dortmund.de/datenschutz/start"
class="text-gray-400 hover:text-gray-300">Datenschutz</a> class="text-gray-400 hover:text-gray-300">Datenschutz</a>
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment