-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame_protocol.d2
73 lines (65 loc) · 1.75 KB
/
game_protocol.d2
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
71
72
73
shape: sequence_diagram
client; server; cluster; sui;
client.shape: person
cluster.style.multiple: true
sui.shape: image;
sui.icon: https://cryptologos.cc/logos/sui-sui-logo.png;
client."Characters"
Playing with characters: {
client -> server.a0: |md .
packet/playerPosition
- { id, x, y, z }
enough to "select" the character |
client -> server.a0: |md packet/entityAction
- { id, action } |
server.a0 <-> sui.a0: |md (if unkown)
fetch character |
server.a0 -> client: |md (if wrong)
reconcile position
packet/playerPosition |
server.a0 -> cluster: |md Subscribe
- zone { x, z }
- zones around
|
server."Publish topic is floor(coords / 500)"
server.a0 -> cluster: |md publish/entityMove
- { id, x, y, z } |
server.a0 -> cluster: |md publish/entityAction
- { id, x, y, z } |
}
Listening to other characters: {
cluster.a1 -> server.a1: |md publish/entityMove
- zone { x, z } |
cluster.a1 -> server.a1: |md publish/entityAction
- zone { x, z } |
server.a1 -> client.a1: packet/entityMove
server.a1 -> client.a1: packet/entityAction
client.a1 <-> client.a1: |md (if unknown)
spawn entity
|
}
client."Character despawning"
Player closing socket: {
client -> server.a2: close socket
server.a2 -> cluster: publish/entityDespawn
server.a2 -> cluster: |md Unsubscribe
- zone { x, z }
- zones around
|
}
Player changing zone: {
client -> server.a3: |md packet/playerPosition
{ id, x, y, z } |
server.a3 -> cluster.a3: |md
- Unsubscribe zones too far
- Subscribe new zones
|
server.a3 -> cluster.a3: |md publish/entityMove
- previous zone
|
server.a3 -> cluster.a3: |md publish/entityMove
zone { x, z }
|
}
cluster.a4 -> server.a4: publish/entityDespawn
server.a4 -> client.a4: packet/entityDespawn