sc2ai 0.0.0.pre → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/data/data.json +1 -0
  3. data/data/data_readable.json +22946 -0
  4. data/data/sc2ai/protocol/common.proto +59 -0
  5. data/data/sc2ai/protocol/data.proto +120 -0
  6. data/data/sc2ai/protocol/debug.proto +127 -0
  7. data/data/sc2ai/protocol/error.proto +221 -0
  8. data/data/sc2ai/protocol/query.proto +55 -0
  9. data/data/sc2ai/protocol/raw.proto +202 -0
  10. data/data/sc2ai/protocol/sc2api.proto +718 -0
  11. data/data/sc2ai/protocol/score.proto +108 -0
  12. data/data/sc2ai/protocol/spatial.proto +115 -0
  13. data/data/sc2ai/protocol/ui.proto +145 -0
  14. data/data/setup/setup.SC2Map +0 -0
  15. data/data/setup/setup.SC2Replay +0 -0
  16. data/data/stableid.json +37900 -0
  17. data/data/versions.json +554 -0
  18. data/exe/sc2ai +35 -0
  19. data/lib/docker_build/Dockerfile.ruby +74 -0
  20. data/lib/docker_build/docker-compose-base-image.yml +10 -0
  21. data/lib/docker_build/docker-compose-ladderzip.yml +9 -0
  22. data/lib/sc2ai/api/ability_id.rb +1951 -0
  23. data/lib/sc2ai/api/buff_id.rb +316 -0
  24. data/lib/sc2ai/api/data.rb +101 -0
  25. data/lib/sc2ai/api/effect_id.rb +20 -0
  26. data/lib/sc2ai/api/tech_tree.rb +82 -0
  27. data/lib/sc2ai/api/tech_tree_data.rb +2342 -0
  28. data/lib/sc2ai/api/unit_type_id.rb +2074 -0
  29. data/lib/sc2ai/api/upgrade_id.rb +312 -0
  30. data/lib/sc2ai/cli/cli.rb +177 -0
  31. data/lib/sc2ai/cli/ladderzip.rb +173 -0
  32. data/lib/sc2ai/cli/new.rb +88 -0
  33. data/lib/sc2ai/configuration.rb +145 -0
  34. data/lib/sc2ai/connection/connection_listener.rb +30 -0
  35. data/lib/sc2ai/connection/requests.rb +417 -0
  36. data/lib/sc2ai/connection/status_listener.rb +15 -0
  37. data/lib/sc2ai/connection.rb +146 -0
  38. data/lib/sc2ai/local_play/client/configurable_options.rb +115 -0
  39. data/lib/sc2ai/local_play/client.rb +159 -0
  40. data/lib/sc2ai/local_play/client_manager.rb +70 -0
  41. data/lib/sc2ai/local_play/map_file.rb +48 -0
  42. data/lib/sc2ai/local_play/match.rb +184 -0
  43. data/lib/sc2ai/overrides/array.rb +14 -0
  44. data/lib/sc2ai/overrides/async/process/child.rb +31 -0
  45. data/lib/sc2ai/overrides/kernel.rb +33 -0
  46. data/lib/sc2ai/paths.rb +294 -0
  47. data/lib/sc2ai/player/actions.rb +386 -0
  48. data/lib/sc2ai/player/debug.rb +224 -0
  49. data/lib/sc2ai/player/game_state.rb +131 -0
  50. data/lib/sc2ai/player/geometry.rb +766 -0
  51. data/lib/sc2ai/player/previous_state.rb +49 -0
  52. data/lib/sc2ai/player/units.rb +337 -0
  53. data/lib/sc2ai/player.rb +661 -0
  54. data/lib/sc2ai/ports.rb +152 -0
  55. data/lib/sc2ai/protocol/_meta_documentation.rb +39 -0
  56. data/lib/sc2ai/protocol/common_pb.rb +43 -0
  57. data/lib/sc2ai/protocol/data_pb.rb +47 -0
  58. data/lib/sc2ai/protocol/debug_pb.rb +56 -0
  59. data/lib/sc2ai/protocol/error_pb.rb +36 -0
  60. data/lib/sc2ai/protocol/extensions/color.rb +20 -0
  61. data/lib/sc2ai/protocol/extensions/point.rb +23 -0
  62. data/lib/sc2ai/protocol/extensions/point_2_d.rb +26 -0
  63. data/lib/sc2ai/protocol/extensions/position.rb +202 -0
  64. data/lib/sc2ai/protocol/extensions/power_source.rb +19 -0
  65. data/lib/sc2ai/protocol/extensions/unit.rb +489 -0
  66. data/lib/sc2ai/protocol/query_pb.rb +47 -0
  67. data/lib/sc2ai/protocol/raw_pb.rb +57 -0
  68. data/lib/sc2ai/protocol/sc2api_pb.rb +130 -0
  69. data/lib/sc2ai/protocol/score_pb.rb +40 -0
  70. data/lib/sc2ai/protocol/spatial_pb.rb +48 -0
  71. data/lib/sc2ai/protocol/ui_pb.rb +56 -0
  72. data/lib/sc2ai/unit_group/action_ext.rb +74 -0
  73. data/lib/sc2ai/unit_group/filter_ext.rb +379 -0
  74. data/lib/sc2ai/unit_group.rb +277 -0
  75. data/lib/sc2ai/version.rb +2 -1
  76. data/lib/sc2ai.rb +93 -2
  77. data/lib/templates/ladderzip/bin/ladder.tt +23 -0
  78. data/lib/templates/new/.ladderignore +20 -0
  79. data/lib/templates/new/Gemfile.tt +7 -0
  80. data/lib/templates/new/api/common.proto +59 -0
  81. data/lib/templates/new/api/data.proto +120 -0
  82. data/lib/templates/new/api/debug.proto +127 -0
  83. data/lib/templates/new/api/error.proto +221 -0
  84. data/lib/templates/new/api/query.proto +55 -0
  85. data/lib/templates/new/api/raw.proto +202 -0
  86. data/lib/templates/new/api/sc2api.proto +718 -0
  87. data/lib/templates/new/api/score.proto +108 -0
  88. data/lib/templates/new/api/spatial.proto +115 -0
  89. data/lib/templates/new/api/ui.proto +145 -0
  90. data/lib/templates/new/boot.rb.tt +6 -0
  91. data/lib/templates/new/my_bot.rb.tt +23 -0
  92. data/lib/templates/new/run_example_match.rb.tt +14 -0
  93. metadata +353 -9
