Skip to content

Palette Overrides

grunt-lucas edited this page Mar 8, 2025 · 32 revisions

Table Of Contents

Motivation

You may have noticed that palette primers do not give you control over the ordering of the output palettes, nor the ordering of colors within each palette. For direct control over palette and color orderings, palette overrides are the right choice. This feature may be especially useful for:

  1. DNS systems which expect window lights to be in specific, fixed palette slots
  2. Forcing tile sharing, i.e. saving tile space by storing one tile that can index into multiple palettes, e.g. the vanilla Pokémart and Pokécenter roof tile
  3. Cases where you want to manually construct palettes, or re-use palettes you already created manually

Palette overrides and palette primers are complementary features. Both will work together, and (in most cases) play nicely with Porytiles's automatic palette assigment algorithm.

How To Use The Feature

First step: create a palette-overrides directory in your source folder, right along side your layer PNGs and attributes CSV. Within the palette-overrides directory, you can place a JASC .pal file for each output palette you want to override. E.g. if you want to override some slots in output palette one, then place a JASC .pal file called 01.pal in your palette-overrides directory. A palette override JASC .pal file must have size 15, and must not include the transparent color. Porytiles handles this for you.

Here's a simple example. Suppose you want output pal 1 in your primary tileset to contain a particular red tone in pal slot 2, and a particular green tone in pal slot 3. You don't care about the contents of any other palette slots. Create a 01.pal file with the following contents, and place it in your palette-overrides folder:

JASC-PAL
0100
15
-
240 20 40
50 200 40
-
-
-
-
-
-
-
-
-
-
-
-

A - tells Porytiles that you don't care what it puts in that particular palette slot. After compilation, you should see that your 01.pal in the output palettes directory contains the colors you specified at the appropriate slots!

A Note About Transparent And Pal Slot 0

You'll notice after compilation that the output palette has size 16, and that the 0th slot is transparent. So the colors you specified in palette-overrides/01.pal are "shifted down" one slot in the output palettes/01.pal. Recall that since pal slot 0 always contains the transparent color, you don't need to specify it in your override. The 0th pal slot in your 15-slot override becomes the 1st pal slot in the 16-slot output pal. Keep this in mind when placing colors in your override. For example, if you want your DNS window color to be in pal slot 2 in the final output pal, you'll need to place it in pal slot 1 in the override, since the final output pal will contain transparent at its slot 0, thus shifting your window color down one slot.

Case Study: Tile Sharing

Let's now look at a more complex example which showcases how you can use palette overrides to pull off a tile sharing optimization.

Manual Palette Allocation With Overrides

Palette overrides provide a way to force Porytiles to use a manual palette allocation. For example, let's assume you want to manually allocate the palettes for a pokeemerald primary tileset. First, create your palette-overrides directory within the Porytiles-format tileset directory. Then, copy your 00.pal through 05.pal into the palette-overrides folder. Finally, open each palette and adjust the declared size to 15 and remove the transparency color in slot 0. If your tiles are not allocatable with the palettes you've provided, you'll receive the usual error message.

This functionality is very useful in the following scenarios:

  1. You want Porytiles to handle tile flip/dupe optimization and metatile construction, but you'd like to set up palettes manually.
  2. Porytiles is struggling to allocate palettes for your tileset, but you know it's possible and can see where the allocation algorithm is going wrong.
  3. You have an old manually-constructed Porymap-format tileset that you've imported to Porytiles-format via the decompiler, but you want to keep your original, manually-constructed palettes.
Clone this wiki locally