Skip to content
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

Image based rank detection #1808

Merged
merged 3 commits into from
Dec 5, 2015
Merged

Image based rank detection #1808

merged 3 commits into from
Dec 5, 2015

Conversation

andburn
Copy link
Member

@andburn andburn commented Dec 1, 2015

My latest attempt to fix rank mode (#1653, #1762). The rank detection method I tried before, turns out to be fairly inconsistent. So, I came up with another one. This time its direct image recognition of the rank "medals", from my testing its 100%. Obviously it'll need further testing with a beta release, but I'm pretty confident about it (assuming blizzard don't do anything stupid). It does require another library Aforge, but its not big.

Adds a new class Utility.RankDetection, and you call RankDetection.Match(Bitmap b) with a screen capture param and returns:

RankResult
{
  int Player
  int Opponent
  bool Success
}

I didn't want to start dismantling all the existing rank detection stuff (wouldn't know where to start tbh :) ). So, I added the detection into GameEventHandler.TurnStart and seems to work.

azeier pushed a commit that referenced this pull request Dec 2, 2015
@azeier
Copy link
Member

azeier commented Dec 2, 2015

Amazing! Seems to work very well from what I can tell!

Merged into rank_detection branch for now.

Some changes I made:

  • Utility.RankDetection.Range needs to be a class or implement the base ctor to compile as C#5 (I added the latter)
  • Added Overlay.IsRankCovered() to make sure you only see the overlay flickering if actually necessary.
  • Added a DetectRanks() (extracted from TurnStart) call to Game end to deal with instant condeces (that just happened to happen to me while testing :))
  • Made DetectRanks() async void with a "running" check to not block the main thread with await RankDetection.Match().
  • Added friendslist detection to DetectRanks(), which waits for the FL to be closed and displays a message in the overlay before running Match() (this needs to not block the main thread even more).
  • Added a max number of tries to ranked detection if is disrups the user experience (i.e. overlay flickering). We might want to add a general max tries to avoid the overlay flickering x times once a deck list gets too large.
  • Completely (I think?) removed the old methods of rank(ed) detection.

@andburn
Copy link
Member Author

andburn commented Dec 2, 2015

Nice additions 👍
It'll be interesting to see how it works when people test it out

@azeier azeier merged commit 17da5ec into HearthSim:master Dec 5, 2015
@andburn andburn deleted the rank_detection branch March 15, 2016 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants