You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sc2reader is a python library for extracting information from various different
5
-
Starcraft II resources. These resources currently include Replays, Maps, and
6
-
Game Summaries; we may eventually include BNet profiles and possibly adapters
7
-
to the more entrenched SCII sites like sc2ranks.
4
+
sc2reader is a python library for extracting information from various different Starcraft II resources. These resources currently include Replays, Maps, and Game Summaries; we have plans to add support for Battle.net profiles and would gladly accept adapters to the more entrenched SCII sites such as sc2ranks.
8
5
9
-
Our goal is to give anyone and everyone the power to construct their own
10
-
tools, do their own analysis, and hack on their own Starcraft II projects
11
-
under the open MIT license. Currently powering:
6
+
There is a pressing need in the SC2 community for better statistics, better analytics, better tools for organizing and searching replays. Better websites for sharing replays and hosting tournaments. These tools can't be created with out first being able to open up Starcraft II game files and analyze the data within. Our goal is to give anyone and everyone the power to construct their own tools, do their own analysis, and hack on their own Starcraft II projects under the open MIT license.
12
7
13
-
* Websites: `ggtracker.com`_, `gamereplays.org`_
14
-
* Tools: `The Core`_
15
-
* Experiments: `Midi Conversion`_
16
-
17
-
Our secondary goal is to become a reference implementation for people looking
18
-
to implement libraries in other languages. For replays, it implements the
19
-
replay format as specified in Blizzard's `s2protocol`_ project.
20
8
21
-
The following is a list of partial implementations in other languages:
9
+
Who Uses sc2reader?
10
+
======================
22
11
23
-
* C#: `sc2replay-csharp`_ (special thanks for v1.5 help)
24
-
* C++: `sc2pp`_
25
-
* Javascript: `comsat`_
26
-
* PHP: `phpsc2replay`_
12
+
sc2reader is currently powering:
27
13
28
-
Unfortunately sc2reader does not implement a battle.net scraper for profile
29
-
information. If you need the information I know of two projects that can get
30
-
you started:
31
-
32
-
* Ruby: `bnet_scraper`_ - Maintained by Agora Games
33
-
* Python: `sc2profile`_ - Currently unmaintained, slightly dated.
If you'd like your tool, site, project, or implementation listed above, drop
36
-
us a line on our `mailing list`_ or stop by our #sc2reader IRC channel and say hi!
18
+
If you use sc2reader and you would like your tool, site, project, or implementation listed above, drop us a line on our `mailing list`_ or stop by our #sc2reader IRC channel and say hi!
37
19
38
20
39
21
Current Status
40
22
=================
41
23
42
-
sc2reader is currently capable of parsing varying levels of information out of
43
-
the three primary resource types listed below. For a more detailed and exact
44
-
description of the information that can be extracted please consult the
45
-
`documentation`_ hosted on Read the Docs.
46
-
47
-
The library is production ready and reasonably stable. `travis-ci`_ provides a
48
-
record of our `continuous testing`_ and `coveralls.io`_ provides a record of our `test coverage`_.
24
+
sc2reader is production ready at release and under active development on github. It is currently capable of parsing varying levels of information out of the three primary resource types listed below. For a more detailed and exact description of the information that can be extracted please consult the `documentation`_ hosted on ReadTheDocs.
49
25
50
26
51
27
Replays
@@ -90,22 +66,20 @@ in future releases.
90
66
Maps
91
67
-------
92
68
93
-
Maps are currently parsed in the most minimal way possible and are an area for
94
-
big improvement in the future. Currently the Minimap.tga packaged with the map
95
-
is made available along with Name, Author, Description for ONLY enUS localized
96
-
SCII map files. More robust Map meta data extraction will likely be added in
* Player Slot data and Advanced Teams alliance/enemy data.
98
75
99
-
There's a lot more in here to be had for the adventurous.
76
+
There is a lot more in here to be had for the adventurous.
100
77
101
78
102
79
Game Summaries
103
80
-----------------
104
81
105
-
Game Summary files are downloaded by the client in order to allow you to view
106
-
the game summary from your match history. Prior to 2.0.8 they were the only
107
-
way to get the information from the summary screen. Since the 2.0.8 release
108
-
you have been able to compute this information yourself from the replay files.
82
+
Game Summary files are downloaded by the client in order to allow you to view the game summary from your match history. Prior to 2.0.8 they were the only way to get the information from the summary screen. Since the 2.0.8 release you have been able to compute this information yourself from the replay files.
109
83
110
84
Thank you Prillan and `Team Liquid`_ for helping to decode this file.
111
85
@@ -115,76 +89,92 @@ Thank you Prillan and `Team Liquid`_ for helping to decode this file.
115
89
* URLs to map localization files and images
116
90
* Player build orders up to 64 (real) actions
117
91
118
-
Parsing on these files is now production ready for those that can get them. See
119
-
the `Team Liquid`_ thread for details on how to go about getting them.
92
+
Parsing on these files is now production ready for those that can get them. See the `Team Liquid`_ thread for details on how to go about getting them.
120
93
121
94
Again, these files are generally unnecessary after the 2.0.8 release.
122
95
123
96
124
-
125
-
Example Usage
97
+
Basic Usage
126
98
=====================
127
99
128
-
To demonstrate how you might use sc2reader in practice I've included some short
129
-
contrived scripts below. For more elaborate examples, checkout the docs and the
130
-
`sc2reader.scripts`_ package on Github or in the source.
100
+
For examples scripts, checkout the docs and the `sc2reader.scripts`_ package on Github or in the source.
101
+
102
+
Loading Replays
103
+
-------------------
104
+
For many users, the most basic commands will handle all of their needs::
This will load all replay data and fix GameHeart games. In some cases, you don't need the full extent of the replay data. You can use the load level option to limit replay loading and improve load times::
132
110
133
-
Downloading Maps
134
-
--------------------
111
+
# Release version and game length info. Nothing else
If you are loading a lot of remote resources, you'll want to enable caching for sc2reader. Caching can be configured with the following environment variables:
149
+
150
+
* SC2READER_CACHE_DIR - Enables caching to file at the specified directory.
151
+
* SC2READER_CACHE_MAX_SIZE - Enables memory caching of resources with a maximum number of entries; not based on memory imprint!
152
+
153
+
You can set these from inside your script with the following code **BEFORE** importing the sc2reader module::
# if you have imported sc2reader anywhere already this won't work
159
+
import sc2reader
180
160
181
-
except KeyError as e:
182
-
continue # A game I didn't play in!
161
+
162
+
Using Plugins
163
+
------------------
164
+
165
+
There are a growing number of community generated plugins that you can take advantage of in your project. See the article on `Creating GameEngine Plugins`_ for details on creating your own. To use these plugins you need to customize the game engine::
166
+
167
+
from sc2reader.engine.plugins import SelectionTracker, APMTracker
The :class:`~sc2reader.engine.plugins.ContextLoader` and :class:`~sc2reader.engine.plugins.GameHeartNormalizer` plugins are registered by default.
183
172
184
173
185
174
Installation
186
175
================
187
176
177
+
sc2reader runs on any system with Python 2.6+, 3.2+, or PyPy installed.
188
178
189
179
190
180
From PyPI (stable)
@@ -205,16 +195,17 @@ or with setuptools (specify a valid x.x.x)::
205
195
cd sc2reader-x.x.x
206
196
python setup.py install
207
197
208
-
Releases to PyPi can be very delayed, for the latest and greatest you are encouraged
209
-
to install from Github master which is **usually** kept quite stable.
198
+
Releases to PyPi can be very delayed, for the latest and greatest you are encouraged to install from Github master.
210
199
211
200
212
201
From Github
213
202
--------------------------
214
203
215
204
Github master is generally stable with development branches more unstable.
216
205
217
-
Install from the latest source on github with pip::
206
+
We use `travis-ci`_ to provide a record of our `continuous testing`_ and `coveralls.io`_ provides a record of our `test coverage`_. Please verify that tests are passing before installing development versions.
207
+
208
+
Install from the latest source on Github with pip::
Contributors should install from an active git repository using setuptools in
233
-
`develop`_ mode. This will install links to the live code so that local edits
234
-
are available to external modules automatically::
223
+
Contributors should install from an active git repository using setuptools in `develop`_ mode. This will install links to the live code so that local edits are available to external modules automatically::
Please review the CONTRIBUTING.md file and get in touch with us before doing
241
-
too much work. It'll make everyone happier in the long run.
242
-
229
+
Please review the `CONTRIBUTING.md`_ file and get in touch with us before doing too much work. It'll make everyone happier in the long run.
243
230
244
231
Testing
245
232
-------------------
246
233
247
-
We use the built in ``unittest`` module for testing. If you are still on Python
248
-
2.6 you will need to install ``unittest2`` because our test suite requires newer
249
-
features than are included in the main distribution.
234
+
We use the built in ``unittest`` module for testing. If you are still on Python 2.6 you will need to install ``unittest2`` because our test suite requires newer features than are included in the main distribution.
250
235
251
236
To run the tests just use::
252
237
253
-
python -m unittest discover test_replays
254
-
python -m unittest discover test_s2gs
238
+
python test_replays/test_all.py
239
+
python test_s2gs/test_all.py
255
240
256
-
When repeatedly running tests it can be very helpful to make sure you've
257
-
set a local cache directory to prevent long fetch times from battle.net::
241
+
When repeatedly running tests it can be very helpful to make sure you've set a local cache directory to prevent long fetch times from battle.net::
sc2reader has a small but growing community of people looking to make tools and
270
-
websites with Starcraft II data. If that sounds like something you'd like to be
271
-
a part of please join our underused `mailing list`_ and start a conversation
272
-
or stop by #sc2reader on FreeNode and say 'Hi'. We have members from all over
273
-
Europe, Australia, and the United States currently, so regardless of the time,
274
-
you can probably find someone to talk to.
253
+
sc2reader has a small but growing community of people looking to make tools and websites with Starcraft II data. If that sounds like something you'd like to be a part of please join our underused `mailing list`_ and start a conversation or stop by #sc2reader on FreeNode and say 'Hi'. We have members from all over Europe, Australia, and the United States currently, so regardless of the time, you can probably find someone to talk to.
275
254
276
255
277
256
Issues and Support
278
257
=====================
279
258
280
-
We have an `issue tracker`_ on Github that all bug reports and feature requests
281
-
should be directed to. We have a `mailing list`_ with Google Groups that you can
282
-
use to reach out for support. We are generally on FreeNode in the #sc2reader
283
-
and can generally provide live support and address issues there as well.
259
+
We have an `issue tracker`_ on Github that all bug reports and feature requests should be directed to. We have a `mailing list`_ with Google Groups that you can use to reach out for support. We are generally on FreeNode in the #sc2reader and can generally provide live support and address issues there as well.
284
260
285
261
286
262
Acknowledgements
@@ -297,7 +273,7 @@ and kept this project going.
297
273
* Thanks to `ggtracker.com`_ for sponsoring further development and providing
298
274
the thousands of test files used while adding s2gs and HotS support.
299
275
* Thanks to Blizzard for supporting development of 3rd party tools and releasing
300
-
their `s2protocol`_ reference implementation.
276
+
their `s2protocol`_ full reference implementation.
0 commit comments