Skip to main content

Automate painting posts in Splatoon based on BlueZ, and optimize its efficiency via Traveling Salesman Problem (TSP).

Project description

Splatoon Bot

GitHub Actions Workflow Status

Automate painting posts in Splatoon based on BlueZ, and optimize its efficiency via Traveling Salesman Problem (TSP).

The mailbox is a service in the Splatoon hub that allows players to create drawings and share them via social media. The drawings may be viewable by other players and may be displayed as signs or graffiti in the hub and in various stages in multiplayer matches.

Installation

BlueZ is a Bluetooth protocol stack included with the official Linux kernel distributions. If you have a Linux machine with a Bluetooth connection, then things become easier:

$ pip install splatbot

If you're using macOS or Windows, an external Bluetooth adapter is needed and please follow the instructions below:

  1. Install VirtualBox
  2. Install VirtualBox Extension Pack
  3. Install Vagrant
  4. Clone splatbot and make a Vagrantfile:
    $ git clone https://github.com/necusjz/splatbot.git
    $ cd splatbot/vagrant
    $ ./make_vagrantfile.py
    

After that, a Vagrantfile will be generated and the current directory is the location where you run any Vagrant command.

Usage

Generate the macro represents the actual painting process:

$ splatbot macro -i <image>

Wirelessly painting the post on switch console or another window:

$ splatbot start -i <macro> [--dry-run]

Several Vagrant commands that might be useful:

Create and configure guest machines according to your Vagrantfile:
$ vagrant up

SSH into a running Vagrant machine and give you access to a shell:
$ vagrant ssh

Shut down the running machine Vagrant is managing:
$ vagrant halt

Stop the running machine Vagrant is managing and destroy all resources that were created during the machine creation process:
$ vagrant destroy

Pathing

We optimize pathing efficiency by treating the painting process as a variant of Traveling Salesman Problem (TSP). It's a classic optimization problem where the goal is to find the shortest possible route that visits a given set of cities and returns to the original city.

If you want to solve it without returning to the start, it essentially becomes the problem of finding a Hamiltonian Path, which visits each city exactly once. To further scale down, we divide the image into 8x3 parts (with patch size of 40) and label the contiguous region as a city.

Benchmark

We provide a dataset collected from ikasumi.art to easier achieve performance test on your pathing algorithm:

The results will be shown in the pipeline (via pytest -s -v --color=yes tests/):

+------------------+-----------+------------+--------------+
| Benchmark        | Current   | Previous   | Result       |
+==================+===========+============+==============+
| jellyfish.png    | 17078     | 44514      | 2.61x faster |
+------------------+-----------+------------+--------------+
| judd.png         | 32728     | 52616      | 1.61x faster |
+------------------+-----------+------------+--------------+
| kanji.png        | 41557     | 55961      | 1.35x faster |
+------------------+-----------+------------+--------------+
| marie.png        | 43280     | 53238      | 1.23x faster |
+------------------+-----------+------------+--------------+
| octoling.png     | 38008     | 54232      | 1.43x faster |
+------------------+-----------+------------+--------------+
| sakura.png       | 63809     | 66214      | 1.04x faster |
+------------------+-----------+------------+--------------+
| skyline.png      | 61949     | 63751      | 1.03x faster |
+------------------+-----------+------------+--------------+
| splattershot.png | 34804     | 52910      | 1.52x faster |
+------------------+-----------+------------+--------------+
| Geometric Mean   | N/A       | N/A        | 1.33x faster |
+------------------+-----------+------------+--------------+

Contributing

We love contributions! Before submitting a Pull Request, it's always good to start with a new issue first.

License

This repository is licensed under MIT. Full license text is available in LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

splatbot-2.1.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

splatbot-2.1.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file splatbot-2.1.0.tar.gz.

File metadata

  • Download URL: splatbot-2.1.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for splatbot-2.1.0.tar.gz
Algorithm Hash digest
SHA256 c9b304e9be31b6191fa0b48dbe38f4164d7d91b9fa9705a5174c9b8716323e10
MD5 6db8b204b7b4678e73bb097ceb3c32be
BLAKE2b-256 fdf166a25a079d0af33c645322710756b9e58b60f7f9bc7be613d71bca43ee67

See more details on using hashes here.

File details

Details for the file splatbot-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: splatbot-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for splatbot-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cc6cbef63daa9ac9d006dd4a4a595770ed9751fabc0c0f7f21a0e07461eee9f0
MD5 7bf99a3f6b74439520902b8e7f8707f2
BLAKE2b-256 8f8f9d92e5a77ac1579c723498bee87631fe93279868eddece115c3675df7e15

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page