diff options
-rw-r--r-- | protocol.md | 16 | ||||
-rw-r--r-- | readme.md | 15 | ||||
-rw-r--r-- | test-client/protocol.ts | 8 |
3 files changed, 18 insertions, 21 deletions
diff --git a/protocol.md b/protocol.md index b5201abd..35671e75 100644 --- a/protocol.md +++ b/protocol.md @@ -13,7 +13,6 @@ 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/>. - --> # Hurry Curry! protocol @@ -32,9 +31,8 @@ The protocol schema is defined in [`protocol.ts`](./test-client/protocol.ts) - `add_player` for every player in the game - `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. + - Send your position every 20ms - 40ms. + - Send `interact` when the player interacts with a tile. - Receive packets 6. The Game ends. The server will remove all players and tiles. Then continue at step 4. @@ -62,9 +60,11 @@ be used if either minor or major version differs. ## Movement -Movement is handled mostly client-side. Therefore it is implemented three times: +Movement is handled server-side but should be predicted by client for better +latency. For this reason it 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: +- In GDscript (for the Godot client): [controllable_player.gd](./client/player/controllable_player.gd) +- In Rust (for server, pixelcurry and customers): + [movement.rs](./server/protocol/src/movement.rs) +- In TypeScript (for test-client): [movement.ts](./test-client/movement.ts) @@ -15,11 +15,8 @@ individual components below. ## Translation If you want to help translate the project, you can use the -[weblate](https://translate.codeberg.org/engage/hurrycurry/). All help -is appreciated. - -If your language is not available on weblate, please -[open an issue](https://codeberg.org/hurrycurry/hurrycurry/issues/new). +[weblate](https://translate.codeberg.org/engage/hurrycurry/). All help is +appreciated. ## Client @@ -27,7 +24,8 @@ If your language is not available on weblate, please - Requirements: - Godot 4.2 - - cURL + - cURL (only if book is required) + - Nightly rust toolchain (only if locales are required) ``` make client @@ -71,15 +69,14 @@ make pixel-client ### Usage -``` -cargo +nightly run --bin pixel-client -``` +- `./target/release/pixelcurry` ## Test Client ### Building - Requirements: + - Nightly rust toolchain (only if locales are required) - esbuild ``` diff --git a/test-client/protocol.ts b/test-client/protocol.ts index 0d2183dd..3bceb351 100644 --- a/test-client/protocol.ts +++ b/test-client/protocol.ts @@ -16,9 +16,9 @@ */ export type Vec2 = [number, number] // x, y -export type PlayerID = number -export type ItemIndex = number -export type TileIndex = number +export type PlayerID = number // opaque number to identify players. +export type ItemIndex = number // index used primarily for item_names in Gamedata +export type TileIndex = number // index used primarily for tile_names in Gamedata export interface MapMetadata { name: string, @@ -32,7 +32,7 @@ export interface Gamedata { tile_collide: boolean[], // Look-up table for TileIndex to check tile collision with players tile_interact: boolean[], // Look-up table for TileIndex to check if a tile is interactable spawn: Vec2, // Where players spawn when they join. - maps: [string, MapMetadata][], + maps: [string, MapMetadata][], // Metadata for most available maps } export type PacketS = |