diff options
author | metamuffin <metamuffin@disroot.org> | 2024-06-26 17:46:47 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-06-26 17:46:47 +0200 |
commit | 86216b8a65cf19f8a313042a0ba788b0886f40a7 (patch) | |
tree | 82239a6ea9c551a1bca4d7e0c1436ca9bb35c035 /protocol.md | |
parent | 4a8929d3935d120d69b16209b8badadeb5675d2d (diff) | |
download | hurrycurry-86216b8a65cf19f8a313042a0ba788b0886f40a7.tar hurrycurry-86216b8a65cf19f8a313042a0ba788b0886f40a7.tar.bz2 hurrycurry-86216b8a65cf19f8a313042a0ba788b0886f40a7.tar.zst |
update protocol.md
Diffstat (limited to 'protocol.md')
-rw-r--r-- | protocol.md | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/protocol.md b/protocol.md index a0fbe4f6..5960bb40 100644 --- a/protocol.md +++ b/protocol.md @@ -1,20 +1,21 @@ <!-- Undercooked - a game about cooking Copyright 2024 metamuffin - + This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, version 3 of the License only. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - + --> + # undercooked protocol The protocol schema is defined in [`protocol.ts`](./test-client/protocol.ts) @@ -22,16 +23,20 @@ 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 +3. Wait for `init` packet. +4. The server will send the current game state: + - `data` once for setting important look-up tables - `update_map` for every tile - - `produce_item` for every item on a tile + - `set_tile_item` for every item on a tile - `add_player` for every player in the game -4. Run the game loop + - `set_player_item` for every item held by a player +5. 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 +6. The Game ends. The server will remove all players and tiles. Then continue at + step 4. Collisions are handled by the clients. Whenever to players collide the player with the greater PlayerID is responsible for updating their own momentum and @@ -39,7 +44,9 @@ sending a packet to update that of the other player. ## Movement -Movement is handled mostly client-side. Therefore it is implement three times: +Movement is handled mostly client-side. Therefore it is implemented three times: + - In the test-client: [movement.ts](./test-client/movement.ts) - For customers in the server: [movement.rs](./server/src/customer/movement.rs) -- In the client: [movement.rs](./client/scripts/player.gd) +- In the client: + [controllable_player.gd](./client/player/controllable_player.gd) |