sc2ai 0.0.0.pre → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/data.json +1 -0
- data/data/data_readable.json +22842 -0
- data/data/sc2ai/protocol/common.proto +59 -0
- data/data/sc2ai/protocol/data.proto +120 -0
- data/data/sc2ai/protocol/debug.proto +127 -0
- data/data/sc2ai/protocol/error.proto +221 -0
- data/data/sc2ai/protocol/query.proto +55 -0
- data/data/sc2ai/protocol/raw.proto +202 -0
- data/data/sc2ai/protocol/sc2api.proto +718 -0
- data/data/sc2ai/protocol/score.proto +108 -0
- data/data/sc2ai/protocol/spatial.proto +115 -0
- data/data/sc2ai/protocol/ui.proto +145 -0
- data/data/setup/setup.SC2Map +0 -0
- data/data/setup/setup.SC2Replay +0 -0
- data/data/stableid.json +35730 -0
- data/data/versions.json +554 -0
- data/exe/sc2ai +35 -0
- data/lib/docker_build/Dockerfile.ruby +74 -0
- data/lib/docker_build/docker-compose-base-image.yml +10 -0
- data/lib/docker_build/docker-compose-ladderzip.yml +9 -0
- data/lib/sc2ai/api/ability_id.rb +1644 -0
- data/lib/sc2ai/api/buff_id.rb +306 -0
- data/lib/sc2ai/api/data.rb +101 -0
- data/lib/sc2ai/api/effect_id.rb +20 -0
- data/lib/sc2ai/api/tech_tree.rb +83 -0
- data/lib/sc2ai/api/tech_tree_data.rb +2338 -0
- data/lib/sc2ai/api/unit_type_id.rb +2022 -0
- data/lib/sc2ai/api/upgrade_id.rb +310 -0
- data/lib/sc2ai/cli/cli.rb +175 -0
- data/lib/sc2ai/cli/ladderzip.rb +154 -0
- data/lib/sc2ai/cli/new.rb +88 -0
- data/lib/sc2ai/configuration.rb +145 -0
- data/lib/sc2ai/connection/connection_listener.rb +30 -0
- data/lib/sc2ai/connection/requests.rb +417 -0
- data/lib/sc2ai/connection/status_listener.rb +15 -0
- data/lib/sc2ai/connection.rb +146 -0
- data/lib/sc2ai/local_play/client/configurable_options.rb +115 -0
- data/lib/sc2ai/local_play/client.rb +159 -0
- data/lib/sc2ai/local_play/client_manager.rb +70 -0
- data/lib/sc2ai/local_play/map_file.rb +48 -0
- data/lib/sc2ai/local_play/match.rb +184 -0
- data/lib/sc2ai/overrides/array.rb +14 -0
- data/lib/sc2ai/overrides/async/process/child.rb +31 -0
- data/lib/sc2ai/overrides/kernel.rb +33 -0
- data/lib/sc2ai/paths.rb +294 -0
- data/lib/sc2ai/player/actions.rb +386 -0
- data/lib/sc2ai/player/debug.rb +224 -0
- data/lib/sc2ai/player/game_state.rb +131 -0
- data/lib/sc2ai/player/geometry.rb +766 -0
- data/lib/sc2ai/player/previous_state.rb +49 -0
- data/lib/sc2ai/player/units.rb +337 -0
- data/lib/sc2ai/player.rb +661 -0
- data/lib/sc2ai/ports.rb +152 -0
- data/lib/sc2ai/protocol/_meta_documentation.rb +39 -0
- data/lib/sc2ai/protocol/common_pb.rb +43 -0
- data/lib/sc2ai/protocol/data_pb.rb +47 -0
- data/lib/sc2ai/protocol/debug_pb.rb +56 -0
- data/lib/sc2ai/protocol/error_pb.rb +36 -0
- data/lib/sc2ai/protocol/extensions/color.rb +20 -0
- data/lib/sc2ai/protocol/extensions/point.rb +23 -0
- data/lib/sc2ai/protocol/extensions/point_2_d.rb +26 -0
- data/lib/sc2ai/protocol/extensions/position.rb +202 -0
- data/lib/sc2ai/protocol/extensions/power_source.rb +19 -0
- data/lib/sc2ai/protocol/extensions/unit.rb +489 -0
- data/lib/sc2ai/protocol/query_pb.rb +47 -0
- data/lib/sc2ai/protocol/raw_pb.rb +57 -0
- data/lib/sc2ai/protocol/sc2api_pb.rb +130 -0
- data/lib/sc2ai/protocol/score_pb.rb +40 -0
- data/lib/sc2ai/protocol/spatial_pb.rb +48 -0
- data/lib/sc2ai/protocol/ui_pb.rb +56 -0
- data/lib/sc2ai/unit_group/action_ext.rb +74 -0
- data/lib/sc2ai/unit_group/filter_ext.rb +379 -0
- data/lib/sc2ai/unit_group.rb +277 -0
- data/lib/sc2ai/version.rb +2 -1
- data/lib/sc2ai.rb +93 -2
- data/lib/templates/ladderzip/bin/ladder.tt +23 -0
- data/lib/templates/new/.ladderignore +20 -0
- data/lib/templates/new/Gemfile.tt +7 -0
- data/lib/templates/new/api/common.proto +59 -0
- data/lib/templates/new/api/data.proto +120 -0
- data/lib/templates/new/api/debug.proto +127 -0
- data/lib/templates/new/api/error.proto +221 -0
- data/lib/templates/new/api/query.proto +55 -0
- data/lib/templates/new/api/raw.proto +202 -0
- data/lib/templates/new/api/sc2api.proto +718 -0
- data/lib/templates/new/api/score.proto +108 -0
- data/lib/templates/new/api/spatial.proto +115 -0
- data/lib/templates/new/api/ui.proto +145 -0
- data/lib/templates/new/boot.rb.tt +6 -0
- data/lib/templates/new/my_bot.rb.tt +23 -0
- data/lib/templates/new/run_example_match.rb.tt +14 -0
- data/sc2ai.gemspec +80 -0
- metadata +344 -13
@@ -0,0 +1,108 @@
|
|
1
|
+
|
2
|
+
syntax = "proto2";
|
3
|
+
|
4
|
+
package Api;
|
5
|
+
|
6
|
+
message Score {
|
7
|
+
enum ScoreType {
|
8
|
+
Curriculum = 1; // map generated score (from curriculum maps with special scoring)
|
9
|
+
Melee = 2; // summation of in-progress and current units/buildings value + minerals + vespene
|
10
|
+
}
|
11
|
+
|
12
|
+
optional ScoreType score_type = 6;
|
13
|
+
optional int32 score = 7; // Note: check score_type to know whether this is a melee score or curriculum score
|
14
|
+
optional ScoreDetails score_details = 8;
|
15
|
+
}
|
16
|
+
|
17
|
+
message CategoryScoreDetails {
|
18
|
+
optional float none = 1; // Used when no other category is configured in game data
|
19
|
+
optional float army = 2;
|
20
|
+
optional float economy = 3;
|
21
|
+
optional float technology = 4;
|
22
|
+
optional float upgrade = 5;
|
23
|
+
}
|
24
|
+
|
25
|
+
message VitalScoreDetails {
|
26
|
+
optional float life = 1;
|
27
|
+
optional float shields = 2;
|
28
|
+
optional float energy = 3;
|
29
|
+
}
|
30
|
+
|
31
|
+
message ScoreDetails {
|
32
|
+
// Sum of time any available structure able to produce a unit is not. The time stacks, as in, three idle barracks will increase idle_production_time three times quicker than just one.
|
33
|
+
optional float idle_production_time = 1;
|
34
|
+
// Sum of time any worker is not mining. Note a worker building is not idle and three idle workers will increase this value three times quicker than just one.
|
35
|
+
optional float idle_worker_time = 2;
|
36
|
+
|
37
|
+
// Sum of minerals and vespene spent on completed units.
|
38
|
+
optional float total_value_units = 3;
|
39
|
+
// Sum of minerals and vespene spent on completed structures.
|
40
|
+
optional float total_value_structures = 4;
|
41
|
+
|
42
|
+
// Sum of minerals and vespene of units, belonging to the opponent, that the player has destroyed.
|
43
|
+
optional float killed_value_units = 5;
|
44
|
+
// Sum of minerals and vespene of structures, belonging to the opponent, that the player has destroyed.
|
45
|
+
optional float killed_value_structures = 6;
|
46
|
+
|
47
|
+
// Sum of minerals collected by the player.
|
48
|
+
optional float collected_minerals = 7;
|
49
|
+
// Sum of vespene collected by the player.
|
50
|
+
optional float collected_vespene = 8;
|
51
|
+
|
52
|
+
// Estimated income of minerals over the next minute based on the players current income. The unit is minerals per minute.
|
53
|
+
optional float collection_rate_minerals = 9;
|
54
|
+
// Estimated income of vespene over the next minute based on the players current income. The unit is vespene per minute.
|
55
|
+
optional float collection_rate_vespene = 10;
|
56
|
+
|
57
|
+
// Sum of spent minerals at the moment it is spent. For example, this number is incremented by 50 the moment an scv is queued in a command center. It is decremented by 50 if that unit is canceled.
|
58
|
+
optional float spent_minerals = 11;
|
59
|
+
// Sum of spent vespene at the moment it is spent. For example, this number is incremented by 50 when a reaper is queued but decremented by 50 if it is canceled.
|
60
|
+
optional float spent_vespene = 12;
|
61
|
+
|
62
|
+
// The following entries contains floating point values for the following catgories:
|
63
|
+
// none - There is no category defined in game data.
|
64
|
+
// army - This category includes all military units but not workers.
|
65
|
+
// economy - This category contains town halls, supply structures, vespene buildings and workers.
|
66
|
+
// technology - This category is any structure that produces units or upgrades, Barracks and Engineering Bays both fall in this category, for example.
|
67
|
+
// upgrade - This category is upgrades such as warp gate or weapons upgrades.
|
68
|
+
|
69
|
+
// Sum of food, or supply, utilized in the categories above.
|
70
|
+
optional CategoryScoreDetails food_used = 13;
|
71
|
+
|
72
|
+
// Sum of enemies catagories destroyed in minerals.
|
73
|
+
optional CategoryScoreDetails killed_minerals = 14;
|
74
|
+
// Sum of enemies catagories destroyed in vespene.
|
75
|
+
optional CategoryScoreDetails killed_vespene = 15;
|
76
|
+
|
77
|
+
// Sum of lost minerals for the player in each category.
|
78
|
+
optional CategoryScoreDetails lost_minerals = 16;
|
79
|
+
// Sum of lost vespene for the player in each category.
|
80
|
+
optional CategoryScoreDetails lost_vespene = 17;
|
81
|
+
|
82
|
+
// Sum of the lost minerals via destroying the players own units/buildings.
|
83
|
+
optional CategoryScoreDetails friendly_fire_minerals = 18;
|
84
|
+
// Sum of the lost vespene via destroying the players own units/buildings.
|
85
|
+
optional CategoryScoreDetails friendly_fire_vespene = 19;
|
86
|
+
|
87
|
+
// Sum of used minerals for the player in each category for each existing unit or upgrade. Therefore if a unit died worth 50 mierals this number will be decremented by 50.
|
88
|
+
optional CategoryScoreDetails used_minerals = 20;
|
89
|
+
// Sum of used vespene for the player in each category. Therefore if a unit died worth 50 vespene this number will be decremented by 50.
|
90
|
+
optional CategoryScoreDetails used_vespene = 21;
|
91
|
+
|
92
|
+
// Sum of used minerals throughout the entire game for each category. Unliked used_minerals, this value is never decremented.
|
93
|
+
optional CategoryScoreDetails total_used_minerals = 22;
|
94
|
+
// Sum of used vespene throughout the entire game for each category. Unliked used_vespene, this value is never decremented.
|
95
|
+
optional CategoryScoreDetails total_used_vespene = 23;
|
96
|
+
|
97
|
+
// Sum of damage dealt to the player's opponent for each category.
|
98
|
+
optional VitalScoreDetails total_damage_dealt = 24;
|
99
|
+
// Sum of damage taken by the player for each category.
|
100
|
+
optional VitalScoreDetails total_damage_taken = 25;
|
101
|
+
// Sum of health healed by the player. Note that technology can be healed (by queens) or repaired (by scvs).
|
102
|
+
optional VitalScoreDetails total_healed = 26;
|
103
|
+
|
104
|
+
// Recent raw APM.
|
105
|
+
optional float current_apm = 27;
|
106
|
+
// Recent effective APM.
|
107
|
+
optional float current_effective_apm = 28;
|
108
|
+
}
|
@@ -0,0 +1,115 @@
|
|
1
|
+
|
2
|
+
syntax = "proto2";
|
3
|
+
|
4
|
+
package Api;
|
5
|
+
|
6
|
+
import "common.proto";
|
7
|
+
|
8
|
+
//
|
9
|
+
// Observation - Feature Layer
|
10
|
+
//
|
11
|
+
|
12
|
+
message ObservationFeatureLayer {
|
13
|
+
optional FeatureLayers renders = 1;
|
14
|
+
optional FeatureLayersMinimap minimap_renders = 2;
|
15
|
+
}
|
16
|
+
|
17
|
+
message FeatureLayers {
|
18
|
+
optional ImageData height_map = 1; // uint8. Terrain height. World space units of [-200, 200] encoded into [0, 255].
|
19
|
+
optional ImageData visibility_map = 2; // uint8. 0=Hidden, 1=Fogged, 2=Visible, 3=FullHidden
|
20
|
+
optional ImageData creep = 3; // 1-bit. Zerg creep.
|
21
|
+
optional ImageData power = 4; // 1-bit. Protoss power.
|
22
|
+
optional ImageData player_id = 5; // uint8. Participants: [1, 15] Neutral: 16
|
23
|
+
optional ImageData unit_type = 6; // int32. Unique identifier for type of unit.
|
24
|
+
optional ImageData selected = 7; // 1-bit. Selected units.
|
25
|
+
optional ImageData unit_hit_points = 8; // int32.
|
26
|
+
optional ImageData unit_hit_points_ratio = 17; // uint8. Ratio of current health to max health. [0%, 100%] encoded into [0, 255].
|
27
|
+
optional ImageData unit_energy = 9; // int32.
|
28
|
+
optional ImageData unit_energy_ratio = 18; // uint8. Ratio of current energy to max energy. [0%, 100%] encoded into [0, 255].
|
29
|
+
optional ImageData unit_shields = 10; // int32.
|
30
|
+
optional ImageData unit_shields_ratio = 19; // uint8. Ratio of current shields to max shields. [0%, 100%] encoded into [0, 255].
|
31
|
+
optional ImageData player_relative = 11; // uint8. See "Alliance" enum in raw.proto. Range: [1, 4]
|
32
|
+
optional ImageData unit_density_aa = 14; // uint8. Density of units overlapping a pixel, anti-aliased. [0.0, 16.0f] encoded into [0, 255].
|
33
|
+
optional ImageData unit_density = 15; // uint8. Count of units overlapping a pixel.
|
34
|
+
optional ImageData effects = 20; // uint8. Visuals of persistent abilities. (eg. Psistorm)
|
35
|
+
optional ImageData hallucinations = 21; // 1-bit. Whether the unit here is a hallucination.
|
36
|
+
optional ImageData cloaked = 22; // 1-bit. Whether the unit here is cloaked. Hidden units will show up too, but with less details in other layers.
|
37
|
+
optional ImageData blip = 23; // 1-bit. Whether the unit here is a blip.
|
38
|
+
optional ImageData buffs = 24; // int32. One of the buffs applied to this unit. Extras are ignored.
|
39
|
+
optional ImageData buff_duration = 26; // uint8. Ratio of buff remaining. [0%, 100%] encoded into [0, 255].
|
40
|
+
optional ImageData active = 25; // 1-bit. Whether the unit here is active.
|
41
|
+
optional ImageData build_progress = 27; // uint8. How far along the building is building something. [0%, 100%] encoded into [0, 255].
|
42
|
+
optional ImageData buildable = 28; // 1-bit. Whether a building can be built here.
|
43
|
+
optional ImageData pathable = 29; // 1-bit. Whether a unit can walk here.
|
44
|
+
optional ImageData placeholder = 30; // 1-bit. Whether the unit here is a placeholder building to be constructed.
|
45
|
+
}
|
46
|
+
|
47
|
+
message FeatureLayersMinimap {
|
48
|
+
optional ImageData height_map = 1; // uint8. Terrain height. World space units of [-200, 200] encoded into [0, 255].
|
49
|
+
optional ImageData visibility_map = 2; // uint8. 0=Hidden, 1=Fogged, 2=Visible, 3=FullHidden
|
50
|
+
optional ImageData creep = 3; // 1-bit. Zerg creep.
|
51
|
+
optional ImageData camera = 4; // 1-bit. Area covered by the camera.
|
52
|
+
optional ImageData player_id = 5; // uint8. Participants: [1, 15] Neutral: 16
|
53
|
+
optional ImageData player_relative = 6; // uint8. See "Alliance" enum in raw.proto. Range: [1, 4]
|
54
|
+
optional ImageData selected = 7; // 1-bit. Selected units.
|
55
|
+
optional ImageData alerts = 9; // 1-bit. Shows 'UnitAttacked' alert location.
|
56
|
+
optional ImageData buildable = 10; // 1-bit. Whether a building can be built here.
|
57
|
+
optional ImageData pathable = 11; // 1-bit. Whether a unit can walk here.
|
58
|
+
|
59
|
+
// Cheat layers, enable with SpatialCameraSetup.allow_cheating_layers.
|
60
|
+
optional ImageData unit_type = 8; // int32. Unique identifier for type of unit.
|
61
|
+
}
|
62
|
+
|
63
|
+
|
64
|
+
//
|
65
|
+
// Observation - Rendered
|
66
|
+
//
|
67
|
+
|
68
|
+
message ObservationRender {
|
69
|
+
optional ImageData map = 1;
|
70
|
+
optional ImageData minimap = 2;
|
71
|
+
}
|
72
|
+
|
73
|
+
|
74
|
+
//
|
75
|
+
// Action
|
76
|
+
//
|
77
|
+
|
78
|
+
message ActionSpatial {
|
79
|
+
oneof action {
|
80
|
+
ActionSpatialUnitCommand unit_command = 1;
|
81
|
+
ActionSpatialCameraMove camera_move = 2;
|
82
|
+
ActionSpatialUnitSelectionPoint unit_selection_point = 3;
|
83
|
+
ActionSpatialUnitSelectionRect unit_selection_rect = 4;
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
message ActionSpatialUnitCommand {
|
88
|
+
optional int32 ability_id = 1;
|
89
|
+
oneof target {
|
90
|
+
PointI target_screen_coord = 2;
|
91
|
+
PointI target_minimap_coord = 3;
|
92
|
+
}
|
93
|
+
|
94
|
+
optional bool queue_command = 4; // Equivalent to shift+command.
|
95
|
+
}
|
96
|
+
|
97
|
+
message ActionSpatialCameraMove {
|
98
|
+
optional PointI center_minimap = 1; // Simulates a click on the minimap to move the camera.
|
99
|
+
}
|
100
|
+
|
101
|
+
message ActionSpatialUnitSelectionPoint {
|
102
|
+
optional PointI selection_screen_coord = 1;
|
103
|
+
enum Type {
|
104
|
+
Select = 1; // Equivalent to normal click. Changes selection to unit.
|
105
|
+
Toggle = 2; // Equivalent to shift+click. Toggle selection of unit.
|
106
|
+
AllType = 3; // Equivalent to control+click. Selects all units of a given type.
|
107
|
+
AddAllType = 4; // Equivalent to shift+control+click. Selects all units of a given type.
|
108
|
+
}
|
109
|
+
optional Type type = 2;
|
110
|
+
}
|
111
|
+
|
112
|
+
message ActionSpatialUnitSelectionRect {
|
113
|
+
repeated RectangleI selection_screen_coord = 1; // Eventually this should not be an array, but a single field (multiple would be cheating).
|
114
|
+
optional bool selection_add = 2; // Equivalent to shift+drag. Adds units to selection.
|
115
|
+
}
|
@@ -0,0 +1,145 @@
|
|
1
|
+
|
2
|
+
syntax = "proto2";
|
3
|
+
|
4
|
+
package Api;
|
5
|
+
|
6
|
+
//
|
7
|
+
// Observation
|
8
|
+
//
|
9
|
+
|
10
|
+
message ObservationUI {
|
11
|
+
repeated ControlGroup groups = 1;
|
12
|
+
oneof panel {
|
13
|
+
SinglePanel single = 2;
|
14
|
+
MultiPanel multi = 3;
|
15
|
+
CargoPanel cargo = 4;
|
16
|
+
ProductionPanel production = 5;
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
message ControlGroup {
|
21
|
+
optional uint32 control_group_index = 1;
|
22
|
+
optional uint32 leader_unit_type = 2;
|
23
|
+
optional uint32 count = 3;
|
24
|
+
}
|
25
|
+
|
26
|
+
message UnitInfo {
|
27
|
+
optional uint32 unit_type = 1;
|
28
|
+
optional uint32 player_relative = 2;
|
29
|
+
optional int32 health = 3;
|
30
|
+
optional int32 shields = 4;
|
31
|
+
optional int32 energy = 5;
|
32
|
+
optional int32 transport_slots_taken = 6;
|
33
|
+
optional float build_progress = 7; // Range: [0.0, 1.0]
|
34
|
+
optional UnitInfo add_on = 8;
|
35
|
+
optional int32 max_health = 9;
|
36
|
+
optional int32 max_shields = 10;
|
37
|
+
optional int32 max_energy = 11;
|
38
|
+
}
|
39
|
+
|
40
|
+
message SinglePanel {
|
41
|
+
optional UnitInfo unit = 1;
|
42
|
+
optional int32 attack_upgrade_level = 2;
|
43
|
+
optional int32 armor_upgrade_level = 3;
|
44
|
+
optional int32 shield_upgrade_level = 4;
|
45
|
+
repeated int32 buffs = 5;
|
46
|
+
}
|
47
|
+
|
48
|
+
message MultiPanel {
|
49
|
+
repeated UnitInfo units = 1;
|
50
|
+
}
|
51
|
+
|
52
|
+
message CargoPanel {
|
53
|
+
optional UnitInfo unit = 1;
|
54
|
+
repeated UnitInfo passengers = 2;
|
55
|
+
optional int32 slots_available = 3; // TODO: Change to cargo size
|
56
|
+
}
|
57
|
+
|
58
|
+
message BuildItem {
|
59
|
+
optional uint32 ability_id = 1;
|
60
|
+
optional float build_progress = 2; // Range: [0.0, 1.0]
|
61
|
+
}
|
62
|
+
|
63
|
+
message ProductionPanel {
|
64
|
+
optional UnitInfo unit = 1;
|
65
|
+
|
66
|
+
// build_queue ONLY gives information about units that are being produced.
|
67
|
+
// Use production_queue instead to see both units being trained as well as research in the queue.
|
68
|
+
repeated UnitInfo build_queue = 2;
|
69
|
+
repeated BuildItem production_queue = 3;
|
70
|
+
}
|
71
|
+
|
72
|
+
|
73
|
+
//
|
74
|
+
// Action
|
75
|
+
//
|
76
|
+
|
77
|
+
message ActionUI {
|
78
|
+
oneof action {
|
79
|
+
ActionControlGroup control_group = 1;
|
80
|
+
ActionSelectArmy select_army = 2;
|
81
|
+
ActionSelectWarpGates select_warp_gates = 3;
|
82
|
+
ActionSelectLarva select_larva = 4;
|
83
|
+
ActionSelectIdleWorker select_idle_worker = 5;
|
84
|
+
ActionMultiPanel multi_panel = 6;
|
85
|
+
ActionCargoPanelUnload cargo_panel = 7;
|
86
|
+
ActionProductionPanelRemoveFromQueue production_panel = 8;
|
87
|
+
ActionToggleAutocast toggle_autocast = 9;
|
88
|
+
}
|
89
|
+
}
|
90
|
+
|
91
|
+
message ActionControlGroup {
|
92
|
+
enum ControlGroupAction {
|
93
|
+
Recall = 1; // Equivalent to number hotkey. Replaces current selection with control group.
|
94
|
+
Set = 2; // Equivalent to Control + number hotkey. Sets control group to current selection.
|
95
|
+
Append = 3; // Equivalent to Shift + number hotkey. Adds current selection into control group.
|
96
|
+
SetAndSteal = 4; // Equivalent to Control + Alt + number hotkey. Sets control group to current selection. Units are removed from other control groups.
|
97
|
+
AppendAndSteal = 5; // Equivalent to Shift + Alt + number hotkey. Adds current selection into control group. Units are removed from other control groups.
|
98
|
+
}
|
99
|
+
optional ControlGroupAction action = 1;
|
100
|
+
optional uint32 control_group_index = 2;
|
101
|
+
}
|
102
|
+
|
103
|
+
message ActionSelectArmy {
|
104
|
+
optional bool selection_add = 1;
|
105
|
+
}
|
106
|
+
|
107
|
+
message ActionSelectWarpGates {
|
108
|
+
optional bool selection_add = 1;
|
109
|
+
}
|
110
|
+
|
111
|
+
message ActionSelectLarva {
|
112
|
+
}
|
113
|
+
|
114
|
+
message ActionSelectIdleWorker {
|
115
|
+
enum Type {
|
116
|
+
Set = 1; // Equivalent to click with no modifiers. Replaces selection with single idle worker.
|
117
|
+
Add = 2; // Equivalent to shift+click. Adds single idle worker to current selection.
|
118
|
+
All = 3; // Equivalent to control+click. Selects all idle workers.
|
119
|
+
AddAll = 4; // Equivalent to shift+control+click. Adds all idle workers to current selection.
|
120
|
+
}
|
121
|
+
optional Type type = 1;
|
122
|
+
}
|
123
|
+
|
124
|
+
message ActionMultiPanel {
|
125
|
+
enum Type {
|
126
|
+
SingleSelect = 1; // Click on icon
|
127
|
+
DeselectUnit = 2; // Shift Click on icon
|
128
|
+
SelectAllOfType = 3; // Control Click on icon.
|
129
|
+
DeselectAllOfType = 4; // Control+Shift Click on icon.
|
130
|
+
}
|
131
|
+
optional Type type = 1;
|
132
|
+
optional int32 unit_index = 2;
|
133
|
+
}
|
134
|
+
|
135
|
+
message ActionCargoPanelUnload {
|
136
|
+
optional int32 unit_index = 1;
|
137
|
+
}
|
138
|
+
|
139
|
+
message ActionProductionPanelRemoveFromQueue {
|
140
|
+
optional int32 unit_index = 1;
|
141
|
+
}
|
142
|
+
|
143
|
+
message ActionToggleAutocast {
|
144
|
+
optional int32 ability_id = 1;
|
145
|
+
}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
# This file should require your bot and create a $bot.
|
2
|
+
# You are free to rename your bot class, name or restructure your code as long
|
3
|
+
# as $bot is created correctly. if not, your ladder bot will break.
|
4
|
+
|
5
|
+
require_relative "<%= @bot_file %>"
|
6
|
+
$bot = <%= @classname %>.new(name: "<%= @botname %>", race: Api::Race::<%= @race %>)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require "sc2ai"
|
2
|
+
|
3
|
+
class <%= @classname %> < Sc2::Player::Bot
|
4
|
+
|
5
|
+
def configure
|
6
|
+
@realtime = false # Step-mode vs Bot, Realtime vs Humans
|
7
|
+
@step_size = 1 # Gives 22.4ms, typically compete at 2 (44.8ms) or 4 (179.2ms).
|
8
|
+
@enable_feature_layer = false; # Enables ui_ and spatial_ actions. Advanced, and has performance cost.
|
9
|
+
end
|
10
|
+
|
11
|
+
def on_step
|
12
|
+
if game_loop == 0
|
13
|
+
enemy_start_pos = game_info.start_raw.start_locations.first
|
14
|
+
units.workers.attack(target: enemy_start_pos)
|
15
|
+
end
|
16
|
+
|
17
|
+
# If your attack fails, "good game" and exit
|
18
|
+
if units.workers.size.zero?
|
19
|
+
action_chat("gg", channel: Api::ActionChat::Channel::Broadcast)
|
20
|
+
leave_game
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Use the ladder's boot.rb file and configure there
|
2
|
+
require "./boot.rb"
|
3
|
+
|
4
|
+
# Or simply, create by hand
|
5
|
+
#my_bot = MyBot.new(name: "Botname", race: Api::Race::Random)
|
6
|
+
|
7
|
+
# Start a match
|
8
|
+
Sc2::Match.new(
|
9
|
+
players: [
|
10
|
+
$bot,
|
11
|
+
Sc2::Player::Computer.new(race: Api::Race::Random, difficulty: Api::Difficulty::VeryEasy)
|
12
|
+
],
|
13
|
+
map: "Goldenaura512AIE" # Or any of the downloaded map names
|
14
|
+
).run
|
data/sc2ai.gemspec
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift(File.expand_path("./lib"))
|
4
|
+
require_relative "lib/sc2ai/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "sc2ai"
|
8
|
+
spec.version = Sc2::VERSION
|
9
|
+
spec.authors = ["Dyson Returns"]
|
10
|
+
|
11
|
+
spec.summary = "STARCRAFT® II AI API"
|
12
|
+
spec.description = "This is a Ruby interface to STARCRAFT® II. It can be used for machine learning via Rumale or custom scripted AI battle."
|
13
|
+
spec.homepage = "https://www.github.com/dysonreturns/sc2ai"
|
14
|
+
spec.licenses = ["MIT", "Nonstandard"]
|
15
|
+
spec.required_ruby_version = ">= 3.2.2"
|
16
|
+
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
# spec.metadata["source_code_uri"] = spec.homepage
|
19
|
+
spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/main/docs/CHANGELOG.md"
|
20
|
+
|
21
|
+
# Specify which files should be added to the gem when it is released.
|
22
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
+
spec.files = Dir.chdir(__dir__) do
|
24
|
+
`git ls-files -z`.split("\x0").select do |f|
|
25
|
+
(File.expand_path(f) == __FILE__) ||
|
26
|
+
%r{\A(?:lib|data|exe)/}.match?(f)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
spec.bindir = "exe"
|
31
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
32
|
+
spec.require_paths = ["lib"]
|
33
|
+
|
34
|
+
# Live dependencies ---
|
35
|
+
spec.add_dependency "async", "2.6.5"
|
36
|
+
# Sc2::Connection
|
37
|
+
spec.add_dependency "async-websocket", "0.26.0"
|
38
|
+
spec.add_dependency "google-protobuf", "3.25.1"
|
39
|
+
# Sc2::Client / Controller
|
40
|
+
spec.add_dependency "async-process", "1.3.1"
|
41
|
+
# Cli
|
42
|
+
spec.add_dependency "thor", "1.3.0"
|
43
|
+
|
44
|
+
# Geometry
|
45
|
+
spec.add_dependency "perfect-shape", "1.0.8"
|
46
|
+
|
47
|
+
spec.add_dependency "numo-narray", "0.9.2.1"
|
48
|
+
spec.add_dependency "numo-linalg", "0.1.7"
|
49
|
+
spec.add_dependency "rumale", "0.28.1"
|
50
|
+
|
51
|
+
# TODO: Find a way to not depend on a patched gem and yank this
|
52
|
+
spec.add_dependency "sc2ai-kdtree", "~> 0.4"
|
53
|
+
|
54
|
+
# Pre-packaged ladder dependencies
|
55
|
+
# We add these locally, so that authors know what to use
|
56
|
+
# spec.add_dependency "activerecord", "7.1.2"
|
57
|
+
# spec.add_dependency "sqlite3", "1.7.0"
|
58
|
+
# spec.add_dependency "rb_sys", "0.9.85"
|
59
|
+
# spec.add_dependency "concurrent-ruby", "1.2.2"
|
60
|
+
# spec.add_dependency "parallel", "1.24.0"
|
61
|
+
|
62
|
+
# Dev dependencies ---
|
63
|
+
spec.add_development_dependency "rake", "~> 13.1"
|
64
|
+
# Doc
|
65
|
+
spec.add_development_dependency "yard", "~> 0.9"
|
66
|
+
# Linting
|
67
|
+
# spec.add_development_dependency "fasterer" # no 3.3 support yet
|
68
|
+
spec.add_development_dependency "standard", "~> 1.33"
|
69
|
+
|
70
|
+
# Profiling
|
71
|
+
spec.add_development_dependency "memory_profiler", "~> 1.0"
|
72
|
+
spec.add_development_dependency "benchmark", "~> 0.3"
|
73
|
+
spec.add_development_dependency "benchmark-ips", "~> 2.13"
|
74
|
+
|
75
|
+
# Testing
|
76
|
+
spec.add_development_dependency "factory_bot", "~> 6.4"
|
77
|
+
spec.add_development_dependency "fakefs", "~> 2.5"
|
78
|
+
spec.add_development_dependency "rspec", "~> 3.12"
|
79
|
+
spec.add_development_dependency "simplecov", "~> 0.22"
|
80
|
+
end
|