How to use Color Tile Mapping support functions

Certain older devices like Gameboy (GBC/GBA) use special techniques to display its graphics (background or sprites). All graphics are defined as tiles with a special width, height and color depth. Each tile uses a single palette where the pixel colors are defined and there is a limited number of tile palettes to be used by the tiles.
The GBC specification for background tiles looks like this:

Size of a single tile: 8x8 pixels
Number of colors per tile: 4
Number of possible tile palettes: 8

These are the default settings for the functions that help you to create such tile graphics. These functions can be found in the menu Colors/Color Tile Mapping.
There you can also set up the tile mapping settings.

When doing tiled graphics you usually create your palettes and start drawing your tiles. According to the number of colors used by each tile palette a single palette must start at a multiple of the palette size. Let's assume that we have the following four palettes:

Palette 1 uses the color entries 0 to 3, palette 2 uses 4 to 7 and so on. As you can see some tile palettes contain equal colors like blue, purple or yellow.
When you are drawing a complete graphic and you are working on a tile that is to use palette 2, then it's hard to find out if you have currently selected the blue of palette 2 or of another palette. Also a tile can accidently contain 5 colors instead of the 4 that are allowed.

Check for Errors

The function Check for Errors can be used to find such tile errors. Please read through the following examples to understand how this function works.

Example 1

The tile below contains green and blue from palette 1, purple from palette 4 and cyan from palette 2. The Gameboy would not be able to display this tile correctly, because the color indices are not taken from a single tile palette. Pro Motion will now help you to identify pixels that don't fit into the tile palette. For this it is assumed that the wanted palette for the tile is palette 1. This is assumed because the most color indices are taken from this palette (green and blue pixels). That means that the cyan and purple pixels are taken from a wrong palette which is an error.

If you now start the Check for Errors function then an error pixel map will be created as a separate indication layer that will be displayed on top of your graphics. In this example the created image will look like this:

Use the "i"-shortcut to switch the indicator layer on/off or use the corresponding check box at the bottom of the magnify window.

Because the cyan and purple pixels are used from different palettes they are supposed to be wrong. Fortunately they also appear in the tile palette that is meant to be used. That means they could be simply remapped to the right palette (number 1). How this can be done is described later (function Repair Errors).

Pixel errors that can be repaired by remapping are displayed white.

Example 2

The pixel error described in the first example can be easily solved, because all colors that have been used are available in a single tile palette.

Another problem occurs when either more colors are used than allowed within a tile (i.e. 5) or if there is no tile palette where all tile pixel colors can be found:

In this example the tile contains green, blue and purple from palette 1, but yellow from palette 2. There is no single tile palette where all these colors are available. That means the tile could not simply be remapped.

If you run the Check for Errors function on this tile then the resulting error map in the indication layer will look like this:

Pixels that can't be repaired by a tile palette remapping are displayed red.

Repair Errors

This function will automatically find the best matching palette for each tile and remaps the colors to this palette. Error pixels will then be set to the best matching color within this palette. If you use repair errors on example 1 then the whole tile is remaped to palette 1 whithout loss of quality. With example two Repair Errors would try to find the best matching palette for the tile. In this case also palette 1 will be used and the yellow pixels will turn green:

Optimize Palettes

In opposite to the repair function the optimization function creates new tile palettes. That means it scans through all the tiles and creates a set of palettes that fit best. After this it remaps all the tiles to the new color palettes.
But this function only works with graphics that have been built to fit into the tile scheme. That means it is not made to create a GB-image out of a normal 256 color image. It's an error correction function, and was not made to convert any image to a tile based one!

Related topics

Tile Mapping Settings

Last modified: 17 March 2017