Note: this tutorial assumes that the porytiles executable exists on your system path. It also assumes your pokeemerald project is stored at the $HOME location. If your executable or project lives elsewhere, you'll need to change those paths in the commands below.
Table Of Contents
- Table Of Contents
- Setting Up The Layer PNGs
- Creating The Tileset In Porymap
- Compiling The Tileset
- Next Steps
Setting Up The Layer PNGs
If you haven't read Compiling A Primary Tileset, go do that now since this tutorial is a direct continuation of that one.
First up, let's create another directory to hold our tile assets for this secondary set:
mkdir $HOME/porytiles-secondary-tutorial
Just like before, we'll create a bottom.png, middle.png, and top.png, each 128x128 pixels and filled with RGB=255,0,255. Again, they should all look like the following:
Let's add some content to these layers. We'll again be using TheDeadHeroAlistair's Project Heliodor Tileset, since it's awesome. Again, if you want to follow along, you can find these assets here.
Notice how our secondary layer sheets include content that looks like it duplicates tiles that were on our primary layer sheets. That's OK! Porytiles is smart enough to figure out when it can reuse tiles and palettes from the paired primary set, even including the case where tiles are flipped in new ways. In this example, since the grass tiles we used in our secondary layer sheets match those from the primary sheets, Porytiles can reuse them without duplicating the assets.
Creating The Tileset In Porymap
Just like before, we'll need to create a tileset in Porymap. In Porymap's menu bar, select File -> New Tileset. Create a secondary set called PorytilesSecondaryTutorial. Then in the pane on the right, change your map's secondary tileset to gTileset_PorytilesSecondaryTutorial. Your Porymap should now look something like this. Note that like before, the tileset is blank because we haven't compiled anything yet.
For this secondary set, we won't be specifying any custom metatile attributes, so we will omit attributes.csv. You can of course add this file if you wish to give some metatiles custom attributes. You'll see a compiler warning letting us know that attributes.csv is missing, and that it will use defaults. This is fine.
Compiling The Tileset
Ok, time to compile! Run the following command. It's fairly similar to the primary compilation command. But notice there is an additional argument where we specify the paired primary set. In Porytiles, secondary compilation must always specify a paired primary. This is what allows Porytiles to intelligently reuse tile and palette assets where possible:
porytiles compile-secondary -dual-layer -Wall -o $HOME/pokeemerald/data/tilesets/secondary/porytiles_secondary_tutorial $HOME/porytiles-secondary-tutorial $HOME/porytiles-primary-tutorial $HOME/pokeemerald/include/constants/metatile_behaviors.h
Note that if your project is using triple layer tiles, simply omit the -dual-layer flag.
Great. In Porymap select File -> Reload Project, and you should now see something like this:
Awesome! Our secondary tileset is now imported. You can go ahead and add some secondary metatiles to the map.
One final note: since secondary sets depend on their paired primary for some tile and palette assets, it's always a good idea to recompile a secondary set if you have changed its paired primary. Otherwise you may end up with strange visual artifacts due to the secondary and primary being out of sync.
And that's it! You now should have a good feel for how to create primary and secondary tilesets from scratch.
Next Steps
I suggest you next read the animation tutorial, since animated tiles are an essential part of any good tileset. It will pick up right where this tutorial leaves off. Alternatively, take a look at any of the other wiki articles to learn more about topics of interest.
Starting Out
Compilation
Decompilation
Decompiling A Secondary Tileset
Advanced Topics
Makefile Integration
Target Base Game and Fieldmap Overrides
Other Useful Options
Tileset Optimization





