forked from orwell-int/messages
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server-game.proto
129 lines (112 loc) · 3.22 KB
/
server-game.proto
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
option optimize_for = LITE_RUNTIME;
import public "common.proto";
package orwell.messages;
enum ItemType {
FLAG = 1;
}
// Cartesian coordinates
// not sent on its own
message Coordinates {
required uint64 x = 1;
required uint64 y = 2;
}
// Colour with RGB values from 0 to 255
// not sent on its own
message RGBColour {
required uint32 r = 1;
required uint32 g = 2;
required uint32 b = 3;
}
message Landmark {
optional Coordinates position = 1;
optional RGBColour colour = 2;
}
enum CaptureStatus {
// the capture has just started
STARTED = 1;
// the capture failed (not enough time spent capturing)
FAILED = 2;
// the capture succeeded (team might score)
SUCCEEDED = 3;
}
// Information about an item regarding its state
// not sent on its own
message Item {
required ItemType type = 1;
required string name = 2;
optional CaptureStatus capture_status = 3;
// the name of the team owning the item (only valid for a flag ?)
optional string owner = 4;
optional Coordinates position = 5;
optional bool active = 6;
// team that is or was capturing
optional string capturer = 7;
}
// Information about the team
// not sent on its own
message Team {
required string name = 1;
optional uint32 score = 2;
optional uint32 num_players = 3;
repeated string players = 4;
}
// Notify or give the current game state (started or not)
// Can be embedded
message GameState {
required bool playing = 1;
// number of seconds left before the game ends (useless if playing is false)
optional uint64 seconds = 2;
repeated Team teams = 3;
// only set when playing is false and seconds is 0 (ie when the game is finished)
optional string winner = 4;
// all items may not be repeated in every message sent ; only important information will be put
repeated Item items = 5;
// the points delimiting the map ; possibly only sent just once
repeated Landmark map_limits = 6;
// total game time
optional uint64 total_seconds = 7;
}
// Tell a player how (s)he is and where (s)he plays
// reply to: Hello
message Welcome {
required string robot = 1;
required string team = 2;
optional GameState game_state = 3;
required string id = 4;
required string video_address = 5;
required uint32 video_port = 6;
}
// Tell a player that (s)he is not welcome
// reply to: Hello
message Goodbye {
}
// Tell a player what is going on about their robot
// sent when something noteworthy is happening
message PlayerState {
optional Item item = 1;
optional Ultrasound ultrasound = 2;
optional Battery battery = 3;
}
// Tell a player how to connect to the game server
// reply to: GetAccess (through the web server)
message Access {
required uint32 port = 1;
// default means same ip as the one used to send GetAccess
optional string ip = 2 [default = ""];
}
// Notify the players or the robots that the game starts
message Start {
optional GameState game_state = 1;
}
// Notify the players or the robots that the games stops
message Stop {
optional bool shutdown = 1 [default = false];
optional bool video = 2 [default = true];
}
// Tell a robot what its name is (if the name is empty the registration failed).
// reply to: Register
message Registered {
// this is the definitive robot ID to be used for communications
required string robot_id = 1;
optional string team = 2;
}