Code Monkey home page Code Monkey logo

overwatch-counter-picker's Introduction

Overwatch Counter Picker

Build status

This is a web app that tells you the best hero to pick in Overwatch to counter the enemy team, based on a provided screenshot of your team composition.

Screenshot of app

How to Run

You will need Python 2.7, pip, PostgreSQL, and OpenCV installed. See detailed instructions below for OpenCV installation on macOS.

pip install -r requirements.txt # install required Python libraries
createdb overwatch_counter_picker # create the database
python -m src.db.create # create database tables

Server

The server will run at 127.0.0.1:5000. Run with ./server.sh.

Command-Line Script

The command-line script will allow you to pass an Overwatch screenshot and determine which hero you should pick. It's useful because it produces an image with boxes showing exactly which heroes were detected where. So if an upload to the web app doesn't find all the players on a team, run the same image through the command-line script for debugging what it "sees." Run with python -m src.cli. You can pass it the path to an image, e.g., python -m src.cli sample-screenshots/hero-selection-not-full.jpg.

How to Install OpenCV

Here's how I installed OpenCV in macOS Sierra using Homebrew. Basically follow this macOS OpenCV installation guide, namely:

brew install python python3
brew linkapps python
brew linkapps python3
brew tap homebrew/science
brew install opencv3 --with-contrib --with-python3 --HEAD
echo /usr/local/opt/opencv3/lib/python2.7/site-packages >> /usr/local/lib/python2.7/site-packages/opencv3.pth
mv /usr/local/opt/opencv3/lib/python3.5/site-packages/cv2.cpython-35m-darwin.so /usr/local/opt/opencv3/lib/python3.5/site-packages/cv2.so
echo /usr/local/opt/opencv3/lib/python3.5/site-packages >> /usr/local/lib/python3.5/site-packages/opencv3.pth

How to Test

pip install -r requirements.txt
pip install coverage
./run-tests.sh

Tests will be run and a test coverage report will appear afterward.

You can run an individual test using its class and method name like so:

python -m test.hero_detector_test HeroDetectorTest.test_detect_finds_lucio_when_present

How to Deploy to Heroku

heroku login
heroku create your_app_name
heroku buildpacks:set https://github.com/diogojc/heroku-buildpack-python-opencv-scipy
git push heroku master
heroku addons:create heroku-postgresql:hobby-dev # create database
heroku run python -m src.db.create # create tables

Thanks

Thanks to Blizzard for Overwatch. The hero portraits and names are all theirs, I'm just a fan. โค๏ธ

overwatch-counter-picker's People

Contributors

cheshire137 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

justbarreto

overwatch-counter-picker's Issues

Not detecting Mercy in mostly empty match

This screenshot:

screenshot_16-08-02_21-54-24-000

Uploading this results in the 'bad upload' page being shown. Running it through the command-line script shows that Mercy is not detected as the player:

res

The screenshot is 1920x1080, so the app has to upscale it to be 2560px wide. This could be related.

Fix Mei blindness

Need a template for Mei so the app can detect her in screenshots. Needs to be taken from a 2560x1440 screenshot like the other templates.

Wrong player detection

I uploaded:

screenshot_16-12-25_17-13-00-000

And it didn't detect Torbjorn as the hero I was playing:

hero-detection

This is probably due to the lack of Mei detection yet, but should retry this screenshot when Mei's template is added. See #2.

Always suggest pick for left-most player on blue team

Given this screenshot, taken by a spectator:

Backslash's screenshot while spectating

It suggested cheshire137 go Ana:

screen shot 2016-12-25 at 10 59 09 am

Even though I built the app, I don't want it to only suggest characters for me to play. ๐Ÿ˜€ Why did it omit Mercy from the team lineup instead of Zenyatta?

Disable upload button after form submitted

So the user doesn't repeatedly submit the form because it's going slowly and there's no visible difference, disable the 'upload' button after the form has been submitted.

Not detecting dead heroes in some screenshots

@squished-01 provided this album of screenshots with heroes that weren't fully detected. They look to be 1920x1080, so not the same resolution from which I made the image templates but that hasn't prevented other screenshots at that size from being fully detected. My first guess is that dead heroes are detected fine in 2560x1440 but not when the template is scaled down to suit 1920x1080.

This might be fixed by adding templates specifically for dead heroes. I think even if those are taken from a 2560x1440 screenshot, since the template will have the X over the hero's face, it will be detected even when scaled down.

Boxes around heroes are offset in cli.py output image

Even when an input image does not get resized, the boxes drawn around hero faces are offset somewhat from where the templates are detected:

res

Mercy's template includes both her eyes, for example, but they're not in the drawn box in the image above:

mercy

Add feedback link on result page

Add some way for a user to give feedback. Maybe a simple form with options like "not all heroes detected," "hero I was playing wasn't detected correctly," or "bad advice given." Also link to issues page on GitHub.

Record screenshot resolutions, team compositions, and picks suggested

To help figure out if the app is giving good advice, it should log the width and height of uploaded screenshots, which heroes were detected on each team, which hero the user was playing, and which hero(es) were suggested. Could be fun to surface this data on another page, stats about which team compositions are most popular.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.