Brikwerk / bdsp-automation

Automation scripts for shiny hunting and other activities in Pokemon Brilliant Diamond and Shining Pearl
MIT License
13 stars 3 forks source link

BDSP Automation

This repository aims to automate the repetitive or difficult aspects of Pokemon Brilliant Diamond and Shining Pearl. Automation is accomplished through analysis of Switch video output and controls issue through an emulated Pro Controller.

Functionality is split into two main components:

  1. An automation script specific to a given task that performs video analysis and controls the Switch.
  2. A webpage/server for viewing video from the Switch and displaying stats from a given automation script.

Requirements

Hardware Requirements

An example setup is pictured in the above image. The numbered items correspond to the following:

  1. A Raspberry Pi 4B (4GB of RAM) with Wifi and Bluetooth capabilities
  2. An HDMI-to-USB Video Capture device
  3. The Switch's HDMI cable which connects the capture device and the Switch dock.
  4. A docked Nintendo Switch running a game

Software Requirements

Initial Setup

  1. Ensure that Python 3 is available on your command line. The following command should generate output similar to the following:
> python3 --version
Python 3.7.3

If python3 is not available, please use the package manager on your system to install it.

  1. Check that Pip is available to install Python packages:
> pip3 --version
pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7)

If pip3 is not available on your system, please use your package manager to install python3-pip.

  1. Use pip3 to install the required Python packages on the root account. The root account is required for proper controller emulation.
sudo pip3 install -r requirements.txt
  1. Install tmux through your system's package manager
# Example for APT package manager-based systems
sudo apt-get install tmux
  1. Install v4l2loopback through your system's package manager
# Example for APT package manager-based systems
sudo apt-get install v4l2loopback-dkms
  1. Configure your Switch with the following settings

    • The Dark Theme should be selected as your system theme.
    • The Switch's dock output resolution should be set to 480p. This helps with transcoding and streaming on low-end hardware. This setting is located in System Settings > TV Settings > TV Resolution
    • (Optional) If the script you plan to run does not require internet access and likely will run for a prolonged period of time, you should disconnect your Switch from the internet. This prevents update prompts, which can derail automation.
  2. For notifications, this project leverages Pushover. If you do not wish to use Pushover but do wish to receive notifications, feel free to edit the src/notify.py file to your liking. If you do wish to use Pushover, please create a notify-keys.json file at the root of this project and fill it with the following template:

Please fill in the template with your keys before using with any scripts.

{
    "user-key": "YOUR-USER-KEY-GOES-HERE",
    "token": "YOUR-API-TOKEN-GOES-HERE"
}

Running Automation Scripts

Please see the guides located in the docs folder for situation-specific automation scripts.