sc2ai 0.0.7 → 0.1.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/raw.proto +1 -1
- data/data/sc2ai/protocol/ui.proto +1 -1
- data/lib/docker_build/Dockerfile.ruby +1 -1
- data/lib/sc2ai/cli/cli.rb +1 -1
- data/lib/sc2ai/connection.rb +1 -0
- data/lib/sc2ai/local_play/client_manager.rb +2 -0
- data/lib/sc2ai/local_play/match.rb +0 -11
- data/lib/sc2ai/paths.rb +1 -1
- data/lib/sc2ai/player/{geometry.rb → geo.rb} +39 -3
- data/lib/sc2ai/player/units.rb +7 -35
- data/lib/sc2ai/player.rb +10 -45
- data/lib/sc2ai/protocol/extensions/color.rb +1 -1
- data/lib/sc2ai/protocol/extensions/unit.rb +1 -1
- data/lib/sc2ai/protocol/extensions/unit_type.rb +3 -3
- data/lib/sc2ai/unit_group/action_ext.rb +2 -2
- data/lib/sc2ai/unit_group/filter_ext.rb +20 -0
- data/lib/sc2ai/version.rb +1 -1
- data/lib/sc2ai.rb +0 -7
- data/lib/templates/new/api/raw.proto +1 -1
- data/lib/templates/new/api/ui.proto +1 -1
- data/sig/sc2ai.rbs +801 -970
- metadata +65 -23
- data/lib/sc2ai/data.rb +0 -101
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.1.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-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|
@@ -16,70 +16,70 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.17.0
|
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.17.0
|
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.3
|
61
|
+
version: '1.3'
|
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.3
|
68
|
+
version: '1.3'
|
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
|
@@ -114,14 +114,14 @@ dependencies:
|
|
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
|
@@ -262,6 +290,20 @@ dependencies:
|
|
262
290
|
- - "~>"
|
263
291
|
- !ruby/object:Gem::Version
|
264
292
|
version: '1.17'
|
293
|
+
- !ruby/object:Gem::Dependency
|
294
|
+
name: conventional-changelog
|
295
|
+
requirement: !ruby/object:Gem::Requirement
|
296
|
+
requirements:
|
297
|
+
- - ">="
|
298
|
+
- !ruby/object:Gem::Version
|
299
|
+
version: '0'
|
300
|
+
type: :development
|
301
|
+
prerelease: false
|
302
|
+
version_requirements: !ruby/object:Gem::Requirement
|
303
|
+
requirements:
|
304
|
+
- - ">="
|
305
|
+
- !ruby/object:Gem::Version
|
306
|
+
version: '0'
|
265
307
|
description: This is a Ruby interface to STARCRAFT® II. Write your own AI using an
|
266
308
|
easy interface and compete against others.
|
267
309
|
email:
|
@@ -307,7 +349,6 @@ files:
|
|
307
349
|
- lib/sc2ai/connection/connection_listener.rb
|
308
350
|
- lib/sc2ai/connection/requests.rb
|
309
351
|
- lib/sc2ai/connection/status_listener.rb
|
310
|
-
- lib/sc2ai/data.rb
|
311
352
|
- lib/sc2ai/local_play/client.rb
|
312
353
|
- lib/sc2ai/local_play/client/configurable_options.rb
|
313
354
|
- lib/sc2ai/local_play/client_manager.rb
|
@@ -321,7 +362,7 @@ files:
|
|
321
362
|
- lib/sc2ai/player/actions.rb
|
322
363
|
- lib/sc2ai/player/debug.rb
|
323
364
|
- lib/sc2ai/player/game_state.rb
|
324
|
-
- lib/sc2ai/player/
|
365
|
+
- lib/sc2ai/player/geo.rb
|
325
366
|
- lib/sc2ai/player/previous_state.rb
|
326
367
|
- lib/sc2ai/player/units.rb
|
327
368
|
- lib/sc2ai/ports.rb
|
@@ -368,13 +409,14 @@ files:
|
|
368
409
|
- lib/templates/new/my_bot.rb.tt
|
369
410
|
- lib/templates/new/run_example_match.rb.tt
|
370
411
|
- sig/sc2ai.rbs
|
371
|
-
homepage: https://
|
412
|
+
homepage: https://sc2ai.pages.dev/
|
372
413
|
licenses:
|
373
414
|
- MIT
|
374
415
|
- Nonstandard
|
375
416
|
metadata:
|
376
|
-
homepage_uri: https://
|
377
|
-
|
417
|
+
homepage_uri: https://sc2ai.pages.dev/
|
418
|
+
source_code_uri: https://gitlab.com/dysonreturns/sc2ai
|
419
|
+
changelog_uri: https://sc2ai.pages.dev/file.CHANGELOG
|
378
420
|
post_install_message:
|
379
421
|
rdoc_options: []
|
380
422
|
require_paths:
|
@@ -383,14 +425,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
383
425
|
requirements:
|
384
426
|
- - ">="
|
385
427
|
- !ruby/object:Gem::Version
|
386
|
-
version: 3.2.
|
428
|
+
version: 3.2.5
|
387
429
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
388
430
|
requirements:
|
389
431
|
- - ">="
|
390
432
|
- !ruby/object:Gem::Version
|
391
433
|
version: '0'
|
392
434
|
requirements: []
|
393
|
-
rubygems_version: 3.5.
|
435
|
+
rubygems_version: 3.5.18
|
394
436
|
signing_key:
|
395
437
|
specification_version: 4
|
396
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
|