aboutsummaryrefslogtreecommitdiff
path: root/protocol.md
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-06-18 11:56:31 +0200
committermetamuffin <metamuffin@disroot.org>2024-06-23 19:20:50 +0200
commitb0b37da40d2c737e37d47de97aef19bd6494e228 (patch)
tree162ba8bf680e951afa5e6083d71cd1398a9a4433 /protocol.md
parent101ef75240e5d94f182fa1f15b58881c39221cfa (diff)
downloadhurrycurry-b0b37da40d2c737e37d47de97aef19bd6494e228.tar
hurrycurry-b0b37da40d2c737e37d47de97aef19bd6494e228.tar.bz2
hurrycurry-b0b37da40d2c737e37d47de97aef19bd6494e228.tar.zst
protocol
Diffstat (limited to 'protocol.md')
-rw-r--r--protocol.md21
1 files changed, 21 insertions, 0 deletions
diff --git a/protocol.md b/protocol.md
new file mode 100644
index 00000000..7f86df7b
--- /dev/null
+++ b/protocol.md
@@ -0,0 +1,21 @@
+# undercooked protocol
+
+The protocol schema is defined in [`protocol.ts`](./test-client/protocol.ts)
+
+1. Connect to the server via TCP (on port 27031) or WebSocket (on port 27032)
+ and send/receive json on individual lines / text messages.
+2. Send the join packet with your username.
+3. Receive initial packets. The server will send the current game state.
+ - `joined` including your ID and Gamedata
+ - `update_map` for every tile
+ - `produce_item` for every item on a tile
+ - `add_player` for every player in the game
+4. Run the game loop
+ - Send your position every 40ms.
+ - Send `interact` when the player interacts with a tile. Make sure to set the
+ `edge` parameter consistently.
+ - Receive packets
+
+Collisions are handled by the clients. Whenever to players collide the player
+with the greater PlayerID is responsible for updating their own momentum and
+sending a packet to update that of the other player.