-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AttributeError: 'Observer' object has no attribute 'units' #176
Comments
It may be related to #174. |
So the issue is as described: observers don't have units. For this particular replay, the offending observer is There are 2 fixes I see here.
OR Two, have Observers get units, either
Slapping the users attribute in directly worked in my testing. Does anyone have strong preferences in the right fix here? |
Are Observers actually allowed to own units? I believe the answer is no, Secondly, if indeed Observers aren't allowed to own units, then there is On Sun, Aug 10, 2014 at 2:27 PM, Kevin Leung notifications@github.com
|
I have no idea what is and isn't valid here. @GraylinKim , do you know what should be allowed for observers with units? |
@dsjoerg is right @StoicLoofah. Observers are not allowed to own units. This rule is enforced by the Starcraft II game engine. So the client that sc2reader is identifying as an observer is actually a player as far as the map used and game engine are concerned. sc2reader is either improperly identifying a player as an observer or it needs to have better handling for situations where observers are registered as players. In the case of the former it is a logic bug we should try to fix. In the case of the later it is an event processing bug that should be fixed. Since real observers can't have units, I'd be in favor of dropping all "observer" unit events and not processing them. I doubt that this is exactly related to #174 @EHadoux but it is likely the same class of problem. I don't have time to look into these issues right now but I can try to provide guidance on a fix. |
The entities on this particular replay are
And I spit out the upkeep_pids from the replay (as initializing trackerevents in https://github.com/GraylinKim/sc2reader/blob/master/sc2reader/events/tracker.py#L269 ) , and there were a lot of 0s, 3s, and 4s. As a sample,
which is from something like It would seem to me that the problem is either
I have no idea what the format of the tracker data is or where to find such a thing to even start here. Thoughts on next steps? |
I'm guessing this is related to Blizzard/s2protocol#8. If my guess is right, the issue is related to how we figure out the mapping from PIDs to players. I believe sc2reader uses a technique that works for ladder games but doesn't always work on custom maps and/or games with observers. Take a look at the discussion in Blizzard/s2protocol#8, in particular @koalaling's response: "The short answer is there's no great way to do this right now; it requires information from the map file to compute player ids. However it's a good idea to add new tracker events in a patch to record the mapping between player id, user id and lobby slot id." |
So, possible approaches include:
|
@koalaling writes: There’s two SPlayerSetupEvents with m_type = 1 (meaning ‘user’, i.e. a human player) in the tracker events: {'_bits': 192, '_event': 'NNet.Replay.Tracker.SPlayerSetupEvent', '_eventid': 9, '_gameloop': 0, The SPlayerSetupEvents can be used to map userIds to playerIds: m_userInitialData has player names, and is indexed by the userId. There’s more info about players in m_lobbyState.m_slots[], which is indexed by slotId. For example: There’s also the m_playerList, but rather than indexing into it, you can correlate the m_workingSetSlotId in those objects with the same-named field in objects in the m_lobbyState.m_slots[] entries. For example: |
Sorry for not following up on this sooner, but I have done a bit more sleuthing to get through this. Okay, so what I have got out of this replay is from the SPlayerSetupEvent
from replay.entities
from lobby_state slots
Presumably, the pids usually match up between these 2 sources, but they didn't in this case for some of the reasons @koalaling discussed above. It appears that the pids (or player_id in load_players) as defined in sc2reader/resources.py are simply enumerated counting up from 1. In this case, however, it turns out that the first 2 players in the replay are actually pids 3 and 4 according to the tracker events, and looking at the slots data, there is nothing to indicate that they are players 3 and 4. The suggestion above to use tracker events is a little unfortunate because it looks like sc2reader loads the slot data before it even looks at the tracker data, and given that tracker data isn't available in all cases, I'm wondering whether it's really kosher to reassign pids after the fact. I could try it, but it really seems like this is the edge case here. Am I missing something else in the structure of the slotData that allows us to do this more consistently? The only guess I have is that we have to increment the player_id for the 2 slots at the beginning with control == 0. I'm not exactly sure how to interpret "control", however, or if that will break more things. Or maybe we're supposed to ignore the control altogether and increment it in all cases? If so, then pid is simply sid + 1 |
I got the following error:
http://spawningtool.com/11855/download/
To be honest, I haven't taken a look at this issue at all and am happy to investigate, but I just pulled up the error right now and thought I would put it out there in case anyone knows what's up off the top of his or her head
The text was updated successfully, but these errors were encountered: