Updated the networking protocol
+32
-29
@@ -1,38 +1,41 @@
|
|||||||
These are the basic networking protocols used by the client and server programs.
|
These are the basic networking protocols used by the client and server
|
||||||
|
programs.
|
||||||
|
This page details the _current_ working version, it omits planned features.
|
||||||
|
|
||||||
#### Packet Types
|
#### Packet Types
|
||||||
|
|
||||||
* none "problem"
|
The declaration of this list can be found in
|
||||||
|
[packet_type.hpp](packet_type.hpp).
|
||||||
|
|
||||||
* ping "are you there?"
|
```
|
||||||
* pong "I am here"
|
0: none
|
||||||
* broadcast request "what servers are available?"
|
1: ping
|
||||||
* broadcast response "I am available"
|
2: pong
|
||||||
* join request "can I play? here's my data"
|
3: broadcast request
|
||||||
* join confirm "yes, here's your data"
|
4: broadcast response
|
||||||
* disconnect "I/you need to go"
|
5: join request
|
||||||
|
6: join response
|
||||||
* synchronize "send me all of the data you've got"
|
7: disconnect
|
||||||
* player new "create this player at this location"
|
8: syncronize (unused)
|
||||||
* player delete "delete this player"
|
9: player new (unused)
|
||||||
* player move "this is the player's new movement data"
|
10: player delete (unused)
|
||||||
|
11: player move (unused)
|
||||||
|
```
|
||||||
|
|
||||||
#### Procedures
|
#### Procedures
|
||||||
|
|
||||||
connecting to a server:
|
Connecting to and disconnecting from a server:
|
||||||
|
|
||||||
* client sends a broadcast
|
1. The client enters the Lobby scene and sends a BroadcastRequest
|
||||||
* server responds with data (name, version)
|
2. The server responds with a BroadcastResponse (including the server's name)
|
||||||
* client sends a join request
|
3. The client selects a server from the list of responses and sends a
|
||||||
* server responds with data (player index, resource list)
|
JoinRequest to that server
|
||||||
* client switches to resource loading/game mode
|
4. The server either ignores the request, or adds the client to it's internal
|
||||||
* client sends sync request
|
client list and responds with a JoinResponse (including the new client's index)
|
||||||
|
5. When the client receives the response, it switches from the Lobby scene to
|
||||||
|
the InWorld scene.
|
||||||
|
6. Pressing the escape key on on the client (while in the InWorld scene) will
|
||||||
|
send a Disconnect message, and will switch the client to the MainMenu scene.
|
||||||
|
7. When the server receives the Disconnect, it will send another (at this stage
|
||||||
|
redundant) Disconnect to the client, and remove it from the list of clients.
|
||||||
|
|
||||||
in the game:
|
|
||||||
|
|
||||||
* either sends player new command
|
|
||||||
* either receives player new command; server relays this command
|
|
||||||
* either sends player delete command
|
|
||||||
* either receives player delete command; server relays this command
|
|
||||||
* either sends player move command
|
|
||||||
* either receives player move command; server relays this command
|
|
||||||
Reference in New Issue
Block a user