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

player uids are zero in a 1.5.4.24540 replay vs AI #98

Closed dsjoerg closed 11 years ago

dsjoerg commented 11 years ago

Maybe this is already a known issue? It was new to me.

>>> import sc2reader
>>> replay = sc2reader.load_replay("http://ggtracker.com/matches/1786123/replay")
>>> replay.players
[Player 1 - DamnFighter (Protoss), Player 2 - Player 2 (Terran)]

>>> replay.players[0]
Player 1 - DamnFighter (Protoss)

>>> replay.players[0].uid
0

>>> replay.players[1].uid
0

The lack of uid makes it impossible for us to really know who played in the game.

GraylinKim commented 11 years ago

I was not aware of this but examination of the raw replay.details file confirms that there is no uid information available for this replay. How many examples of this have you seen?

dsjoerg commented 11 years ago

This is the first time I've seen it, but it could be happening many more times -- I had to do some unpacking to go from the misleading error message in my code down to this underlying problem at the sc2reader level.

GraylinKim commented 11 years ago

Could do a database search for players with a uid=0 and a name that is not like '%Player%' and see what turns up? I'd like to think it is an isolated issue.

dsjoerg commented 11 years ago

Unfortunately that won't work. Matches with multiple players with uid=0 have always violated assumptions such that they fail to get persisted into the DB. So they exist in the GGTracker system as replays that failed to parse, but the failure reason is stuck in the logfiles, not in the DB.

Anyway, the replay parse failure rate has been 3-4% the past few days, which is actually pretty good compared to historical averages. I'll dig in more if it crosses over 5% and report on the most popular failure categories.

GraylinKim commented 11 years ago

Woah, 4% sounds kind of high. You don't seem panicked though, are we thinking that the failures are mostly on custom maps?

dsjoerg commented 11 years ago

Yes I bet customs are the #1 reason, followed by AI configs that aren't supported yet. Bear in mind that's not just the sc2reader failure rate but the fail rate of the whole stack including whatever bugs I've managed to write.

On Wed, Feb 20, 2013 at 12:34 PM, Graylin Kim notifications@github.comwrote:

Woah, 4% sounds kind of high. You don't seem panicked though, are we thinking that the failures are mostly on custom maps?

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

GraylinKim commented 11 years ago

AI configs that aren't supported yet? I'm not sure I follow.

dsjoerg commented 11 years ago

Never mind, don't worry about it.

GraylinKim commented 11 years ago

I'm going to suggest that this game and others like it are played in either Offline or Guest mode. Since the player doesn't log in a uid cannot be assigned to them. It would also explain why they are only games against computer players and not against humans.

Thoughts @dsjoerg?

dsjoerg commented 11 years ago

That's a great hypothesis. Using a different tool, I have confirmed that the replay was played while not connected to battle.net.

dsjoerg commented 11 years ago

All that remains to be done here, if you think it's appropriate would be:

dsjoerg commented 11 years ago

I'd be happy to make the comment -- which branch would be more convenient? I presume there's a merge of hots and master coming up soonish.

GraylinKim commented 11 years ago

I've got a lot of code in the air at the moment. I'll sweep through and do as you suggested later tonight.

GraylinKim commented 11 years ago

Confirmed that none of the sc2reader core code depends on a non zero player.uid. Note added to explain circumstances in which player.uid can be zero in dbc79d8.