Skip to content

Compiling A Secondary Tileset

grunt-lucas edited this page Jul 12, 2024 · 12 revisions

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

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:

A blank layer PNG

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.

bottom.png

middle.png

top.png

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 Tools -> 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.

Porymap with the blank secondary tileset

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:

Porymap with the compiled secondary tileset

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

Why Should I Use This Tool?

Installing A Release

Building From Source

My First Demo

Compilation

Compiling A Primary Tileset

Compiling A Secondary Tileset

Adding Animations

Metatile Attributes

Decompilation

Decompiling A Primary Tileset

Decompiling A Secondary Tileset

Editing Vanilla Tilesets

Advanced Topics

How Porytiles Works

Warnings and Errors

Makefile Integration

Target Base Game and Fieldmap Overrides

Other Useful Options

Primer Tiles

Layering Structures to Maximize Palette Efficiency

Clone this wiki locally