GraylinKim / sc2reader

A python library that extracts data from various Starcraft II resources to power tools and services for the SC2 community. Who doesn't want to hack on the games they play?
http://sc2reader.readthedocs.org
MIT License
413 stars 85 forks source link

Error parsing Red Bull Battle Grounds replays #162

Closed StoicLoofah closed 10 years ago

StoicLoofah commented 10 years ago

http://spawningtool.com/7254/download/

You can find all replays at either http://battlegrounds.redbull.com/replays/red_bull_battlegrounds.zip http://spawningtool.com/replays/?before_played_on=&after_time=&tag=612&before_time=&query=&after_played_on=&p=1

The error I'm getting with 0.6.4 is

>>> import sc2reader
>>> sc2reader.load_replay('/Users/kevin/Downloads/red_bull_battlegrounds/529288466daac.sc2replay')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "sc2reader/factories/sc2factory.py", line 85, in load_replay
    return self.load(Replay, source, options, **new_options)
  File "sc2reader/factories/sc2factory.py", line 137, in load
    return self._load(cls, resource, filename=filename, options=options)
  File "sc2reader/factories/sc2factory.py", line 146, in _load
    obj = cls(resource, filename=filename, factory=self, **options)
  File "sc2reader/resources.py", line 275, in __init__
    self._read_data(data_file, self._get_reader(data_file))
  File "sc2reader/resources.py", line 600, in _read_data
    self.raw_data[data_file] = reader(data, self)
  File "sc2reader/readers.py", line 123, in __call__
    ) for i in range(data.read_uint32())]
  File "sc2reader/objects.py", line 76, in __init__
    self.value = lookup[value.strip("\x00 ")[::-1]]
KeyError: u'0048'

I was going to chalk it up to a new version of SC2 (it's been awhile since I have looked at this stuff), but I see a couple replays from Nov 29th that appear to be working. I guess it's something specific to the replays from these events. One of them did parse correctly: I'm not sure why

http://spawningtool.com/7251/

dsjoerg commented 10 years ago

I guessed it was GameHeart, for which there's already an issue.

— Sent from Mailbox for iPhone

On Sun, Dec 1, 2013 at 2:59 PM, Kevin Leung notifications@github.com wrote:

http://spawningtool.com/7254/download/ You can find all replays at either http://battlegrounds.redbull.com/replays/red_bull_battlegrounds.zip http://spawningtool.com/replays/?before_played_on=&after_time=&tag=612&before_time=&query=&after_played_on=&p=1 The error I'm getting with 0.6.4 is

>>> import sc2reader
>>> sc2reader.load_replay('/Users/kevin/Downloads/red_bull_battlegrounds/529288466daac.sc2replay')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "sc2reader/factories/sc2factory.py", line 85, in load_replay
    return self.load(Replay, source, options, **new_options)
  File "sc2reader/factories/sc2factory.py", line 137, in load
    return self._load(cls, resource, filename=filename, options=options)
  File "sc2reader/factories/sc2factory.py", line 146, in _load
    obj = cls(resource, filename=filename, factory=self, **options)
  File "sc2reader/resources.py", line 275, in __init__
    self._read_data(data_file, self._get_reader(data_file))
  File "sc2reader/resources.py", line 600, in _read_data
    self.raw_data[data_file] = reader(data, self)
  File "sc2reader/readers.py", line 123, in __call__
    ) for i in range(data.read_uint32())]
  File "sc2reader/objects.py", line 76, in __init__
    self.value = lookup[value.strip("\x00 ")[::-1]]
KeyError: u'0048'

I was going to chalk it up to a new version of SC2 (it's been awhile since I have looked at this stuff), but I see a couple replays from Nov 29th that appear to be working. I guess it's something specific to the replays from these events. One of them did parse correctly: I'm not sure why

http://spawningtool.com/7251/

Reply to this email directly or view it on GitHub: https://github.com/GraylinKim/sc2reader/issues/162

GraylinKim commented 10 years ago

There is already an issue related to GameHeart? That is open?

I'll take a look at this when I get back from dinner.

dsjoerg commented 10 years ago

Oh, I've never seen the GameHeartNormalizer before. Neat!

I wonder if OP was using it.

On Sun, Dec 1, 2013 at 4:59 PM, Graylin Kim notifications@github.comwrote:

There is already an issue related to GameHeart? That is open?

I'll take a look at this when I get back from dinner.

— Reply to this email directly or view it on GitHubhttps://github.com/GraylinKim/sc2reader/issues/162#issuecomment-29584386 .

GraylinKim commented 10 years ago

OP wrote it.

dsjoerg commented 10 years ago

Well there ya go, a solid probably :)

— Sent from Mailbox for iPhone

On Sun, Dec 1, 2013 at 5:19 PM, Graylin Kim notifications@github.com wrote:

OP wrote it.

Reply to this email directly or view it on GitHub: https://github.com/GraylinKim/sc2reader/issues/162#issuecomment-29584950

StoicLoofah commented 10 years ago

Hah, yeah, the GameHeartNormalizer would be in there. I don't think it's actually being used in this case, since these are GH Light replays: the plugin only deals with the timings and player for the in-game lobby.

And you're probably right about it being GameHeart-related. Oddly, that one successfully parsed replay is also using GH Light, but I guess the issue didn't spring up there.

GraylinKim commented 10 years ago

Its not exactly GameHeart related. Its custom map related. sc2reader keeps and index of attribute constants and maps them to attributes found in the replay.attributes.events file. Custom maps can add their own attributes though.

This hasn't caused (reported) problems in the past but it is pretty clear to me now that maintaining mappings in the custom attributes range is a bad idea. If people want custom mappings they can acquire the relevant s2gs files and fill in the blanks themselves. I removed them in a3153db03a5ed478b64f3a33a0ea9dbdf3d54856 which you can apply to your installation.

GraylinKim commented 10 years ago

If you are working off of master be aware that some non-backwards compatible changes have been pushed since the 0.6.4 release.

StoicLoofah commented 10 years ago

Awesome. Thanks for getting to this so quickly!

Are you anticipating tagging another release anytime soon, and if not, is it safe enough to bump up to the latest commit on master?

GraylinKim commented 10 years ago

Master should be stable. There are a number of non-backwards compatible changes with this release so I have been holding off while I think of other changes that should be made before releasing at 0.7.