Closed mikemassari closed 11 years ago
"Hello, i'm trying to get a list of events and messages of the game Basically i just want to ha something like"
I think you could take a look at the sc2replayer script. However, that script is not working in the current branch. You can download a working version here (until it's merged with master): https://github.com/Prillan/sc2reader/blob/master/sc2reader/scripts/sc2replayer.py
"I would also like to determine what happened at a certain time in the game. like: at 10:00 how many workers every player has."
That is unfortunately not possible. The replays only contain the actions the players perform. You'd have to use the actual game engine to get an idea of that.
"As last. I don't seem to be able to retrieve the game_summary from the replay. Where do I find the hash to input in the url that should be called?"
We haven't found any reference to the summary in the replay. The summary has to do with the Battle.net side of things while the replay is a more game client/local thing. So that's probably why.
Hello Prillian, thanks for your help.
I tried your script. it seems to be working but as far as i can understand it only records "the Initialization, Ability, and Selection events by default."
is there a way to record them separately, including also creation of units?
i see there is also a sc2boprinter.py that should print the build order. if i provide it a s2gs file will it work? i mean.. is it updated?
Hello, i'm trying to get a list of events and messages of the game
replay = sc2reader.load_replay('path/to/replay.SC2Replay')
for event in replay.events:
print '{0} => {1}: {2}'.format(event.pid,event.name, event.time)
Please see the documentation for more information. The documentation needs improvement so if it is unable to answer your questions file a separate issue so the documentation can be improved.
I would also like to determine what happened at a certain time in the game; like: at 10:00 how many workers every player has.
This is difficult. Events are only recorded for player initiated actions and you'll find that both successful and unsuccessful actions are included. That means several things complicates our lives:
It may be possible to overcome these limitations and approximate game state with a series of very smart assumptions and cool algorithms. If you could accurately count workers though, you'd be the first I think.
I don't seem to be able to retrieve the game_summary from the replay. Where do I find the hash to input in the url that should be called?
s2gs files hashes are not contained inside any other SC2 resources as far as anyone knows. Make sure you read this thread for details.
Aside from manually causing s2gs files to download to your battle.net cache folder you might try set up this software to scrape them from the process memory. I can't speak to its legality or effectiveness but it is somewhere to start if you want to automate things.
Seems like @Prillan beat me to it. Posting anyways.
It is true that not all the scripts are very well maintained. They were originally intended as mini usage examples. It seems that people are trying to use them as a primary interface for sc2reader though. I'll have to make sure they don't break going forward.
Patches to the scripts are always accepted, just issue a pull request or email me a patch file.
Thanks a lot GraylinKim. I will look into what you send me and, if I find something interesting I will definitely issue a pull request.
Okay, great. I added your questions and my answers to the online documentation for next time these things come up.
Hello, i'm trying to get a list of events and messages of the game Basically i just want to ha something like Player ID => [event.name] [event.time](sorry if the syntax is not correct, i'm quite new to python)
same thing for the messages.
I would also like to determine what happened at a certain time in the game. like: at 10:00 how many workers every player has.
As last. I don't seem to be able to retrieve the game_summary from the replay. Where do I find the hash to input in the url that should be called?
Is that possible? (p.s. sorry again for the noob question, please help a fellow developer ) :)