sc2ai 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/sc2ai/protocol/common.proto +5 -5
- data/data/sc2ai/protocol/data.proto +22 -22
- data/data/sc2ai/protocol/debug.proto +24 -24
- data/data/sc2ai/protocol/error.proto +216 -215
- data/data/sc2ai/protocol/raw.proto +20 -20
- data/data/sc2ai/protocol/sc2api.proto +111 -111
- data/data/sc2ai/protocol/score.proto +3 -3
- data/data/sc2ai/protocol/spatial.proto +5 -5
- data/data/sc2ai/protocol/ui.proto +16 -16
- data/exe/sc2ai +0 -3
- data/lib/sc2ai/api/data.rb +3 -3
- data/lib/sc2ai/connection/connection_listener.rb +3 -3
- data/lib/sc2ai/connection/requests.rb +31 -35
- data/lib/sc2ai/connection/status_listener.rb +1 -1
- data/lib/sc2ai/connection.rb +1 -1
- data/lib/sc2ai/local_play/client.rb +2 -2
- data/lib/sc2ai/local_play/match.rb +7 -2
- data/lib/sc2ai/paths.rb +12 -2
- data/lib/sc2ai/player/actions.rb +54 -35
- data/lib/sc2ai/player/debug.rb +21 -21
- data/lib/sc2ai/player/game_state.rb +11 -18
- data/lib/sc2ai/player/geo.rb +54 -64
- data/lib/sc2ai/player/units.rb +16 -16
- data/lib/sc2ai/player.rb +103 -41
- data/lib/sc2ai/ports.rb +1 -1
- data/lib/sc2ai/protocol/_meta_documentation.rb +265 -265
- data/lib/sc2ai/protocol/common_pb.rb +3865 -15
- data/lib/sc2ai/protocol/data_pb.rb +9109 -18
- data/lib/sc2ai/protocol/debug_pb.rb +10437 -26
- data/lib/sc2ai/protocol/error_pb.rb +1086 -10
- data/lib/sc2ai/protocol/extensions/ability_remapable.rb +9 -9
- data/lib/sc2ai/protocol/extensions/action.rb +60 -0
- data/lib/sc2ai/protocol/extensions/point_2_d.rb +5 -0
- data/lib/sc2ai/protocol/extensions/position.rb +10 -35
- data/lib/sc2ai/protocol/extensions/power_source.rb +3 -0
- data/lib/sc2ai/protocol/extensions/unit.rb +19 -35
- data/lib/sc2ai/protocol/query_pb.rb +5025 -17
- data/lib/sc2ai/protocol/raw_pb.rb +18350 -27
- data/lib/sc2ai/protocol/sc2api_pb.rb +48420 -93
- data/lib/sc2ai/protocol/score_pb.rb +5968 -12
- data/lib/sc2ai/protocol/spatial_pb.rb +11944 -18
- data/lib/sc2ai/protocol/ui_pb.rb +12927 -28
- data/lib/sc2ai/unit_group/action_ext.rb +0 -2
- data/lib/sc2ai/unit_group/filter_ext.rb +10 -9
- data/lib/sc2ai/unit_group/geo_ext.rb +0 -2
- data/lib/sc2ai/unit_group.rb +1 -1
- data/lib/sc2ai/version.rb +2 -3
- data/lib/sc2ai.rb +10 -11
- data/lib/templates/ladderzip/bin/ladder.tt +0 -3
- data/lib/templates/new/api/common.proto +6 -6
- data/lib/templates/new/api/data.proto +23 -20
- data/lib/templates/new/api/debug.proto +25 -21
- data/lib/templates/new/api/error.proto +217 -215
- data/lib/templates/new/api/query.proto +1 -1
- data/lib/templates/new/api/raw.proto +16 -14
- data/lib/templates/new/api/sc2api.proto +108 -94
- data/lib/templates/new/api/score.proto +4 -3
- data/lib/templates/new/api/spatial.proto +6 -5
- data/lib/templates/new/api/ui.proto +17 -14
- data/lib/templates/new/boot.rb.tt +1 -1
- data/lib/templates/new/my_bot.rb.tt +1 -1
- data/lib/templates/new/run_example_match.rb.tt +2 -2
- data/sig/sc2ai.rbs +11005 -1926
- metadata +26 -21
- data/lib/sc2ai/overrides/kernel.rb +0 -33
- data/sig/minaswan.rbs +0 -10323
@@ -10,12 +10,12 @@ import "sc2ai/protocol/common.proto";
|
|
10
10
|
//
|
11
11
|
|
12
12
|
message StartRaw {
|
13
|
-
optional Size2DI map_size = 1
|
13
|
+
optional Size2DI map_size = 1; // Width and height of the map.
|
14
14
|
optional ImageData pathing_grid = 2; // 1 bit bitmap of the pathing grid.
|
15
|
-
optional ImageData terrain_height = 3
|
16
|
-
optional ImageData placement_grid = 4
|
17
|
-
optional RectangleI playable_area = 5
|
18
|
-
repeated Point2D start_locations = 6
|
15
|
+
optional ImageData terrain_height = 3; // 1 byte bitmap of the terrain height.
|
16
|
+
optional ImageData placement_grid = 4; // 1 bit bitmap of the building placement grid.
|
17
|
+
optional RectangleI playable_area = 5; // The playable cells.
|
18
|
+
repeated Point2D start_locations = 6; // Possible start locations for players.
|
19
19
|
}
|
20
20
|
|
21
21
|
|
@@ -59,27 +59,27 @@ message UnitOrder {
|
|
59
59
|
}
|
60
60
|
|
61
61
|
enum DisplayType {
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
62
|
+
ENUM_DISPLAY_TYPE_UNSET = 0; // PROTO3 COMPAT
|
63
|
+
VISIBLE = 1; // FULLY VISIBLE
|
64
|
+
SNAPSHOT = 2; // DIMMED VERSION OF UNIT LEFT BEHIND AFTER ENTERING FOG OF WAR
|
65
|
+
HIDDEN = 3; // FULLY HIDDEN
|
66
|
+
PLACEHOLDER = 4; // BUILDING THAT HASN'T STARTED CONSTRUCTION.
|
67
67
|
}
|
68
68
|
|
69
69
|
enum Alliance {
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
70
|
+
ENUM_ALLIANCE_UNSET = 0; // PROTO3 COMPAT
|
71
|
+
SELF = 1;
|
72
|
+
ALLY = 2;
|
73
|
+
NEUTRAL = 3;
|
74
|
+
ENEMY = 4;
|
75
75
|
}
|
76
76
|
|
77
77
|
enum CloakState {
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
78
|
+
CLOAKED_UNKNOWN = 0; // UNDER THE FOG, SO UNKNOWN WHETHER IT'S CLOAKED OR NOT.
|
79
|
+
CLOAKED = 1;
|
80
|
+
CLOAKED_DETECTED = 2;
|
81
|
+
NOT_CLOAKED = 3;
|
82
|
+
CLOAKED_ALLIED = 4;
|
83
83
|
}
|
84
84
|
|
85
85
|
message PassengerUnit {
|
@@ -155,14 +155,14 @@ message Response {
|
|
155
155
|
}
|
156
156
|
|
157
157
|
enum Status {
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
158
|
+
ENUM_STATUS_UNSET = 0; // PROTO3 COMPAT
|
159
|
+
LAUNCHED = 1; // GAME HAS BEEN LAUNCH AND IS NOT YET DOING ANYTHING.
|
160
|
+
INIT_GAME = 2; // CREATE GAME HAS BEEN CALLED, AND THE HOST IS AWAITING PLAYERS.
|
161
|
+
IN_GAME = 3; // IN A SINGLE OR MULTIPLAYER GAME.
|
162
|
+
IN_REPLAY = 4; // IN A REPLAY.
|
163
|
+
ENDED = 5; // GAME HAS ENDED, CAN STILL REQUEST GAME INFO, BUT READY FOR A NEW GAME.
|
164
|
+
QUIT = 6; // APPLICATION IS SHUTTING DOWN.
|
165
|
+
UNKNOWN = 99; // SHOULD NOT HAPPEN, BUT INDICATES AN ERROR IF IT OCCURS.
|
166
166
|
}
|
167
167
|
|
168
168
|
//-----------------------------------------------------------------------------
|
@@ -192,15 +192,15 @@ message LocalMap {
|
|
192
192
|
|
193
193
|
message ResponseCreateGame {
|
194
194
|
enum Error {
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
195
|
+
ENUM_RESPONSE_CREATE_GAME_ERROR_UNSET = 0; // PROTO3 COMPAT
|
196
|
+
MISSING_MAP = 1;
|
197
|
+
INVALID_MAP_PATH = 2;
|
198
|
+
INVALID_MAP_DATA = 3;
|
199
|
+
INVALID_MAP_NAME = 4;
|
200
|
+
INVALID_MAP_HANDLE = 5;
|
201
|
+
MISSING_PLAYER_SETUP = 6;
|
202
|
+
INVALID_PLAYER_SETUP = 7;
|
203
|
+
MULTIPLAYER_UNSUPPORTED = 8; // MULTIPLAYER IS NOT SUPPORTED IN THE CURRENT BUILD.
|
204
204
|
}
|
205
205
|
optional Error error = 1;
|
206
206
|
optional string error_details = 2;
|
@@ -233,22 +233,22 @@ message ResponseJoinGame {
|
|
233
233
|
optional uint32 player_id = 1;
|
234
234
|
|
235
235
|
enum Error {
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
//
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
236
|
+
ENUM_RESPONSE_JOIN_GAME_ERROR_UNSET = 0; // PROTO3 COMPAT
|
237
|
+
MISSING_PARTICIPATION = 1;
|
238
|
+
INVALID_OBSERVED_PLAYER_ID = 2;
|
239
|
+
MISSING_OPTIONS = 3;
|
240
|
+
MISSING_PORTS = 4;
|
241
|
+
GAME_FULL = 5;
|
242
|
+
LAUNCH_ERROR = 6;
|
243
|
+
|
244
|
+
// MULTIPLAYER SPECIFIC.
|
245
|
+
FEATURE_UNSUPPORTED = 7; // MULTIPLAYER IS NOT SUPPORTED IN THE CURRENT BUILD FOR THE REQUESTED FEATURES.
|
246
|
+
NO_SPACE_FOR_USER = 8;
|
247
|
+
MAP_DOES_NOT_EXIST = 9;
|
248
|
+
CANNOT_OPEN_MAP = 10;
|
249
|
+
CHECKSUM_ERROR = 11;
|
250
|
+
NETWORK_ERROR = 12;
|
251
|
+
OTHER_ERROR = 13;
|
252
252
|
}
|
253
253
|
optional Error error = 2;
|
254
254
|
optional string error_details = 3;
|
@@ -261,8 +261,8 @@ message RequestRestartGame {
|
|
261
261
|
// The defaultRestartGameLoops is specified to be (1<<18) by default
|
262
262
|
message ResponseRestartGame {
|
263
263
|
enum Error {
|
264
|
-
|
265
|
-
|
264
|
+
ENUM_RESPONSE_RESTART_GAME_ERROR_UNSET = 0; // PROTO3 COMPAT
|
265
|
+
LAUNCH_ERROR = 1;
|
266
266
|
}
|
267
267
|
optional Error error = 1;
|
268
268
|
optional string error_details = 2;
|
@@ -286,14 +286,14 @@ message RequestStartReplay {
|
|
286
286
|
|
287
287
|
message ResponseStartReplay {
|
288
288
|
enum Error {
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
289
|
+
ENUM_RESPONSE_START_REPLAY_ERROR_UNSET = 0; // PROTO3 COMPAT
|
290
|
+
MISSING_REPLAY = 1;
|
291
|
+
INVALID_REPLAY_PATH = 2;
|
292
|
+
INVALID_REPLAY_DATA = 3;
|
293
|
+
INVALID_MAP_DATA = 4;
|
294
|
+
INVALID_OBSERVED_PLAYER_ID = 5;
|
295
|
+
MISSING_OPTIONS = 6;
|
296
|
+
LAUNCH_ERROR = 7;
|
297
297
|
}
|
298
298
|
optional Error error = 1;
|
299
299
|
optional string error_details = 2;
|
@@ -306,8 +306,8 @@ message RequestMapCommand {
|
|
306
306
|
|
307
307
|
message ResponseMapCommand {
|
308
308
|
enum Error {
|
309
|
-
|
310
|
-
|
309
|
+
ENUM_RESPONSE_MAP_COMMAND_ERROR_UNSET = 0; // PROTO3 COMPAT
|
310
|
+
NO_TRIGGER_ERROR = 1;
|
311
311
|
}
|
312
312
|
optional Error error = 1;
|
313
313
|
optional string error_details = 2;
|
@@ -350,9 +350,9 @@ message RequestGameInfo {
|
|
350
350
|
message ResponseGameInfo {
|
351
351
|
optional string map_name = 1;
|
352
352
|
optional string local_map_path = 2;
|
353
|
-
repeated PlayerInfo player_info = 3
|
353
|
+
repeated PlayerInfo player_info = 3;
|
354
354
|
optional StartRaw start_raw = 4; // Populated if Raw interface is enabled.
|
355
|
-
optional InterfaceOptions options = 5
|
355
|
+
optional InterfaceOptions options = 5;
|
356
356
|
repeated string mod_names = 6;
|
357
357
|
}
|
358
358
|
|
@@ -366,7 +366,7 @@ message ResponseObservation {
|
|
366
366
|
repeated Action actions = 1; // Actions this player did since the last Observation.
|
367
367
|
repeated ActionError action_errors = 2; // Equivalent of UI "red text" errors.
|
368
368
|
optional Observation observation = 3;
|
369
|
-
repeated PlayerResult player_result = 4
|
369
|
+
repeated PlayerResult player_result = 4; // Only populated if the game ended during this step.
|
370
370
|
repeated ChatReceived chat = 5;
|
371
371
|
}
|
372
372
|
|
@@ -459,12 +459,12 @@ message ResponseReplayInfo {
|
|
459
459
|
optional uint32 base_build = 8;
|
460
460
|
|
461
461
|
enum Error {
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
462
|
+
ENUM_RESPONSE_REPLAY_INFO_ERROR_UNSET = 0; // PROTO3 COMPAT
|
463
|
+
MISSING_REPLAY = 1;
|
464
|
+
INVALID_REPLAY_PATH = 2;
|
465
|
+
INVALID_REPLAY_DATA = 3;
|
466
|
+
PARSING_ERROR = 4;
|
467
|
+
DOWNLOAD_ERROR = 5;
|
468
468
|
}
|
469
469
|
optional Error error = 9;
|
470
470
|
optional string error_details = 10;
|
@@ -491,8 +491,8 @@ message RequestSaveMap {
|
|
491
491
|
|
492
492
|
message ResponseSaveMap {
|
493
493
|
enum Error {
|
494
|
-
|
495
|
-
|
494
|
+
ENUM_RESPONSE_SAVE_MAP_ERROR_UNSET = 0; // PROTO3 COMPAT
|
495
|
+
INVALID_MAP_DATA = 1;
|
496
496
|
}
|
497
497
|
optional Error error = 1;
|
498
498
|
}
|
@@ -522,34 +522,34 @@ message ResponseDebug {
|
|
522
522
|
//
|
523
523
|
|
524
524
|
enum Difficulty {
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
525
|
+
ENUM_DIFFICULTY_UNSET = 0; // PROTO3 COMPAT
|
526
|
+
VERY_EASY = 1;
|
527
|
+
EASY = 2;
|
528
|
+
MEDIUM = 3;
|
529
|
+
MEDIUM_HARD = 4;
|
530
|
+
HARD = 5;
|
531
|
+
HARDER = 6;
|
532
|
+
VERY_HARD = 7;
|
533
|
+
CHEAT_VISION = 8;
|
534
|
+
CHEAT_MONEY = 9;
|
535
|
+
CHEAT_INSANE = 10;
|
536
536
|
}
|
537
537
|
|
538
538
|
enum PlayerType {
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
539
|
+
ENUM_PLAYER_TYPE_UNSET = 0; // PROTO3 COMPAT
|
540
|
+
PARTICIPANT = 1;
|
541
|
+
COMPUTER = 2;
|
542
|
+
OBSERVER = 3;
|
543
543
|
}
|
544
544
|
|
545
545
|
enum AIBuild {
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
546
|
+
ENUM_AI_BUILD_UNSET = 0; // PROTO3 COMPAT
|
547
|
+
RANDOM_BUILD = 1;
|
548
|
+
RUSH = 2;
|
549
|
+
TIMING = 3;
|
550
|
+
POWER = 4;
|
551
|
+
MACRO = 5;
|
552
|
+
AIR = 6;
|
553
553
|
}
|
554
554
|
|
555
555
|
message PlayerSetup {
|
@@ -630,11 +630,11 @@ message Observation {
|
|
630
630
|
optional PlayerCommon player_common = 1;
|
631
631
|
repeated Alert alerts = 10;
|
632
632
|
repeated AvailableAbility abilities = 3; // Abilities available in the selection. Enabled if in this list, disabled otherwise.
|
633
|
-
optional Score score = 4
|
633
|
+
optional Score score = 4;
|
634
634
|
|
635
635
|
optional ObservationRaw raw_data = 5; // Populated if Raw interface is enabled.
|
636
636
|
optional ObservationFeatureLayer feature_layer_data = 6; // Populated if Feature Layer interface is enabled.
|
637
|
-
optional ObservationRender render_data = 7
|
637
|
+
optional ObservationRender render_data = 7; // Populated if Render interface is enabled.
|
638
638
|
optional ObservationUI ui_data = 8; // Populated if Feature Layer or Render interface is enabled.
|
639
639
|
}
|
640
640
|
|
@@ -649,9 +649,9 @@ message Action {
|
|
649
649
|
|
650
650
|
message ActionChat {
|
651
651
|
enum Channel {
|
652
|
-
|
653
|
-
|
654
|
-
|
652
|
+
ENUM_CHANNEL_UNSET = 0; // PROTO3 COMPAT
|
653
|
+
BROADCAST = 1;
|
654
|
+
TEAM = 2;
|
655
655
|
}
|
656
656
|
optional Channel channel = 1;
|
657
657
|
optional string message = 2;
|
@@ -693,37 +693,37 @@ message ActionObserverCameraFollowUnits {
|
|
693
693
|
}
|
694
694
|
|
695
695
|
enum Alert {
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
696
|
+
ENUM_ALERT_UNSET = 0; // PROTO3 COMPAT
|
697
|
+
ALERT_ERROR = 3;
|
698
|
+
ADD_ON_COMPLETE = 4;
|
699
|
+
BUILDING_COMPLETE = 5;
|
700
|
+
BUILDING_UNDER_ATTACK = 6;
|
701
|
+
LARVA_HATCHED = 7;
|
702
|
+
MERGE_COMPLETE = 8;
|
703
|
+
MINERALS_EXHAUSTED = 9;
|
704
|
+
MORPH_COMPLETE = 10;
|
705
|
+
MOTHERSHIP_COMPLETE = 11;
|
706
|
+
MULE_EXPIRED = 12;
|
707
|
+
NUCLEAR_LAUNCH_DETECTED = 1;
|
708
|
+
NUKE_COMPLETE = 13;
|
709
|
+
NYDUS_WORM_DETECTED = 2;
|
710
|
+
RESEARCH_COMPLETE = 14;
|
711
|
+
TRAIN_ERROR = 15;
|
712
|
+
TRAIN_UNIT_COMPLETE = 16;
|
713
|
+
TRAIN_WORKER_COMPLETE = 17;
|
714
|
+
TRANSFORMATION_COMPLETE = 18;
|
715
|
+
UNIT_UNDER_ATTACK = 19;
|
716
|
+
UPGRADE_COMPLETE = 20;
|
717
|
+
VESPENE_EXHAUSTED = 21;
|
718
|
+
WARP_IN_COMPLETE = 22;
|
719
719
|
}
|
720
720
|
|
721
721
|
enum Result {
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
722
|
+
ENUM_RESULT_UNSET = 0; // PROTO3 COMPAT
|
723
|
+
VICTORY = 1;
|
724
|
+
DEFEAT = 2;
|
725
|
+
TIE = 3;
|
726
|
+
UNDECIDED = 4;
|
727
727
|
}
|
728
728
|
|
729
729
|
message PlayerResult {
|
@@ -5,9 +5,9 @@ package Api;
|
|
5
5
|
|
6
6
|
message Score {
|
7
7
|
enum ScoreType {
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
ENUM_SCORE_TYPE_UNSET = 0; // PROTO3 COMPAT
|
9
|
+
CURRICULUM = 1; // MAP GENERATED SCORE (FROM CURRICULUM MAPS WITH SPECIAL SCORING)
|
10
|
+
MELEE = 2; // SUMMATION OF IN_PROGRESS AND CURRENT UNITS/BUILDINGS VALUE + MINERALS + VESPENE
|
11
11
|
}
|
12
12
|
|
13
13
|
optional ScoreType score_type = 6;
|
@@ -101,11 +101,11 @@ message ActionSpatialCameraMove {
|
|
101
101
|
message ActionSpatialUnitSelectionPoint {
|
102
102
|
optional PointI selection_screen_coord = 1;
|
103
103
|
enum Type {
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
104
|
+
ENUM_ACTION_SPATIAL_UNIT_SELECTION_POINT_TYPE_UNSET = 0; // PROTO3 COMPAT
|
105
|
+
SELECT = 1; // EQUIVALENT TO NORMAL CLICK. CHANGES SELECTION TO UNIT.
|
106
|
+
TOGGLE = 2; // EQUIVALENT TO SHIFT+CLICK. TOGGLE SELECTION OF UNIT.
|
107
|
+
ALL_TYPE = 3; // EQUIVALENT TO CONTROL+CLICK. SELECTS ALL UNITS OF A GIVEN TYPE.
|
108
|
+
ADD_ALL_TYPE = 4; // EQUIVALENT TO SHIFT+CONTROL+CLICK. SELECTS ALL UNITS OF A GIVEN TYPE.
|
109
109
|
}
|
110
110
|
optional Type type = 2;
|
111
111
|
}
|
@@ -90,12 +90,12 @@ message ActionUI {
|
|
90
90
|
|
91
91
|
message ActionControlGroup {
|
92
92
|
enum ControlGroupAction {
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
93
|
+
ENUM_CONTROL_GROUP_ACTION_UNSET = 0; // PROTO3 COMPAT
|
94
|
+
RECALL = 1; // EQUIVALENT TO NUMBER HOTKEY. REPLACES CURRENT SELECTION WITH CONTROL GROUP.
|
95
|
+
SET = 2; // EQUIVALENT TO CONTROL + NUMBER HOTKEY. SETS CONTROL GROUP TO CURRENT SELECTION.
|
96
|
+
APPEND = 3; // EQUIVALENT TO SHIFT + NUMBER HOTKEY. ADDS CURRENT SELECTION INTO CONTROL GROUP.
|
97
|
+
SET_AND_STEAL = 4; // EQUIVALENT TO CONTROL + ALT + NUMBER HOTKEY. SETS CONTROL GROUP TO CURRENT SELECTION. UNITS ARE REMOVED FROM OTHER CONTROL GROUPS.
|
98
|
+
APPEND_AND_STEAL = 5; // EQUIVALENT TO SHIFT + ALT + NUMBER HOTKEY. ADDS CURRENT SELECTION INTO CONTROL GROUP. UNITS ARE REMOVED FROM OTHER CONTROL GROUPS.
|
99
99
|
}
|
100
100
|
optional ControlGroupAction action = 1;
|
101
101
|
optional uint32 control_group_index = 2;
|
@@ -114,22 +114,22 @@ message ActionSelectLarva {
|
|
114
114
|
|
115
115
|
message ActionSelectIdleWorker {
|
116
116
|
enum Type {
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
117
|
+
ENUM_ACTION_SELECT_IDLE_WORKER_TYPE_UNSET = 0; // PROTO3 COMPAT
|
118
|
+
SET = 1; // EQUIVALENT TO CLICK WITH NO MODIFIERS. REPLACES SELECTION WITH SINGLE IDLE WORKER.
|
119
|
+
ADD = 2; // EQUIVALENT TO SHIFT+CLICK. ADDS SINGLE IDLE WORKER TO CURRENT SELECTION.
|
120
|
+
ALL = 3; // EQUIVALENT TO CONTROL+CLICK. SELECTS ALL IDLE WORKERS.
|
121
|
+
ADD_ALL = 4; // EQUIVALENT TO SHIFT+CONTROL+CLICK. ADDS ALL IDLE WORKERS TO CURRENT SELECTION.
|
122
122
|
}
|
123
123
|
optional Type type = 1;
|
124
124
|
}
|
125
125
|
|
126
126
|
message ActionMultiPanel {
|
127
127
|
enum Type {
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
128
|
+
ENUM_ACTION_MULTI_PANEL_TYPE_UNSET = 0; // PROTO3 COMPAT
|
129
|
+
SINGLE_SELECT = 1; // CLICK ON ICON
|
130
|
+
DESELECT_UNIT = 2; // SHIFT CLICK ON ICON
|
131
|
+
SELECT_ALL_OF_TYPE = 3; // CONTROL CLICK ON ICON.
|
132
|
+
DESELECT_ALL_OF_TYPE = 4; // CONTROL+SHIFT CLICK ON ICON.
|
133
133
|
}
|
134
134
|
optional Type type = 1;
|
135
135
|
optional int32 unit_index = 2;
|
data/exe/sc2ai
CHANGED
data/lib/sc2ai/api/data.rb
CHANGED
@@ -46,7 +46,7 @@ module Sc2
|
|
46
46
|
|
47
47
|
# Indexes ability data by ability id
|
48
48
|
# @param abilities [Array<Api::AbilityData>]
|
49
|
-
# @return [Hash<Integer, Api::AbilityData] indexed data
|
49
|
+
# @return [Hash<Integer, Api::AbilityData>] indexed data
|
50
50
|
def abilities_from_proto(abilities)
|
51
51
|
result = {}
|
52
52
|
|
@@ -75,7 +75,7 @@ module Sc2
|
|
75
75
|
|
76
76
|
# Indexes upgrades data by id
|
77
77
|
# @param upgrades [Array<Api::UpgradeData>]
|
78
|
-
# @return [Hash<Integer, Api::UpgradeData] indexed data
|
78
|
+
# @return [Hash<Integer, Api::UpgradeData>] indexed data
|
79
79
|
def upgrades_from_proto(upgrades)
|
80
80
|
result = {}
|
81
81
|
upgrades.each do |u|
|
@@ -247,7 +247,7 @@ module Sc2
|
|
247
247
|
unit_data.mineral_cost_sum += units[Api::UnitTypeId::GATEWAY].mineral_cost
|
248
248
|
unit_data.vespene_cost_sum += units[Api::UnitTypeId::GATEWAY].vespene_cost
|
249
249
|
else
|
250
|
-
if unit_data.race == Api::Race::
|
250
|
+
if unit_data.race == Api::Race::ZERG && unit_data.attributes.include?(Api::Attribute::STRUCTURE)
|
251
251
|
unit_data.mineral_cost_sum += units[Api::UnitTypeId::DRONE].mineral_cost
|
252
252
|
end
|
253
253
|
end
|
@@ -6,21 +6,21 @@ module Sc2
|
|
6
6
|
# noinspection RubyUnusedLocalVariable
|
7
7
|
module ConnectionListener
|
8
8
|
# Called when connection established to application
|
9
|
-
# @param connection [
|
9
|
+
# @param connection [Sc2::Connection]
|
10
10
|
# noinspection
|
11
11
|
def on_connected(connection)
|
12
12
|
Sc2.logger.debug { "#{self.class}.#{__method__} #{connection}" }
|
13
13
|
end
|
14
14
|
|
15
15
|
# Called while waiting on connection to application
|
16
|
-
# @param connection [
|
16
|
+
# @param connection [Sc2::Connection]
|
17
17
|
# noinspection Lint/UnusedMethodArgument
|
18
18
|
def on_connection_waiting(connection)
|
19
19
|
Sc2.logger.debug { "#{self.class}.#{__method__} #{connection}" }
|
20
20
|
end
|
21
21
|
|
22
22
|
# Called when disconnected from application
|
23
|
-
# @param connection [
|
23
|
+
# @param connection [Sc2::Connection]
|
24
24
|
# noinspection Lint/UnusedMethodArgument
|
25
25
|
def on_disconnect(connection)
|
26
26
|
Sc2.logger.debug { "#{self.class}.#{__method__} #{connection}" }
|
@@ -24,7 +24,7 @@ module Sc2
|
|
24
24
|
end
|
25
25
|
|
26
26
|
# Send to host and all clients for game to begin.
|
27
|
-
# @param race [
|
27
|
+
# @param race [Integer] see {Api::Race}
|
28
28
|
# @param name [String] player name
|
29
29
|
# @param server_host [String] hostname or ip of sc2 client
|
30
30
|
# @param port_config [Sc2::PortConfig] port config auto or basic, using start port
|
@@ -51,16 +51,14 @@ module Sc2
|
|
51
51
|
server_ports: port_config.server_port_set,
|
52
52
|
client_ports: port_config.client_port_sets,
|
53
53
|
options: Api::InterfaceOptions.new(
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
raw_crop_to_playable_area: true
|
63
|
-
}.merge!(interface_options)
|
54
|
+
raw: true,
|
55
|
+
score: false,
|
56
|
+
feature_layer: feature_layer_interface_options(enable_feature_layer),
|
57
|
+
show_cloaked: true,
|
58
|
+
show_burrowed_shadows: true,
|
59
|
+
show_placeholders: true,
|
60
|
+
raw_affects_selection: Sc2.ladder?,
|
61
|
+
raw_crop_to_playable_area: true, **interface_options
|
64
62
|
)
|
65
63
|
)
|
66
64
|
end
|
@@ -103,7 +101,7 @@ module Sc2
|
|
103
101
|
# pp observer.api.start_replay(
|
104
102
|
# replay_path: Pathname("./replays/test.SC2Replay").realpath
|
105
103
|
# )
|
106
|
-
# while observer.status == :
|
104
|
+
# while observer.status == :IN_REPLAY
|
107
105
|
# # Step forward
|
108
106
|
# observer.api.step(1)
|
109
107
|
# # fresh observation info
|
@@ -124,27 +122,25 @@ module Sc2
|
|
124
122
|
|
125
123
|
interface_options ||= {}
|
126
124
|
send_request_for start_replay: Api::RequestStartReplay.new(
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
)
|
147
|
-
}.merge(options)
|
125
|
+
replay_path: replay_path.to_s,
|
126
|
+
replay_data: replay_data,
|
127
|
+
map_data: map_data,
|
128
|
+
realtime: false,
|
129
|
+
disable_fog: true,
|
130
|
+
record_replay: record_replay,
|
131
|
+
observed_player_id: 0,
|
132
|
+
options: Api::InterfaceOptions.new(
|
133
|
+
raw: true,
|
134
|
+
score: true,
|
135
|
+
feature_layer: feature_layer_interface_options(true),
|
136
|
+
show_cloaked: true,
|
137
|
+
show_burrowed_shadows: true,
|
138
|
+
show_placeholders: true,
|
139
|
+
raw_affects_selection: false,
|
140
|
+
raw_crop_to_playable_area: true,
|
141
|
+
**interface_options
|
142
|
+
),
|
143
|
+
**options
|
148
144
|
)
|
149
145
|
end
|
150
146
|
|
@@ -425,8 +421,8 @@ module Sc2
|
|
425
421
|
# Api::Request.new(observation: RequestObservation)
|
426
422
|
# )[:observation]
|
427
423
|
def send_request_for(**kwargs)
|
428
|
-
response = send_request(Api::Request.new(kwargs))
|
429
|
-
response
|
424
|
+
response = send_request(Api::Request.new(**kwargs))
|
425
|
+
response.send(kwargs.keys.first)
|
430
426
|
end
|
431
427
|
|
432
428
|
private
|