Porytiles automation with Aseprite CLI and Shell script - Pawkkie/Team-Aquas-Asset-Repo GitHub Wiki

Made using pokeemerald_expansion 1.9.2 (not tested with pokeemerald but should work regardless)

porytiles default_build_version 1970.01.01T00:00:00+00:00

Aseprite 1.3.8.1-x64

Working with Porytiles and Aseprite

redtruth (mako)

As I recently started making use of Porytiles, I saw how powerful the tool was. However, the process detailed by the tutorial gets repetitive when doing it manually; from having to make the BG of each layer transparent and making your desired edits, filling the BG with #ff00ff as recommended by the tutorial, and then cross-referencing the commands from the tutorial page or typing them out from memory. Of course, it's not a complicated tool to use by any means, but there are steps to speed up and streamline the task. For that, with the help of a background-coloring Python script*, I made a simple Shell script.

As an example of what the script can do, while compiling a tileset, the script will take an .aseprite file and split it into three layers called bottom.png, middle.png and top.png. Then, it will paint the transparent pixels #ff00ff, and finally run the porytiles compilation. There are also options for decompiling tilesets, and bulk compiling secondary tilesets after editing a primary tileset.

Make sure to read the whole page before using it!

Note: This is intended to be used for people using WSL to compile their projects. It's possible to adjust the script to work regardless, though.

Installation

Download both the helpfulporytiles.sh and normalize.py files HERE (there are two files in the gist, either download the two files manually or download as zip).

Place the unzipped files in a place where it makes sense.

Install python, and python's library Pillow. If any further step was needed to use this, do let me know so I can edit this section!

sudo apt update
sudo apt install python3 python3-pip
sudo apt install python3-pil

Note: pip3 install Pillow won't work btw

Adjusting the script

There are a few edits you need to make to fit your workflow. At the top of helpfulporytiles.sh you'll see the following declarations:

# CUSTOM PATHS

## WSL PATHS
dir_raw_tilesets="/mnt/d/Decomps/tilesets/"
dir_raw_tilesets_primary="${dir_raw_tilesets}primary/"
dir_raw_tilesets_secondary="${dir_raw_tilesets}secondary/"
dir_aseprite_folder="/mnt/d/Program Files/"
dir_compiled_primary="/mnt/d/Decomps/pokeemerald-expansion/data/tilesets/primary/"
dir_compiled_secondary="/mnt/d/Decomps/pokeemerald-expansion/data/tilesets/secondary/"
metatile_behaviors="/mnt/d/Decomps/pokeemerald-expansion/include/constants/metatile_behaviors.h"
normalize_py="/mnt/d/Decomps/tilesets/normalize.py"

## WINDOWS PATH
dir_aseprite_raw_tilesets="D:/Decomps/tilesets/" 

# END OF CUSTOM PATHS

As you can see, the default values are tailored to how my files are organized. You'll need to edit these to fit your case. I highly recommend you to have a folder raw_tilesets in the head directory where your pokeemerald_expansion folder is located, NOT inside it. You should also structure your raw_tilesets folder with subdirectories called primary and secondary. This method of organization enables the bulk recompilation of secondary tilesets, which is a very helpful command.

If your folder is not organized that way, you are free (and you have) to edit this script to your liking.

Most of these definitions should be self-explanatory, but I will emphasize that dir_aseprite_raw_tilesets needs to be declared using the windows path format.

Note: You do not have to escape spaces here, as you can see in dir_raw_tilesets.

Using the script

Using the script should be fairly straightforward. Let's say I would like to compile a new secondary tileset. I open Aseprite, create three layers called bottom, middle, and top, and edit in the desired metatiles. Then, I save it to its own folder in dir_raw_tilesets, all according to the tutorial by Gruntlucas so far, except the layer naming part.

Ensure that your .aseprite file is named "tilesetase.aseprite". This naming convention is chosen rather arbitrarily - it's just to emphasize that it's the raw tileset in an aseprite format, but this can be altered at will.

Then, I open WSL, run the script by going to the folder where it's located and inputting the command:

sh helpfulporytiles.sh

Then, I just follow the steps outlined by the menu.

Next steps

Feel free to edit the script to your preference and let me know of any questions you have, modifications or additions you implement, so that we can provide it for everyone in the community!

Observation

  • I wasn't particularly familiar with the Pillow Python library, so this section was GPT-assisted.