Tilemap

From SMWiki
Jump to: navigation, search

A tilemap is a map of tiles on the screen, or more literally, a table of tile numbers and their properties used to display objects or sprites.

Typically, they use two bytes per tile, first a tile number byte and then an attribute byte. The number byte, which is the lowest 8 bits of the tile number, could also be thought of as the tile number in one of a number of "pages" of tiles. The attribute byte is divided up into bits which are used in different ways. It contains information on how it is drawn, including bits to flip along the X and Y axis, the palette number, and priority information. In addition, this byte has the higher bits of the tile number, which can be thought of as the "page" from which it will look up the tile.

There are a few major formats that SNES and SMW tilemaps use.

Contents

Background Layer Tilemaps

Background layer tilemaps use attribute bytes in the YXPCCCTT format.

Examples of tilemaps in this format include:

The statusbar tilemaps starting at $008C81 (SNES)
Tile data for all Layer 1 overworld tiles at $05D000 (SNES)
All map16 tile data

There are also places that use only tiles (as in the status bar's RAM) and some places that set all attributes to one value.

Sprite Tilemaps

Most sprites will use tilemaps that only have the tile and set the attribute bit on the fly. Some sprites have hardcoded attribute bytes as well. Sprite attribute bytes use an almost identical tilemap format, except that there are two priority bits and only one "page" bit. This is known as the YXPPCCCT format. It is easy to confuse the two, so care must be taken. (Note that the technical term for the sprite layer is the "object layer", not to be confused with the "objects" that SMW and other games use to place Map16 tiles into the level.)

Stripe Image Format

A simple RLE-like compression format for layer tilemaps used in cutscenes and for layer 3 backgrounds. Can be edited with Terra Stripe or Racing Stripe. For more info look here. Note that it is possible to make Layer 1 and 2 stripe images with Racing Stripe, but you will need to insert these into the ROM yourself, as Racing Stripe does not save to the ROM.

"ExGFX Format"

Note that it is possible, at least with some ASM knowledge and the ExGFX Revolution Patch Set, to use tilemaps compressed as ExGFX files, which are said to compress better then stripe image format (or at least with complex backgrounds). Presumingly this involves using the Generic ExGFX File Uploader (aka genericuploader.asm) to upload an ExGFX file to VRAM in a area used for tilemaps instead of for graphics edit1754 has a tool called stim2bin that is intended for ripping Layer 3 backgrounds. It can convert a .stim file (saved by Racing Stripe) to a tilemap .bin file to be uploaded with the Generic ExGFX File Uploader. He the only known person who advocates this method so far.

Personal tools