Skip to content

AdriaGual/marvel-snap-bot

Repository files navigation


Markdownify
Marvel Snap Bot

A computer vision bot made with OpenCV and ADB.

Python

Key FeaturesHow To UseImprovements

Animation

Capture

Key Features

  • Card detection
    • Detect player cards on live time
  • Automate the decision making
  • Mana consumption tracked
  • Fields with different priorities and constraints
  • ADB Support (Bluestacks, any version)
  • Global utils to apply for other computer vision bots
  • Calculate the power of the cards
  • Farm missions
  • Farm season pass
  • Play kazoo decks with applied logic
  • Quick usage

How To Use

To clone and run this application, you'll need Git, OpenCV, Bluestacks and Python 3. From your command line:

# Clone this repository
$ git clone https://github.com/AdriaGual/marvel-snap-bot

# Go into the repository
$ cd marvel-snap-bot

# Install dependencies
$ pip install -r requirements.txt

# Edit the config.py file
adb_path: Absolute path to where you can execute ADB
project_path: Absolute path to the project
images_folder: Absolute path to the images folder
fields_folder: Absolute path to the fields images folder
mana_folder: Absolute path to the mana images folder
turns_folder: Absolute path to the turns folder
data_folder: Absolute path to the card images folder
tmp_path: Absolute path to a tmp folder

# Make sure that Bluestacks has the ADB enabled
Settings -> Advanced -> Android Debug Bridge (ADB)

# Check if you have the correct resolution
The script is made to work on 1600x900 resolution

Add the images to the each folder

You can grab them from the emulator, there is an option on the script to get the info in real time. Just change the False parameter from the functions get_my_hands_cards and get_fields. image

Card images structure folder

Remember that this cards need its values entered manually on the cp_list.py file

image

Images structure folder

image

# Run the bot
$ python start.py

Note In order to see the bot start, you must install the game (Marvel Snap Bot) on Bluestacks and start it.

Improvements

There are plenty of improvements still, here's a bunch of:

  • Fields should be detected automatically
  • The points of each field is not tracked, it can be done with pytesseract
  • The cards on the player field don't show the power
  • Detect the enemy cards on the field
  • Keep track of the winrate of a session

License

MIT