summaryrefslogtreecommitdiff
path: root/test-client/protocol.ts
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-08-10 20:57:06 +0200
committermetamuffin <metamuffin@disroot.org>2024-08-10 20:57:06 +0200
commit7dbb34febaf75572f99fee459a77cf917de05d8f (patch)
tree72ba067aa5003d110f2bb707fb3e9c429388505b /test-client/protocol.ts
parent3d13c85ec2e3acbee249b4baf20797cc38a8a121 (diff)
downloadhurrycurry-7dbb34febaf75572f99fee459a77cf917de05d8f.tar
hurrycurry-7dbb34febaf75572f99fee459a77cf917de05d8f.tar.bz2
hurrycurry-7dbb34febaf75572f99fee459a77cf917de05d8f.tar.zst
Change protocol and server to allow multiple players per connection (untested)
Diffstat (limited to 'test-client/protocol.ts')
-rw-r--r--test-client/protocol.ts14
1 files changed, 7 insertions, 7 deletions
diff --git a/test-client/protocol.ts b/test-client/protocol.ts
index bd32e497..353c9100 100644
--- a/test-client/protocol.ts
+++ b/test-client/protocol.ts
@@ -36,16 +36,16 @@ export interface Gamedata {
}
export type PacketS =
- { type: "join", name: string, character: number } // Spawns your character. Dont send it to spectate.
- | { type: "leave" } // Despawns your character
- | { type: "movement", pos: Vec2, direction: Vec2, boosting: boolean }
- | { type: "interact", pos?: Vec2 } // Interact with some tile. pos is a position when pressing and null when releasing interact button
- | { type: "communicate", message?: Message, persist: boolean } // Send a message
- | { type: "collide", player: PlayerID, force: Vec2 } // Apply force to another player as a result of a collision
+ { type: "join", name: string, character: number } // Spawns a new character. The server replies with "joined". Dont send it to spectate.
+ | { type: "leave", player: PlayerID } // Despawns a character
+ | { type: "movement", player: PlayerID, pos: Vec2, direction: Vec2, boosting: boolean }
+ | { type: "interact", player: PlayerID, pos?: Vec2 } // Interact with some tile. pos is a position when pressing and null when releasing interact button
+ | { type: "communicate", player: PlayerID, message?: Message, persist: boolean } // Send a message
+ | { type: "replay_tick", dt: number } // Steps forward in replay.
export type PacketC =
{ type: "version", minor: number, major: number, supports_bincode?: boolean } // Sent once after connecting to ensure you client is compatible
- | { type: "init", id: PlayerID } // You just connected. This is your id for this session.
+ | { type: "joined", id: PlayerID } // Informs you about the id of the character you spawned
| { type: "data", data: Gamedata } // Game data was changed
| { type: "add_player", id: PlayerID, name: string, position: Vec2, character: number } // Somebody else joined (or was already in the game)
| { type: "remove_player", id: PlayerID } // Somebody left