How To

Idea for meta tiles (compressed tile maps)

6

Timo 2020-12-04 09:27

If you need several very big tile maps in your game, which wouldn't normally fit into the 32kB ROM, you could use "meta tiles". (When I say tile it's technically a cell.)

The idea is, instead of creating a map using single tiles, to use bigger predefined blocks (let's say 4x4 tiles) and build a map from these. We call these blocks "meta tiles". Normally 4x4 tiles are 32 bytes: 16 tiles, each with one byte for the character and one for the attributes (palette, flip, etc.). A predefined meta tile would already include attributes, so in the map data it could be referenced with only one byte. One instead of 32, that's pretty good.

Here a possible way to implement this:

First create your normal tiles as usual. Then create a background with size 64x64 in the BG Designer (or better Gfx Designer). You can create up to 256 meta tiles here.

Here is an idea how to edit the actual maps: We could write a special tool to work with meta tiles, but it's even possible to use the normal map editor. We only have to create preview characters for each meta tile. So you have to draw a scaled version of each meta tile in a single character. This character set is only used for editing, it could be removed from a final game. Then you draw your actual map using the preview characters. Keep in mind that the map will look 4 times bigger in the game later.

When you save you map in the normal map editor, it will still occupy two bytes per meta tile. You could write a small tool which removed every second byte, we don't need it.

The final step would be the map renderer in your game. It will check the map data for each meta tile and make a BG COPY from the corresponding position of the meta tile map.

Ok, this is advanced stuff. If you can fit your level maps in the normal way into the ROM, then keep do it. This idea is meant for games with several levels and giant maps. So far nobody made one like this in LowRes NX.


nathanielbabiak 2020-12-04 15:02 (Edited)

I think one of the great things about metatiles is they don't necessarily have to correspond to the cell layout used by the SIZE command. That's where the real power of metatiles comes from!

Suppose you have metatile 0 but you've "limited" it to LowRes NX SIZE 3, it'd reference cells 0-3, 16-19, 32-35, and 48-51.

If you remove this limitation, metatile 0 could reference non-sequential, non-ordered cells 0-255. It's like you're "customizing" BG SOURCE tilemaps of SIZE 3, in that you're not limited to the layout required of LowRes NX. You could also reuse an 8x8 cell within multiple metatiles.

Further, you're not even "limited" to 4x4 metatiles! (Zelda used 16 1x12 metatiles to cover the whole screen in vertical strips.) Although any non-square metatile shapes would be really cumbersome to edit with the tools currently available.


Timo 2020-12-04 20:28

Didn’t know that Zelda had 1x12 meta tiles, interesting :)


Log in to reply.