flipperbw / HSBuddy

Keep track of played cards in Hearthstone.
49 stars 9 forks source link

Read from HS Log File #4

Open ghost opened 10 years ago

ghost commented 10 years ago

In an effort to move towards Blizzard ToS compliancy, we probably need to switch over to using the log file.

I started working on reading the log files and then saving them off to a database.. This would ensure that the data isn't lost between Hearthstone sessions: https://github.com/jzweifel/HearthstoneLogReader It's super rough, and I'm not particularly good at parsing strings.

Any other thoughts on how to work with this log file and/or storing the data? I'm open to ideas here.

Also, wouldn't it suck if Blizzard destroyed the log file or otherwise modifed its output? :p

bcfoster commented 10 years ago

Aside from ToS compliance, what are the pros/cons of utilizing the existing logging over packet capture? I think flipperbw mentioned previously that the deck lists aren't available using logging?

I'm taking a peek at your log reader now. I have yet to look at the log generated by Hearthstone, but how standardized is the output? Regular expressions may be an option.

ghost commented 10 years ago

I think ToS compliance is the primary factor here. Granted, Blizzard could always decide that leveraging the log file is also against the ToS - it might be worth opening a ticket with CS and gathering their input on using these logs.

I haven't looked for myself yet, but I'm under the assumption that yeah, decklists can be grabbed via TCP sniffing or image capturing, but not via the logs.

Personally, I'd prefer ToS-compliancy. I'd like to think that any users of the product would also prefer ToS-compliancy over simplicity but with a (potentially) greater risk of being banned. This isn't my project though. :)

CageHN commented 10 years ago

I also like using the log file, maybe we can make activating the log files easy for the app users, to ensure that this doesn't dissuade anyone from using the app. I'm currently setting up a C# dev env to start looking at the code.

I think we should have the Log Reader in the same repository, what do you think about that? Easier integration I think.

What is your current plan for Database to be used?

bcfoster commented 10 years ago

An application involving so many components would typically need a little bit of design work done. It's pulling data using two different methods, manipulating and representing that data, and then potentially storing it (for review/replay). Getting the basics working is great, but with minimal design, things tend to get rough when you start adding complexity and new features.

ghost commented 10 years ago

Luckily, I have a little experience with app design! Might be a decent learning opportunity too. ;)

It should be fairly trivial to get the app to create the log config file in the hearthstone directory, or modify it if it exists. The biggest issue would likely be working with UAC.

I'm definitely not opposed to bringing my log parsing in along with components from other OSS projects - found a pretty sweet regex and I'm going to contact the author.

My data store experience is primarily with databases, which is why I jumped to Entity Framework Code First + LocalDB. Not opposed to other options. Ideally, it would store all user games for analysis and replay, possibly (and optionally) upload to a website. Getting a bit beyond the scope of this issue, though. :)

bcfoster commented 10 years ago

I would love to be involved in the design process. I could really use the experience as well. Would you be cool with doing a shared whiteboard session sometime? Maybe we could try and get everyone together? It seems like a few people are interested in getting something serious going. This is flipper's project though, so he should probably weigh in.

ghost commented 10 years ago

I went ahead and brought my other log reader projects into this solution in the https://github.com/flipperbw/HSBuddy/commit/0e63306aeec197deebd4fbb3dffcbb537afba684 branch. Not going to commit to master yet as I haven't determined the impact yet. Yet, it is still there for reference. Definitely interested in what @flipperbw has to say. @epix37 authored the regex I'm interested in using. https://github.com/Epix37/Hearthstone-Deck-Tracker/blob/master/Hearthstone%20Deck%20Tracker/HsLogReader.cs

bcfoster commented 10 years ago

What regex sample did you find? I wouldn't mind taking a look.

ghost commented 10 years ago

I referenced it in https://github.com/flipperbw/HSBuddy/issues/4#issuecomment-44613135. Take a look! Seems pretty solid, but string parsing and/or regex is definitely one of my weaknesses.

bcfoster commented 10 years ago

I have minimal experience with regular expressions as well, but I went ahead and created an expression that works quite well... I just need to add the capture for everything after the "]" (eg "zone from -> OPPOSING HAND"). That should be simple enough.

That said, I wouldn't be against using what @Epix37 already created. I suppose there isn't a point to reinventing the wheel unless he isn't interested in contributing his code.

ghost commented 10 years ago

My log reader class is located at https://github.com/flipperbw/HSBuddy/blob/HearthstoneLogReader/HearthstoneLogReader/LogReader.cs.

It should be self-explanatory. Right now all it's going to do is read the file from beginning to end line-by-line in StartReadLog(). Ideally, it would monitor the file for changes and keep track of which lines have been read, always starting at the most recent line.

Following my (potentially over-complex) data model, it will assume that all log entries are part of the same match. Ideally, it would monitor for start/end match messages and react accordingly.

Go ahead and pop in your regex if you'd like! Might need to add a console app for the purposes of testing, though.

flipperbw commented 10 years ago

Hi all,

Regex/text munging is one of my specialties, so no worries there.

I've been inspecting the landscape of Hearthstone programs, and there is a lot out there at the moment. Specifically, people have been building around this logging functionality in the past week, in addition to the pre-made TCP and Screen Capture programs. Some of those latter programs are already incorporating the Log method as well, such as Hearthstats.

I'm trying to get everyone together to discuss the best way to move forward. I don't want to necessarily see 30 barely-different apps out there - I'd rather a few awesome ones. We should probably discuss whether or not to merge the best parts of our projects together, or to continue building separately. An example of a good app I found on Reddit that uses the Logs is here: http://www.reddit.com/r/hearthstone/comments/26seey/automatic_deck_tracker_and_more_with_ingame/

It's prettier than what I put together by a long shot. Here is a full compilation of all the apps I've found so far:

So of those, I think if we were to merge projects, Hearthstone-Deck-Tracker would be the best idea. Thoughts?

flipperbw commented 10 years ago

Also - I'm hanging out in #hearthtrack on irc.freenode.net now if you guys are around.

CageHN commented 10 years ago

Hey guys, I'm up to coding anything, I wouldn't mind joining up with other team. We should discuss what features we would like in a tool, and try to work in one that has most of what we are looking for.

ghost commented 10 years ago

I'd certainly be up for joining forces with @Epix37 if he's interested!

azeier commented 10 years ago

Just to "officially" say it again: I sure am interested!