/infinite-stairs-bot

Infinite Stairs bot on the BlueStacks 5 emulator

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Infinite Stairs Bot

A bot for the mobile app Infinite Stairs in Python. Two methods of object-detection can be used; Multi-Template Matching and YOLOv10.

Bot Example GIF

Requirements

  1. Enable virtualization on your device. Guide
  2. Install BlueStacks 5 (or other emulator). Download

Usage

  1. Install conda or miniconda
  2. Create the environment: for Multi-Template Matching (Windows):
    conda env create -f environment_mtm.yml
    
    for YOLO (Windows):
    conda env create -f environment_yolo.yml
    
  3. Make sure you can activate the environment: for Multi-Template Matching (Windows):
    conda activate isb-mtm
    
    for YOLO (Windows):
    conda activate isb-yolo
    
  4. Run tests [TODO]
    pytest tests
    
  5. Configure settings config.ini for your device's specifications [TODO]
  6. Run main.py to run the bot. (more details TBD)

Design [TODO]

The bot operates using three main components: screenshots, processing, and game inputs. Each component is run in parallel using multiprocessing since the processing step is by far the largest speed bottleneck.

Screenshots

The portion of the screen containing the game client is captured using the mss library.

Processing

  1. Screenshots are processed using either Multi-Template Matching or a YOLO model (subject to change, new models come out every several months :\) to detect stair and other miscellaneous objects.
  2. A path-tracing algorithm fills in any empty spaces missed by the previous step (max two consecutive stairs can be filled due to logical constraints).
  3. Fill a queue with True (Turn) or False(Forward) values based on the path.
  4. Keep track of a "current" queue state and "new" queue state. If their intersection is "valid" then queue new values from the "new" state into the "current" state. If the "current" queue is empty, use the "new" state as the "current" state.

Game Inputs

The game will turn the character on True and step forward on False. Use PyDirectInput to send keystrokes to the client.

Acknowledgements

Thomas, L.S.V., Gehrig, J. Multi-template matching: a versatile tool for object-localization in microscopy images BMC Bioinformatics 21, 44 (2020). https://doi.org/10.1186/s12859-020-3363-7