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,55 @@
1
+
2
+ syntax = "proto2";
3
+
4
+ package Api;
5
+
6
+ import "common.proto";
7
+ import "error.proto";
8
+
9
+ message RequestQuery {
10
+ repeated RequestQueryPathing pathing = 1;
11
+ repeated RequestQueryAvailableAbilities abilities = 2;
12
+ repeated RequestQueryBuildingPlacement placements = 3;
13
+ optional bool ignore_resource_requirements = 4; // Ignores requirements like food, minerals and so on.
14
+ }
15
+
16
+ message ResponseQuery {
17
+ repeated ResponseQueryPathing pathing = 1;
18
+ repeated ResponseQueryAvailableAbilities abilities = 2;
19
+ repeated ResponseQueryBuildingPlacement placements = 3;
20
+ }
21
+
22
+ //--------------------------------------------------------------------------------------------------
23
+ message RequestQueryPathing {
24
+ oneof start {
25
+ Point2D start_pos = 1;
26
+ uint64 unit_tag = 2;
27
+ }
28
+ optional Point2D end_pos = 3;
29
+ }
30
+
31
+ message ResponseQueryPathing {
32
+ optional float distance = 1; // 0 if no path exists
33
+ }
34
+
35
+ //--------------------------------------------------------------------------------------------------
36
+ message RequestQueryAvailableAbilities {
37
+ optional uint64 unit_tag = 1;
38
+ }
39
+
40
+ message ResponseQueryAvailableAbilities {
41
+ repeated AvailableAbility abilities = 1;
42
+ optional uint64 unit_tag = 2;
43
+ optional uint32 unit_type_id = 3;
44
+ }
45
+
46
+ //--------------------------------------------------------------------------------------------------
47
+ message RequestQueryBuildingPlacement {
48
+ optional int32 ability_id = 1;
49
+ optional Point2D target_pos = 2;
50
+ optional uint64 placing_unit_tag = 3; // Not required
51
+ }
52
+
53
+ message ResponseQueryBuildingPlacement {
54
+ optional ActionResult result = 1;
55
+ }
@@ -0,0 +1,202 @@
1
+
2
+ syntax = "proto2";
3
+
4
+ package Api;
5
+
6
+ import "common.proto";
7
+
8
+ //
9
+ // Start
10
+ //
11
+
12
+ message StartRaw {
13
+ optional Size2DI map_size = 1; // Width and height of the map.
14
+ optional ImageData pathing_grid = 2; // 1 bit bitmap of the pathing grid.
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
+ }
20
+
21
+
22
+ //
23
+ // Observation
24
+ //
25
+
26
+ message ObservationRaw {
27
+ optional PlayerRaw player = 1;
28
+ repeated Unit units = 2;
29
+ optional MapState map_state = 3; // Fog of war, creep and so on. Board stuff that changes per frame.
30
+ optional Event event = 4;
31
+ repeated Effect effects = 5;
32
+ repeated RadarRing radar = 6;
33
+ }
34
+
35
+ message RadarRing {
36
+ optional Point pos = 1;
37
+ optional float radius = 2;
38
+ }
39
+
40
+ message PowerSource {
41
+ optional Point pos = 1;
42
+ optional float radius = 2;
43
+ optional uint64 tag = 3;
44
+ }
45
+
46
+ message PlayerRaw {
47
+ repeated PowerSource power_sources = 1;
48
+ optional Point camera = 2;
49
+ repeated uint32 upgrade_ids = 3; // TODO: Add to UI observation?
50
+ }
51
+
52
+ message UnitOrder {
53
+ optional uint32 ability_id = 1;
54
+ oneof target {
55
+ Point target_world_space_pos = 2;
56
+ uint64 target_unit_tag = 3;
57
+ }
58
+ optional float progress = 4; // Progress of train abilities. Range: [0.0, 1.0]
59
+ }
60
+
61
+ enum DisplayType {
62
+ Visible = 1; // Fully visible
63
+ Snapshot = 2; // Dimmed version of unit left behind after entering fog of war
64
+ Hidden = 3; // Fully hidden
65
+ Placeholder = 4; // Building that hasn't started construction.
66
+ }
67
+
68
+ enum Alliance {
69
+ Self = 1;
70
+ Ally = 2;
71
+ Neutral = 3;
72
+ Enemy = 4;
73
+ }
74
+
75
+ enum CloakState {
76
+ CloakedUnknown = 0; // Under the fog, so unknown whether it's cloaked or not.
77
+ Cloaked = 1;
78
+ CloakedDetected = 2;
79
+ NotCloaked = 3;
80
+ CloakedAllied = 4;
81
+ }
82
+
83
+ message PassengerUnit {
84
+ optional uint64 tag = 1;
85
+ optional float health = 2;
86
+ optional float health_max = 3;
87
+ optional float shield = 4;
88
+ optional float shield_max = 7;
89
+ optional float energy = 5;
90
+ optional float energy_max = 8;
91
+ optional uint32 unit_type = 6;
92
+ }
93
+
94
+ message RallyTarget {
95
+ optional Point point = 1; // Will always be filled.
96
+ optional uint64 tag = 2; // Only if it's targeting a unit.
97
+ }
98
+
99
+ message Unit {
100
+ // Fields are populated based on type/alliance
101
+ optional DisplayType display_type = 1;
102
+ optional Alliance alliance = 2;
103
+
104
+ optional uint64 tag = 3; // Unique identifier for a unit
105
+ optional uint32 unit_type = 4;
106
+ optional int32 owner = 5;
107
+
108
+ optional Point pos = 6;
109
+ optional float facing = 7;
110
+ optional float radius = 8;
111
+ optional float build_progress = 9; // Range: [0.0, 1.0]
112
+ optional CloakState cloak = 10;
113
+ repeated uint32 buff_ids = 27;
114
+
115
+ optional float detect_range = 31;
116
+ optional float radar_range = 32;
117
+
118
+ optional bool is_selected = 11;
119
+ optional bool is_on_screen = 12; // Visible and within the camera frustrum.
120
+ optional bool is_blip = 13; // Detected by sensor tower
121
+ optional bool is_powered = 35;
122
+ optional bool is_active = 39; // Building is training/researching (ie animated).
123
+ optional int32 attack_upgrade_level = 40;
124
+ optional int32 armor_upgrade_level = 41;
125
+ optional int32 shield_upgrade_level = 42;
126
+
127
+ // Not populated for snapshots
128
+ optional float health = 14;
129
+ optional float health_max = 15;
130
+ optional float shield = 16;
131
+ optional float shield_max = 36;
132
+ optional float energy = 17;
133
+ optional float energy_max = 37;
134
+ optional int32 mineral_contents = 18;
135
+ optional int32 vespene_contents = 19;
136
+ optional bool is_flying = 20;
137
+ optional bool is_burrowed = 21;
138
+ optional bool is_hallucination = 38; // Unit is your own or detected as a hallucination.
139
+
140
+ // Not populated for enemies
141
+ repeated UnitOrder orders = 22;
142
+ optional uint64 add_on_tag = 23;
143
+ repeated PassengerUnit passengers = 24;
144
+ optional int32 cargo_space_taken = 25;
145
+ optional int32 cargo_space_max = 26;
146
+ optional int32 assigned_harvesters = 28;
147
+ optional int32 ideal_harvesters = 29;
148
+ optional float weapon_cooldown = 30;
149
+ optional uint64 engaged_target_tag = 34;
150
+ optional int32 buff_duration_remain = 43; // How long a buff or unit is still around (eg mule, broodling, chronoboost).
151
+ optional int32 buff_duration_max = 44; // How long the buff or unit is still around (eg mule, broodling, chronoboost).
152
+ repeated RallyTarget rally_targets = 45;
153
+ }
154
+
155
+ message MapState {
156
+ optional ImageData visibility = 1; // 1 byte visibility layer.
157
+ optional ImageData creep = 2; // 1 bit creep layer.
158
+ }
159
+
160
+ message Event {
161
+ repeated uint64 dead_units = 1;
162
+ }
163
+
164
+ message Effect {
165
+ optional uint32 effect_id = 1;
166
+ repeated Point2D pos = 2; // Effect may impact multiple locations. (eg. Lurker attack)
167
+ optional Alliance alliance = 3;
168
+ optional int32 owner = 4;
169
+ optional float radius = 5;
170
+ }
171
+
172
+
173
+ //
174
+ // Action
175
+ //
176
+
177
+ message ActionRaw {
178
+ oneof action {
179
+ ActionRawUnitCommand unit_command = 1;
180
+ ActionRawCameraMove camera_move = 2;
181
+ ActionRawToggleAutocast toggle_autocast = 3;
182
+ }
183
+ }
184
+
185
+ message ActionRawUnitCommand {
186
+ optional int32 ability_id = 1;
187
+ oneof target {
188
+ Point2D target_world_space_pos = 2;
189
+ uint64 target_unit_tag = 3;
190
+ }
191
+ repeated uint64 unit_tags = 4;
192
+ optional bool queue_command = 5;
193
+ }
194
+
195
+ message ActionRawCameraMove {
196
+ optional Point center_world_space = 1;
197
+ }
198
+
199
+ message ActionRawToggleAutocast {
200
+ optional int32 ability_id = 1;
201
+ repeated uint64 unit_tags = 2;
202
+ }