chippydip / HearthLog

Client application to log Hearthstone games and upload those logs to
www.hearthlog.com
Apache License 2.0
54 stars 18 forks source link

create human readable log file #12

Open jovezhong opened 10 years ago

jovezhong commented 10 years ago

I am not sure whether hsl is a standard file format. Looks like it's compressed.

It'll be great if this program can generate human readable game log file. Maybe generate both json file and hsl file and only upload the hsl to the server.

If I can get json or plain text of the game log, I can use other BI tool to analyze them

chippydip commented 10 years ago

The log files are compressed (using DEFLATE which is basically just zip/gzip without the file header). The contents then are basically just the raw network traffic captured during the game. I'm adding a timestamp to each message and the game version, but that's about it.

All of the actual parsing happens on the server to keep the client simple and avoid having to push out client updates with each new patch.

There actually is a human-readable log format on the website. If you go to a replay page and change "replay" to "log" in the URL you should see something like this: http://www.hearthlog.com/u/hanariri-hunter/1391114175/log

I may try to expose this sort of info through an API at some point as well, but not sure exactly when that might get added.

jovezhong commented 10 years ago

Thank you, @chippydip

I've written some script to parse the game log on website, which can generate simplified event e.g. turn=8 step=4 action=attack to=HERO_05 damage=damage card=EX1_506 left=20

Could you please open API to list game records?

Say, http://www.hearthlog.com/api/u/{user}/list to return a JSON array of 1391114175,1391314175,1391614175

and http://www.hearthlog.com/api/users to list all users ID

jovezhong commented 10 years ago

One more question, sometimes {e|3} means the player, sometime means the enemy. How you determine it on web page?

chippydip commented 10 years ago

The client stores all game logs locally even after they are uploaded to the server. The names of the files are the numbers in the game URLs (they are timestamps of when the game was recorded). So, you should be able to at least get a full list of your own games without an API, but I'll consider adding something like that in the future. I'm somewhat hesitant to do this, though, since reading a huge number of records to generate those API pages could potentially be quite costly if it was used with any regularity. I definitely see the appeal, though, so I'll continue to think about how I can tweak the data model to make these sorts of things more efficient.

If two players upload a log for the same game then {e|3} would be the player in one case and the enemy in another (which is why it's not consistent). The server determines which is which by looking at which player's cards are visible after the initial draw. The player's cards are visible while the enemy's cards are not.

jovezhong commented 10 years ago

thanks @chippydip I've indexed all my game logs in Splunk and created some interesting dashboards.

I sent you a few files to your gmail. Please check.