sc2ai 0.0.8 → 0.2.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 +1 -1
- data/data/sc2ai/protocol/data.proto +4 -1
- data/data/sc2ai/protocol/debug.proto +5 -1
- data/data/sc2ai/protocol/error.proto +2 -1
- data/data/sc2ai/protocol/query.proto +1 -1
- data/data/sc2ai/protocol/raw.proto +9 -7
- data/data/sc2ai/protocol/sc2api.proto +21 -7
- data/data/sc2ai/protocol/score.proto +2 -1
- data/data/sc2ai/protocol/spatial.proto +2 -1
- data/data/sc2ai/protocol/ui.proto +5 -2
- data/lib/docker_build/Dockerfile.ruby +5 -3
- data/lib/sc2ai/api/ability_id.rb +6 -1
- data/lib/sc2ai/api/data.rb +15 -0
- data/lib/sc2ai/api/tech_tree.rb +1 -1
- data/lib/sc2ai/api/tech_tree_data.rb +54 -3
- data/lib/sc2ai/cli/cli.rb +1 -1
- data/lib/sc2ai/connection.rb +1 -1
- data/lib/sc2ai/local_play/client_manager.rb +2 -0
- data/lib/sc2ai/local_play/match.rb +0 -11
- data/lib/sc2ai/overrides/async/process/child.rb +1 -1
- data/lib/sc2ai/paths.rb +1 -1
- data/lib/sc2ai/player/debug.rb +36 -2
- data/lib/sc2ai/player/{geometry.rb → geo.rb} +41 -5
- data/lib/sc2ai/player/units.rb +32 -2
- data/lib/sc2ai/player.rb +8 -48
- data/lib/sc2ai/ports.rb +0 -1
- data/lib/sc2ai/protocol/_meta_documentation.rb +249 -4
- data/lib/sc2ai/protocol/common_pb.rb +2 -23
- data/lib/sc2ai/protocol/data_pb.rb +2 -23
- data/lib/sc2ai/protocol/debug_pb.rb +2 -24
- data/lib/sc2ai/protocol/error_pb.rb +2 -23
- data/lib/sc2ai/protocol/extensions/color.rb +1 -1
- data/lib/sc2ai/protocol/extensions/point_2_d.rb +4 -0
- data/lib/sc2ai/protocol/extensions/position.rb +1 -1
- data/lib/sc2ai/protocol/extensions/unit.rb +45 -4
- data/lib/sc2ai/protocol/extensions/unit_type_data.rb +8 -0
- data/lib/sc2ai/protocol/query_pb.rb +2 -24
- data/lib/sc2ai/protocol/raw_pb.rb +2 -24
- data/lib/sc2ai/protocol/sc2api_pb.rb +2 -31
- data/lib/sc2ai/protocol/score_pb.rb +2 -23
- data/lib/sc2ai/protocol/spatial_pb.rb +2 -24
- data/lib/sc2ai/protocol/ui_pb.rb +2 -23
- data/lib/sc2ai/unit_group/action_ext.rb +2 -2
- data/lib/sc2ai/unit_group/filter_ext.rb +36 -1
- data/lib/sc2ai/version.rb +1 -1
- data/lib/sc2ai.rb +0 -7
- data/lib/templates/new/.ladderignore +15 -5
- data/lib/templates/new/api/raw.proto +1 -1
- data/lib/templates/new/api/ui.proto +1 -1
- data/lib/templates/new/my_bot.rb.tt +1 -1
- data/sig/minaswan.rbs +10323 -0
- data/sig/sc2ai.rbs +1170 -980
- metadata +52 -25
- data/lib/sc2ai/data.rb +0 -101
- data/lib/sc2ai/protocol/extensions/unit_type.rb +0 -9
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sc2ai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dyson Returns
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|
@@ -16,112 +16,112 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: '2.20'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: '2.20'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: async-websocket
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: '0.30'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: '0.30'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: google-protobuf
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 4.
|
47
|
+
version: '4.28'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 4.
|
54
|
+
version: '4.28'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: async-process
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
61
|
+
version: '1.4'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.
|
68
|
+
version: '1.4'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: thor
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.3
|
75
|
+
version: '1.3'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.3
|
82
|
+
version: '1.3'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: numo-narray
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.9
|
89
|
+
version: '0.9'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.9
|
96
|
+
version: '0.9'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: numo-linalg
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.1
|
103
|
+
version: '0.1'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.1
|
110
|
+
version: '0.1'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rumale
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.29
|
117
|
+
version: '0.29'
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0.29
|
124
|
+
version: '0.29'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: sc2ai-kdtree
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,6 +164,34 @@ dependencies:
|
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: 0.9.36
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: abbrev
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 0.1.2
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: 0.1.2
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: ostruct
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - "~>"
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: 0.6.0
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - "~>"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: 0.6.0
|
167
195
|
- !ruby/object:Gem::Dependency
|
168
196
|
name: webrick
|
169
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -198,14 +226,14 @@ dependencies:
|
|
198
226
|
requirements:
|
199
227
|
- - "~>"
|
200
228
|
- !ruby/object:Gem::Version
|
201
|
-
version: '1.
|
229
|
+
version: '1.40'
|
202
230
|
type: :development
|
203
231
|
prerelease: false
|
204
232
|
version_requirements: !ruby/object:Gem::Requirement
|
205
233
|
requirements:
|
206
234
|
- - "~>"
|
207
235
|
- !ruby/object:Gem::Version
|
208
|
-
version: '1.
|
236
|
+
version: '1.40'
|
209
237
|
- !ruby/object:Gem::Dependency
|
210
238
|
name: factory_bot
|
211
239
|
requirement: !ruby/object:Gem::Requirement
|
@@ -321,7 +349,6 @@ files:
|
|
321
349
|
- lib/sc2ai/connection/connection_listener.rb
|
322
350
|
- lib/sc2ai/connection/requests.rb
|
323
351
|
- lib/sc2ai/connection/status_listener.rb
|
324
|
-
- lib/sc2ai/data.rb
|
325
352
|
- lib/sc2ai/local_play/client.rb
|
326
353
|
- lib/sc2ai/local_play/client/configurable_options.rb
|
327
354
|
- lib/sc2ai/local_play/client_manager.rb
|
@@ -335,7 +362,7 @@ files:
|
|
335
362
|
- lib/sc2ai/player/actions.rb
|
336
363
|
- lib/sc2ai/player/debug.rb
|
337
364
|
- lib/sc2ai/player/game_state.rb
|
338
|
-
- lib/sc2ai/player/
|
365
|
+
- lib/sc2ai/player/geo.rb
|
339
366
|
- lib/sc2ai/player/previous_state.rb
|
340
367
|
- lib/sc2ai/player/units.rb
|
341
368
|
- lib/sc2ai/ports.rb
|
@@ -352,7 +379,6 @@ files:
|
|
352
379
|
- lib/sc2ai/protocol/extensions/position.rb
|
353
380
|
- lib/sc2ai/protocol/extensions/power_source.rb
|
354
381
|
- lib/sc2ai/protocol/extensions/unit.rb
|
355
|
-
- lib/sc2ai/protocol/extensions/unit_type.rb
|
356
382
|
- lib/sc2ai/protocol/extensions/unit_type_data.rb
|
357
383
|
- lib/sc2ai/protocol/query_pb.rb
|
358
384
|
- lib/sc2ai/protocol/raw_pb.rb
|
@@ -381,6 +407,7 @@ files:
|
|
381
407
|
- lib/templates/new/boot.rb.tt
|
382
408
|
- lib/templates/new/my_bot.rb.tt
|
383
409
|
- lib/templates/new/run_example_match.rb.tt
|
410
|
+
- sig/minaswan.rbs
|
384
411
|
- sig/sc2ai.rbs
|
385
412
|
homepage: https://sc2ai.pages.dev/
|
386
413
|
licenses:
|
@@ -398,14 +425,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
398
425
|
requirements:
|
399
426
|
- - ">="
|
400
427
|
- !ruby/object:Gem::Version
|
401
|
-
version: 3.2.
|
428
|
+
version: 3.2.6
|
402
429
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
403
430
|
requirements:
|
404
431
|
- - ">="
|
405
432
|
- !ruby/object:Gem::Version
|
406
433
|
version: '0'
|
407
434
|
requirements: []
|
408
|
-
rubygems_version: 3.5.
|
435
|
+
rubygems_version: 3.5.18
|
409
436
|
signing_key:
|
410
437
|
specification_version: 4
|
411
438
|
summary: STARCRAFT® II AI API
|
data/lib/sc2ai/data.rb
DELETED
@@ -1,101 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "api/ability_id"
|
4
|
-
require_relative "api/unit_type_id"
|
5
|
-
require_relative "api/upgrade_id"
|
6
|
-
require_relative "api/buff_id"
|
7
|
-
require_relative "api/effect_id"
|
8
|
-
require_relative "api/tech_tree"
|
9
|
-
|
10
|
-
module Sc2
|
11
|
-
# Holds game data from tech tree and Api::ResponseData
|
12
|
-
# Called once on game start
|
13
|
-
class Data
|
14
|
-
# @!attribute abilities
|
15
|
-
# @return [Hash<Integer, Api::AbilityData]>] AbilitId => AbilityData
|
16
|
-
attr_accessor :abilities
|
17
|
-
# @!attribute units
|
18
|
-
# @return [Hash<Integer, Api::UnitTypeData>] UnitId => UnitData
|
19
|
-
attr_accessor :units
|
20
|
-
# @!attribute upgrades
|
21
|
-
# @return [Hash<Integer, Api::UpgradeData>] UpgradeId => UpgradeData
|
22
|
-
attr_accessor :upgrades
|
23
|
-
# @!attribute buffs
|
24
|
-
# Not particularly useful data. Just use BuffId directly
|
25
|
-
# @return [Hash<Integer, Api::UpgradeData>] BuffId => BuffData
|
26
|
-
attr_accessor :buffs
|
27
|
-
# @!attribute effects
|
28
|
-
# Not particularly useful data. Just use EffectId directly
|
29
|
-
# @return [Hash<Integer, Api::UpgradeData>] EffectId => EffectData
|
30
|
-
attr_accessor :effects
|
31
|
-
|
32
|
-
# @param data [Api::ResponseData]
|
33
|
-
def initialize(data)
|
34
|
-
return unless data
|
35
|
-
|
36
|
-
@abilities = abilities_from_proto(data.abilities)
|
37
|
-
@units = units_from_proto(data.units)
|
38
|
-
@upgrades = upgrades_from_proto(data.upgrades)
|
39
|
-
@buffs = buffs_from_proto(data.buffs)
|
40
|
-
@effects = effects_from_proto(data.effects)
|
41
|
-
end
|
42
|
-
|
43
|
-
private
|
44
|
-
|
45
|
-
# Indexes ability data by ability id
|
46
|
-
# @param abilities [Array<Api::AbilityData>]
|
47
|
-
# @return [Hash<Integer, Api::AbilityData] indexed data
|
48
|
-
def abilities_from_proto(abilities)
|
49
|
-
result = {}
|
50
|
-
|
51
|
-
ability_ids = Api::AbilityId.constants.map { |c| Api::AbilityId.const_get(c) }
|
52
|
-
abilities.each do |a|
|
53
|
-
next if a.ability_id.zero?
|
54
|
-
next if ability_ids.delete(a.ability_id).nil?
|
55
|
-
|
56
|
-
result[a.ability_id] = a
|
57
|
-
end
|
58
|
-
result
|
59
|
-
end
|
60
|
-
|
61
|
-
# Indexes unit data by id
|
62
|
-
# @param units [Array<Api::UnitTypeData>]
|
63
|
-
# @return [Hash<Integer, Api::UnitTypeData>] indexed data
|
64
|
-
def units_from_proto(units)
|
65
|
-
result = {}
|
66
|
-
units.each do |u|
|
67
|
-
next unless u.available
|
68
|
-
|
69
|
-
result[u.unit_id] = u
|
70
|
-
end
|
71
|
-
result
|
72
|
-
end
|
73
|
-
|
74
|
-
# Indexes upgrades data by id
|
75
|
-
# @param upgrades [Array<Api::UpgradeData>]
|
76
|
-
# @return [Hash<Integer, Api::UpgradeData] indexed data
|
77
|
-
def upgrades_from_proto(upgrades)
|
78
|
-
result = {}
|
79
|
-
upgrades.each do |u|
|
80
|
-
result[u.upgrade_id] = u
|
81
|
-
end
|
82
|
-
result
|
83
|
-
end
|
84
|
-
|
85
|
-
def effects_from_proto(effects)
|
86
|
-
result = {}
|
87
|
-
effects.each do |e|
|
88
|
-
result[e.effect_id] = e
|
89
|
-
end
|
90
|
-
result
|
91
|
-
end
|
92
|
-
|
93
|
-
def buffs_from_proto(buffs)
|
94
|
-
result = {}
|
95
|
-
buffs.each do |b|
|
96
|
-
result[b.buff_id] = b
|
97
|
-
end
|
98
|
-
result
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|