-
Notifications
You must be signed in to change notification settings - Fork 7
/
Local Protocol.txt
70 lines (64 loc) · 3.63 KB
/
Local Protocol.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
eX0 Local Protocol
==================
Client | Server
===============================================|================================================
|
----------------------------------------- Connecting -------------------------------------------
Create LocalServerConnection,
Set nJoinStatus = TCP_CONN.
Accept TCP connection,
Create CClient(nTcpSocket),
nJoinStatus is TCP_CONN by default.
Create the networking thread,
Send Join Server Request (1) with
a random unique signature.
Receive Join Server Request,
Send Join Server Accept (2),
Set nJoinStatus = ACCEPTED.
Receive Join Server Accept,
Set nJoinStatus = ACCEPTED,
Start sending UDP packets (100) with same sig.
On UDP receive, set nJoinStatus = UDP_CONN,
Send UDP Conn Established (5).
Receive UDP Conn Established,
Set nJoinStatus = UDP_CONN.
---------------------------------------- Info Exchange -----------------------------------------
Start syncing the clock,
Send Local Player Info (30),
Set nJoinStatus = PUBLIC_CLIENT.
Receive Local Player Info,
Set nJoinStatus = PUBLIC_CLIENT,
Set Player Team = SPECTATOR,
Send Load Level (20),
Send Curr Players Info (21),
Send Player Joined Server (25) to all others,
Send Enter Game Permission (6).
Receive Load Level,
Receive Curr Players Info,
Receive Permission to Join.
----------------------------------- Join Game (as spectator for now) ---------------------------
Finish syncing the clock,
Start running states in sync with server,
Set nJoinStatus = IN_GAME,
Send Entered Game Notification (7).
Receive Entered Game Notification,
Set nJoinStatus = IN_GAME.
...
Send Server Update (2).
Receive Server Update.
----------------------------------------- Start Game -------------------------------------------
Send Join Team Request (27) = RED | BLUE.
Receive Join Team Request,
Set Player Team = RED | BLUE,
Broadcast Player Joined Team (28) = RED | BLUE.
Receive Player Joined Team,
Set Player Team = RED | BLUE.
---------------------------------------- Game Started ------------------------------------------
Send Client Command (1).
Receive Client Command,
Send Server Update (2).
Receive Server Update.
---------------------------------------- Client Leaves -----------------------------------------
Disconnect (TCP) gracefully.
Send Player Left Server to all others (26),
Delete CClient().