@@ -0,0 +1,718 @@
1
+
2
+ syntax = "proto2";
3
+
4
+ package Api;
5
+
6
+ import "sc2ai/protocol/common.proto";
7
+ import "sc2ai/protocol/data.proto";
8
+ import "sc2ai/protocol/debug.proto";
9
+ import "sc2ai/protocol/error.proto";
10
+ import "sc2ai/protocol/query.proto";
11
+ import "sc2ai/protocol/raw.proto";
12
+ import "sc2ai/protocol/score.proto";
13
+ import "sc2ai/protocol/spatial.proto";
14
+ import "sc2ai/protocol/ui.proto";
15
+
16
+ //
17
+ // Notes:
18
+ // Single player flow:
19
+ // 1) Call Request.create_game with a valid single player map (a multiplayer map will end right away).
20
+ // 2) Call Request.join_game, wait for the response.
21
+ // 3) Request.end will terminate the game. Observations can still be made.
22
+ // Multi-player flow:
23
+ // 1) Launch two game instances with separate ports.
24
+ // 2) Designate a host, and Request.create_game with a multiplayer map.
25
+ // 3) Call Request.join on BOTH clients. Join will block until both clients connect.
26
+ // 4) Wait for a response from both clients. They can now play/step.
27
+ // 5) Steps should be syncronized. One client may time out if they are not. Multiple step sizes are ok.
28
+ // 4) Call Request.leave at any point or when the game ends. Observations will not be valid after this.
29
+ //
30
+ // States:
31
+ //
32
+ //------------------|---------------------------------------------------|-----------------------|
33
+ // Request | Valid in State | Transition to State |
34
+ //------------------|---------------------------------------------------|-----------------------|
35
+ // create_game | launched | init_game |
36
+ // | ended (singleplayer only) | init_game |
37
+ // join_game* | init_game (singleplayer or multiplayer host only) | in_game |
38
+ // | launched (multiplayer client only) | in_game |
39
+ // restart_game | ended | in_game |
40
+ // start_replay | launched | in_replay |
41
+ // | ended (singleplayer only) | |
42
+ // leave_game | in_game (required when finishing multiplayer) | launched |
43
+ // quick_save | in_game | |
44
+ // quick_load | in_game | |
45
+ // | ended | |
46
+ // quit | any | quit (not sent) |
47
+ // game_info | in_game | |
48
+ // | in_replay | |
49
+ // | ended | |
50
+ // observation | in_game | |
51
+ // | in_replay | |
52
+ // | ended | |
53
+ // step* | in_game (not available in realtime mode) | in_game |
54
+ // | in_replay | ended |
55
+ // action | in_game (not available to observers) | |
56
+ // obs_action | in_game (only for observers) | |
57
+ // | in_replay | |
58
+ // data | in_game | |
59
+ // | in_replay | |
60
+ // | ended | |
61
+ // query | in_game | |
62
+ // | in_replay | |
63
+ // | ended | |
64
+ // save_replay | in_game | |
65
+ // | ended (only after a game) | |
66
+ // map_command | in_game | |
67
+ // replay_info | any | |
68
+ // available_maps | any | |
69
+ // save_map | any | |
70
+ // ping | any | |
71
+ // debug | in_game | various |
72
+ //------------------|---------------------------------------------------|-----------------------|
73
+ //
74
+ // * In multiplayer, these require synchronization between clients.
75
+ //
76
+ // Notes:
77
+ // - if a request fails, the game remains in the current state.
78
+ //
79
+
80
+ //
81
+ // Request/Response
82
+ //
83
+
84
+ message Request {
85
+ oneof request {
86
+ // Game Setup
87
+ RequestCreateGame create_game = 1; // Send to host to initialize game.
88
+ RequestJoinGame join_game = 2; // Send to host and all clients for game to begin.
89
+ RequestRestartGame restart_game = 3; // Single player only. Reinitializes the game with the same player setup.
90
+ RequestStartReplay start_replay = 4; // Start playing a replay.
91
+ RequestLeaveGame leave_game = 5; // Multiplayer only. Disconnects from a multiplayer game, equivalent to surrender.
92
+
93
+ RequestQuickSave quick_save = 6; // Saves game to an in-memory bookmark.
94
+ RequestQuickLoad quick_load = 7; // Loads from an in-memory bookmark.
95
+
96
+ RequestQuit quit = 8; // Terminates the application.
97
+
98
+ // During Game
99
+ RequestGameInfo game_info = 9; // Static data about the current game and map.
100
+ RequestObservation observation = 10; // Snapshot of the current game state.
101
+ RequestAction action = 11; // Executes an action for a participant.
102
+ RequestObserverAction obs_action = 21; // Executes an action for an observer.
103
+ RequestStep step = 12; // Advances the game simulation.
104
+ RequestData data = 13; // Data about different gameplay elements. May be different for different games.
105
+ RequestQuery query = 14; // Additional methods for inspecting game state.
106
+ RequestSaveReplay save_replay = 15; // Generates a replay.
107
+ RequestMapCommand map_command = 22; // Execute a particular trigger through a string interface
108
+
109
+ // Other.
110
+ RequestReplayInfo replay_info = 16; // Returns metadata about a replay file. Does not load the replay.
111
+ RequestAvailableMaps available_maps = 17; // Returns directory of maps that can be played on.
112
+ RequestSaveMap save_map = 18; // Saves binary map data to the local temp directory.
113
+
114
+ // Debugging
115
+ RequestPing ping = 19; // Network ping for testing connection.
116
+ RequestDebug debug = 20; // Display debug information and execute debug actions.
117
+ }
118
+ optional uint32 id = 97;
119
+ }
120
+
121
+ message Response {
122
+ oneof response {
123
+ ResponseCreateGame create_game = 1;
124
+ ResponseJoinGame join_game = 2;
125
+ ResponseRestartGame restart_game = 3;
126
+ ResponseStartReplay start_replay = 4;
127
+ ResponseLeaveGame leave_game = 5;
128
+
129
+ ResponseQuickSave quick_save = 6;
130
+ ResponseQuickLoad quick_load = 7;
131
+
132
+ ResponseQuit quit = 8;
133
+
134
+ ResponseGameInfo game_info = 9;
135
+ ResponseObservation observation = 10;
136
+ ResponseAction action = 11;
137
+ ResponseObserverAction obs_action = 21;
138
+ ResponseStep step = 12;
139
+ ResponseData data = 13;
140
+ ResponseQuery query = 14;
141
+ ResponseSaveReplay save_replay = 15;
142
+
143
+ ResponseReplayInfo replay_info = 16;
144
+ ResponseAvailableMaps available_maps = 17;
145
+ ResponseSaveMap save_map = 18;
146
+ ResponseMapCommand map_command = 22;
147
+
148
+ // Debugging
149
+ ResponsePing ping = 19;
150
+ ResponseDebug debug = 20;
151
+ }
152
+ optional uint32 id = 97;
153
+ repeated string error = 98; // If command is missing, this will contain the error. Otherwise this will contain any warnings.
154
+ optional Status status = 99; // Should be sent back with all responses.
155
+ }
156
+
157
+ enum Status {
158
+ launched = 1; // Game has been launch and is not yet doing anything.
159
+ init_game = 2; // Create game has been called, and the host is awaiting players.
160
+ in_game = 3; // In a single or multiplayer game.
161
+ in_replay = 4; // In a replay.
162
+ ended = 5; // Game has ended, can still request game info, but ready for a new game.
163
+ quit = 6; // Application is shutting down.
164
+ unknown = 99; // Should not happen, but indicates an error if it occurs.
165
+ }
166
+
167
+ //-----------------------------------------------------------------------------
168
+ // If successful, puts the game into the status: init_game.
169
+ // The next expected request should be RequestJoinGame. Can also quit (exit).
170
+ message RequestCreateGame {
171
+ oneof Map {
172
+ LocalMap local_map = 1; // Local .SC2Map file
173
+ string battlenet_map_name = 2; // Map published to BattleNet
174
+ }
175
+
176
+ repeated PlayerSetup player_setup = 3;
177
+
178
+ optional bool disable_fog = 4;
179
+
180
+ optional uint32 random_seed = 5; // Sets the pseudo-random seed for the game.
181
+ optional bool realtime = 6; // If set, the game plays in real time.
182
+ }
183
+
184
+ message LocalMap {
185
+ // A map can be specified either by a file path or the data of the .SC2Map file.
186
+ // If you provide both, it will play the game using map_data and store map_path
187
+ // into the replay. (260 character max)
188
+ optional string map_path = 1;
189
+ optional bytes map_data = 7;
190
+ }
191
+
192
+ message ResponseCreateGame {
193
+ enum Error {
194
+ MissingMap = 1;
195
+ InvalidMapPath = 2;
196
+ InvalidMapData = 3;
197
+ InvalidMapName = 4;
198
+ InvalidMapHandle = 5;
199
+ MissingPlayerSetup = 6;
200
+ InvalidPlayerSetup = 7;
201
+ MultiplayerUnsupported = 8; // Multiplayer is not supported in the current build.
202
+ }
203
+ optional Error error = 1;
204
+ optional string error_details = 2;
205
+ }
206
+
207
+ //-----------------------------------------------------------------------------
208
+ // If successful, puts the game into the status: in_game. Will be able to
209
+ // request actions, observations and step the game.
210
+ message RequestJoinGame {
211
+ oneof participation {
212
+ Race race = 1; // Join as participant
213
+ uint32 observed_player_id = 2; // Join as observer
214
+ }
215
+
216
+ optional InterfaceOptions options = 3; // This is limited to what is specified in RequestCreateGame, but you can request less information if you want.
217
+ optional PortSet server_ports = 4; // Do not set in the single-player case. This is the port a server will use.
218
+ repeated PortSet client_ports = 5; // Do not set in the single-player case. These are the ports clients will use to initialize communication.
219
+ // Currently only a singe client is supported.
220
+ optional int32 shared_port = 6; // deprecated
221
+ optional string player_name = 7; // Use this to set the player's name to something other than autogenerated name.
222
+ optional string host_ip = 8; // Both game creator and joiner should provide the ip address of the game creator in order to play remotely. Defaults to localhost.
223
+ }
224
+
225
+ message PortSet {
226
+ optional int32 game_port = 1; // Game right now needs two internal ports to establish a multiplay game on the local host.
227
+ optional int32 base_port = 2;
228
+ }
229
+
230
+ message ResponseJoinGame {
231
+ optional uint32 player_id = 1;
232
+
233
+ enum Error {
234
+ MissingParticipation = 1;
235
+ InvalidObservedPlayerId = 2;
236
+ MissingOptions = 3;
237
+ MissingPorts = 4;
238
+ GameFull = 5;
239
+ LaunchError = 6;
240
+
241
+ // Multiplayer specific.
242
+ FeatureUnsupported = 7; // Multiplayer is not supported in the current build for the requested features.
243
+ NoSpaceForUser = 8;
244
+ MapDoesNotExist = 9;
245
+ CannotOpenMap = 10;
246
+ ChecksumError = 11;
247
+ NetworkError = 12;
248
+ OtherError = 13;
249
+ }
250
+ optional Error error = 2;
251
+ optional string error_details = 3;
252
+ }
253
+
254
+ //-----------------------------------------------------------------------------
255
+ message RequestRestartGame {
256
+ }
257
+
258
+ // The defaultRestartGameLoops is specified to be (1<<18) by default
259
+ message ResponseRestartGame {
260
+ enum Error {
261
+ LaunchError = 1;
262
+ }
263
+ optional Error error = 1;
264
+ optional string error_details = 2;
265
+ optional bool need_hard_reset = 3; // This will occur once the simulation_loop is greater then defaultRestartGameLoops
266
+ }
267
+
268
+ //-----------------------------------------------------------------------------
269
+ message RequestStartReplay {
270
+ oneof replay {
271
+ string replay_path = 1;
272
+ bytes replay_data = 5;
273
+ }
274
+ optional bytes map_data = 6; // Overrides the map path stored in the replay.
275
+ optional int32 observed_player_id = 2;
276
+ optional InterfaceOptions options = 3;
277
+
278
+ optional bool disable_fog = 4;
279
+ optional bool realtime = 7;
280
+ optional bool record_replay = 8; // Allow RequestSaveReplay from a replay. Useful for truncating a replay, or restoring tracker.events.
281
+ }
282
+
283
+ message ResponseStartReplay {
284
+ enum Error {
285
+ MissingReplay = 1;
286
+ InvalidReplayPath = 2;
287
+ InvalidReplayData = 3;
288
+ InvalidMapData = 4;
289
+ InvalidObservedPlayerId = 5;
290
+ MissingOptions = 6;
291
+ LaunchError = 7;
292
+ }
293
+ optional Error error = 1;
294
+ optional string error_details = 2;
295
+ }
296
+
297
+ //-----------------------------------------------------------------------------
298
+ message RequestMapCommand {
299
+ optional string trigger_cmd = 1;
300
+ }
301
+
302
+ message ResponseMapCommand {
303
+ enum Error {
304
+ NoTriggerError = 1;
305
+ }
306
+ optional Error error = 1;
307
+ optional string error_details = 2;
308
+ }
309
+
310
+ //-----------------------------------------------------------------------------
311
+ message RequestLeaveGame {
312
+ }
313
+
314
+ message ResponseLeaveGame {
315
+ }
316
+
317
+ //-----------------------------------------------------------------------------
318
+ message RequestQuickSave {
319
+ }
320
+
321
+ //-----------------------------------------------------------------------------
322
+ message ResponseQuickSave {
323
+ }
324
+
325
+ //-----------------------------------------------------------------------------
326
+ message RequestQuickLoad {
327
+ }
328
+
329
+ //-----------------------------------------------------------------------------
330
+ message ResponseQuickLoad {
331
+ }
332
+
333
+ //-----------------------------------------------------------------------------
334
+ message RequestQuit {
335
+ }
336
+
337
+ message ResponseQuit {
338
+ }
339
+
340
+ //-----------------------------------------------------------------------------
341
+ message RequestGameInfo {
342
+ }
343
+
344
+ message ResponseGameInfo {
345
+ optional string map_name = 1;
346
+ repeated string mod_names = 6;
347
+ optional string local_map_path = 2;
348
+ repeated PlayerInfo player_info = 3;
349
+ optional StartRaw start_raw = 4; // Populated if Raw interface is enabled.
350
+ optional InterfaceOptions options = 5;
351
+ }
352
+
353
+ //-----------------------------------------------------------------------------
354
+ message RequestObservation {
355
+ optional bool disable_fog = 1;
356
+ optional uint32 game_loop = 2; // In realtime the request will only return once the simulation game loop has reached this value. When not realtime this value is ignored.
357
+ }
358
+
359
+ message ResponseObservation {
360
+ repeated Action actions = 1; // Actions this player did since the last Observation.
361
+ repeated ActionError action_errors = 2; // Equivalent of UI "red text" errors.
362
+ optional Observation observation = 3;
363
+ repeated PlayerResult player_result = 4; // Only populated if the game ended during this step.
364
+ repeated ChatReceived chat = 5;
365
+ }
366
+
367
+ message ChatReceived {
368
+ optional uint32 player_id = 1;
369
+ optional string message = 2;
370
+ }
371
+
372
+ //-----------------------------------------------------------------------------
373
+ message RequestAction {
374
+ repeated Action actions = 1;
375
+ }
376
+
377
+ message ResponseAction {
378
+ repeated ActionResult result = 1;
379
+ }
380
+
381
+ //-----------------------------------------------------------------------------
382
+ message RequestObserverAction {
383
+ repeated ObserverAction actions = 1;
384
+ }
385
+
386
+ message ResponseObserverAction {
387
+
388
+ }
389
+
390
+ //-----------------------------------------------------------------------------
391
+ message RequestStep {
392
+ optional uint32 count = 1; // Number of game loops to simulate for the next frame.
393
+ }
394
+
395
+ message ResponseStep {
396
+ // Max simulation_loop is (1<<19) before "end of time" will occur
397
+ // The "end of time" is classified as the maximum number of game loops or absolute game time
398
+ // representable as a positive fixed point number.
399
+ // When we reach the "end of time", permanently pause the game and end the game for all.
400
+ optional uint32 simulation_loop = 1;
401
+ }
402
+
403
+ //-----------------------------------------------------------------------------
404
+ message RequestData {
405
+ optional bool ability_id = 1;
406
+ optional bool unit_type_id = 2;
407
+ optional bool upgrade_id = 3;
408
+ optional bool buff_id = 4;
409
+ optional bool effect_id = 5;
410
+ }
411
+
412
+ message ResponseData {
413
+ repeated AbilityData abilities = 1;
414
+ repeated UnitTypeData units = 2;
415
+ repeated UpgradeData upgrades = 3;
416
+ repeated BuffData buffs = 4;
417
+ repeated EffectData effects = 5;
418
+ }
419
+
420
+ //-----------------------------------------------------------------------------
421
+ message RequestSaveReplay {
422
+ }
423
+
424
+ message ResponseSaveReplay {
425
+ optional bytes data = 1;
426
+ }
427
+
428
+ //-----------------------------------------------------------------------------
429
+ message RequestReplayInfo {
430
+ oneof replay {
431
+ string replay_path = 1; // Limitation: might fail if the replay file is currently loaded.
432
+ bytes replay_data = 2;
433
+ }
434
+ optional bool download_data = 3; // Ensure the data and binary are downloaded if this is an old version replay.
435
+ }
436
+
437
+ message PlayerInfoExtra {
438
+ optional PlayerInfo player_info = 1;
439
+ optional PlayerResult player_result = 2;
440
+ optional int32 player_mmr = 3;
441
+ optional int32 player_apm = 4;
442
+ }
443
+
444
+ message ResponseReplayInfo {
445
+ optional string map_name = 1;
446
+ optional string local_map_path = 2;
447
+ repeated PlayerInfoExtra player_info = 3;
448
+ optional uint32 game_duration_loops = 4;
449
+ optional float game_duration_seconds = 5;
450
+ optional string game_version = 6;
451
+ optional string data_version = 11;
452
+ optional uint32 data_build = 7;
453
+ optional uint32 base_build = 8;
454
+
455
+ enum Error {
456
+ MissingReplay = 1;
457
+ InvalidReplayPath = 2;
458
+ InvalidReplayData = 3;
459
+ ParsingError = 4;
460
+ DownloadError = 5;
461
+ }
462
+ optional Error error = 9;
463
+ optional string error_details = 10;
464
+ }
465
+
466
+ //-----------------------------------------------------------------------------
467
+ message RequestAvailableMaps {
468
+ }
469
+
470
+ // This will only contain locally cached BattleNet maps.
471
+ // To download all ladder maps, log in and queue into a ladder match.
472
+ // To download any other map, play a custom game on that map.
473
+ message ResponseAvailableMaps {
474
+ repeated string local_map_paths = 1; // All the maps in the "Maps/" directory.
475
+ repeated string battlenet_map_names = 2; // All the maps in the BattleNet cache.
476
+ }
477
+
478
+ //-----------------------------------------------------------------------------
479
+ // Copies map data into the path specified.
480
+ message RequestSaveMap {
481
+ optional string map_path = 1; // Path the game process will write to, relative to the temp directory. (260 character max)
482
+ optional bytes map_data = 2; // Binary map data of a .SC2Map.
483
+ }
484
+
485
+ message ResponseSaveMap {
486
+ enum Error {
487
+ InvalidMapData = 1;
488
+ }
489
+ optional Error error = 1;
490
+ }
491
+
492
+ //-----------------------------------------------------------------------------
493
+ message RequestPing {
494
+ }
495
+
496
+ message ResponsePing {
497
+ optional string game_version = 1;
498
+ optional string data_version = 2;
499
+ optional uint32 data_build = 3;
500
+ optional uint32 base_build = 4;
501
+ }
502
+
503
+ //-----------------------------------------------------------------------------
504
+ message RequestDebug {
505
+ repeated DebugCommand debug = 1;
506
+ }
507
+
508
+ message ResponseDebug {
509
+ }
510
+
511
+
512
+ //
513
+ // Game Setup
514
+ //
515
+
516
+ enum Difficulty {
517
+ VeryEasy = 1;
518
+ Easy = 2;
519
+ Medium = 3;
520
+ MediumHard = 4;
521
+ Hard = 5;
522
+ Harder = 6;
523
+ VeryHard = 7;
524
+ CheatVision = 8;
525
+ CheatMoney = 9;
526
+ CheatInsane = 10;
527
+ }
528
+
529
+ enum PlayerType {
530
+ Participant = 1;
531
+ Computer = 2;
532
+ Observer = 3;
533
+ }
534
+
535
+ enum AIBuild {
536
+ RandomBuild = 1;
537
+ Rush = 2;
538
+ Timing = 3;
539
+ Power = 4;
540
+ Macro = 5;
541
+ Air = 6;
542
+ }
543
+
544
+ message PlayerSetup {
545
+ optional PlayerType type = 1;
546
+
547
+ // Only used for a computer player.
548
+ optional Race race = 2;
549
+ optional Difficulty difficulty = 3;
550
+ optional string player_name = 4;
551
+ optional AIBuild ai_build = 5;
552
+ }
553
+
554
+ message SpatialCameraSetup {
555
+ optional Size2DI resolution = 2;
556
+ optional Size2DI minimap_resolution = 3;
557
+
558
+ // Below are only relevant for feature layers.
559
+ optional float width = 1; // Set the screen camera width in world units.
560
+ optional bool crop_to_playable_area = 4; // Crop minimap to the playable area.
561
+ optional bool allow_cheating_layers = 5; // Return unit_type on the minimap, and potentially other cheating layers.
562
+ }
563
+
564
+ message InterfaceOptions {
565
+ // Interface options
566
+ optional bool raw = 1;
567
+ optional bool score = 2;
568
+ optional SpatialCameraSetup feature_layer = 3; // Omit to disable.
569
+ optional SpatialCameraSetup render = 4; // Omit to disable.
570
+ optional bool show_cloaked = 5; // By default cloaked units are completely hidden. This shows some details.
571
+ optional bool show_burrowed_shadows = 9; // By default burrowed units are completely hidden. This shows some details for those that produce a shadow.
572
+ optional bool show_placeholders = 8; // Return placeholder units (buildings to be constructed), both for raw and feature layers.
573
+
574
+ // By default raw actions select, act and revert the selection. This is useful
575
+ // if you're playing simultaneously with the agent so it doesn't steal your
576
+ // selection. This inflates APM (due to deselect) and makes the actions hard
577
+ // to follow in a replay. Setting this to true will cause raw actions to do
578
+ // select, act, but not revert the selection.
579
+ optional bool raw_affects_selection = 6;
580
+
581
+ // Changes the coordinates in raw.proto to be relative to the playable area.
582
+ // The map_size and playable_area will be the diagonal of the real playable area.
583
+ optional bool raw_crop_to_playable_area = 7;
584
+ }
585
+
586
+ message PlayerInfo {
587
+ // Identifier that will be used to reference this player.
588
+ // SC2 will always assign playerIds starting from 1 in standard Melee maps. This may not be true in custom maps.
589
+ optional uint32 player_id = 1;
590
+ optional PlayerType type = 2;
591
+ optional Race race_requested = 3;
592
+ optional Race race_actual = 4; // Only populated for your player or when watching replay
593
+ optional Difficulty difficulty = 5;
594
+ optional AIBuild ai_build = 7;
595
+ optional string player_name = 6;
596
+ }
597
+
598
+
599
+ //
600
+ // During Game
601
+ //
602
+
603
+ message PlayerCommon {
604
+ optional uint32 player_id = 1;
605
+ optional uint32 minerals = 2;
606
+ optional uint32 vespene = 3;
607
+ optional uint32 food_cap = 4;
608
+ optional uint32 food_used = 5;
609
+ optional uint32 food_army = 6;
610
+ optional uint32 food_workers = 7;
611
+ optional uint32 idle_worker_count = 8;
612
+ optional uint32 army_count = 9;
613
+ optional uint32 warp_gate_count = 10;
614
+ optional uint32 larva_count = 11;
615
+ }
616
+
617
+ message Observation {
618
+ optional uint32 game_loop = 9;
619
+ optional PlayerCommon player_common = 1;
620
+ repeated Alert alerts = 10;
621
+ repeated AvailableAbility abilities = 3; // Abilities available in the selection. Enabled if in this list, disabled otherwise.
622
+ optional Score score = 4;
623
+
624
+ optional ObservationRaw raw_data = 5; // Populated if Raw interface is enabled.
625
+ optional ObservationFeatureLayer feature_layer_data = 6; // Populated if Feature Layer interface is enabled.
626
+ optional ObservationRender render_data = 7; // Populated if Render interface is enabled.
627
+ optional ObservationUI ui_data = 8; // Populated if Feature Layer or Render interface is enabled.
628
+ }
629
+
630
+ message Action {
631
+ optional ActionRaw action_raw = 1; // Populated if Raw interface is enabled.
632
+ optional ActionSpatial action_feature_layer = 2; // Populated if Feature Layer interface is enabled.
633
+ optional ActionSpatial action_render = 3; // Not implemented. Populated if Render interface is enabled.
634
+ optional ActionUI action_ui = 4; // Populated if Feature Layer or Render interface is enabled.
635
+ optional ActionChat action_chat = 6; // Chat messages as a player typing into the chat channel.
636
+ optional uint32 game_loop = 7; // Populated for actions in ResponseObservation. The game loop on which the action was executed.
637
+ }
638
+
639
+ message ActionChat {
640
+ enum Channel {
641
+ Broadcast = 1;
642
+ Team = 2;
643
+ }
644
+ optional Channel channel = 1;
645
+ optional string message = 2;
646
+ }
647
+
648
+ message ActionError {
649
+ optional uint64 unit_tag = 1; // Only populated when using raw interface.
650
+ optional uint64 ability_id = 2;
651
+ optional ActionResult result = 3;
652
+ }
653
+
654
+ message ObserverAction {
655
+ oneof action {
656
+ ActionObserverPlayerPerspective player_perspective = 1; // Not implemented
657
+ ActionObserverCameraMove camera_move = 2;
658
+ ActionObserverCameraFollowPlayer camera_follow_player = 3;
659
+ ActionObserverCameraFollowUnits camera_follow_units = 4; // Not implemented
660
+ }
661
+ }
662
+
663
+ message ActionObserverPlayerPerspective {
664
+ optional uint32 player_id = 1; // 0 to observe "Everyone"
665
+ }
666
+
667
+ message ActionObserverCameraMove {
668
+ optional Point2D world_pos = 1;
669
+
670
+ // Distance between camera and terrain. Larger value zooms out camera.
671
+ // Defaults to standard camera distance if set to 0.
672
+ optional float distance = 2;
673
+ }
674
+
675
+ message ActionObserverCameraFollowPlayer {
676
+ optional uint32 player_id = 1; // Not implemented. Value must be [1, 15]
677
+ }
678
+
679
+ message ActionObserverCameraFollowUnits {
680
+ repeated uint64 unit_tags = 1;
681
+ }
682
+
683
+ enum Alert {
684
+ AlertError = 3;
685
+ AddOnComplete = 4;
686
+ BuildingComplete = 5;
687
+ BuildingUnderAttack = 6;
688
+ LarvaHatched = 7;
689
+ MergeComplete = 8;
690
+ MineralsExhausted = 9;
691
+ MorphComplete = 10;
692
+ MothershipComplete = 11;
693
+ MULEExpired = 12;
694
+ NuclearLaunchDetected = 1;
695
+ NukeComplete = 13;
696
+ NydusWormDetected = 2;
697
+ ResearchComplete = 14;
698
+ TrainError = 15;
699
+ TrainUnitComplete = 16;
700
+ TrainWorkerComplete = 17;
701
+ TransformationComplete = 18;
702
+ UnitUnderAttack = 19;
703
+ UpgradeComplete = 20;
704
+ VespeneExhausted = 21;
705
+ WarpInComplete = 22;
706
+ }
707
+
708
+ enum Result {
709
+ Victory = 1;
710
+ Defeat = 2;
711
+ Tie = 3;
712
+ Undecided = 4;
713
+ }
714
+
715
+ message PlayerResult {
716
+ optional uint32 player_id = 1;
717
+ optional Result result = 2;
718
+ }