Using Metatiles to Maximize for Retro Consoles
All of the main retro home consoles that we work with store their artwork in 8x8px tiles. The tiles are then arranged on the screen in order to make the overall image of the background. While this is simple enough conceptually, with platforms like the NES size is at a pretty extreme premium. Loading up large areas with an almost unlimited configuration of 8x8 tiles can take up a lot of space inside of the ROM. So for larger projects, it is generally a better course of action to use metatiles.
Metatiles are predefined configurations of tiles that adhere to a consistent set of dimensions. NES games for example tend to use 32x32px metatiles. The ends up breaking down to a configuration of tiles that is 4x4 tiles in size. Sometimes it can be difficult to manage designing a level with metatiles, so my suggestion is to always try to make your metatiles first, and then use them instead of a normal tileset when you are creating a level. You probably won’t know exactly what metatiles you will need for an entire level before you begin working on it, but just make the basics that you know you will need. For example, if you are making a platformer you will probably want to have a metatile that has a platform at the bottom of it and open-air above it. Another example might be to make a metatile that has wall tiles on one side of it.
In order to make your metatiles, you want to open up the level’s tileset in an image editor, and set your grid to an appropriate size (For the NES it should be 16x16px to adhere to attribute table restrictions, and for 16bit consoles, you should set it to 8x8px).
This is a simple tileset for the sake of this demonstration. You might be working with one that has more in it.
Once that is open, you will want to create a new image. The dimensions of this image aren’t important other than the need to be a multiple of 8. Keep in mind though that you are going to be using this as your tileset in Tiled, so don’t make it too large. Make it big enough to make your essential metatiles, and leave some room if you need to add more later on. For this image, you will actually need two grids. The main one will be 16x16 (8x8 for 16bit games). The secondary one will be the size of your metatiles. For this example, we are using 32x32px metatiles.
The first grid is so that you are easily able to line up your 16x16 elements correctly. This can just be achieved with the normal grid tool. In order to have the 2nd grid, you can either make a bunch of guidelines, or you can create a new layer and draw one by setting up the 32x32 grid normally and tracing the lines (Some programs like Gimp have a filter under Render > Pattern that is able to generate a grid as well. Use whatever method works best for your workflow).
Now that your metatile sheet is set up, it is time to start moving tiles over. Again for NES games, you will be using 16x16 blocks instead of the standard 8x8 tiles, due to how background palettes are chosen on that platform. All you do is copy segments from your base tileset and paste them into the new image, and arrange them how you think would be most useful in larger 32x32 chunks.
The above isn’t all of the meta tiles that I will need ultimately for my level, but it is a good amount to start myself with. As you work on your level, you might discover the need for a metatile that you currently don’t have. That is why you should give yourself ample space to add to it.
Once you have your essential metatiles laid out, save the image and open up Tiled. Create a New Map and change your Tile size to whatever size your metatiles are. Remember that the Map size option is measured in tiles (map dimension will vary depending on the game).
After that, you will create a New Tileset. Keep the settings as they are, give it an appropriate name, and pick the image of your metatiles as your source image.
Once that is all set up, you are good to start laying out your levels just like normal. Again, you will undoubtedly run into a situation where you need a metatile that you haven’t made yet, but you can edit the metatile image that you made directly all you want. It should update automatically in Tiled once you save the new version, but if it doesn’t, then you just need to reload the map.
In this case, I made all of the walls and platforms, but I didn’t include a metatile that is solid brown to fill in the empty space on the floor. So I have to add one of those in to fulfill that need.
Once the new image is saved, it automatically updates in Tiled.
And now I can fill in those blank areas with my new metatile.
Building out levels in this way makes it so the game has to store much less in terms of unique information. Instead of storing a large array of 8x8 tiles that could be in an infinite amount of different combinations, the game will only have to store the predefined metatiles, and a much smaller array of them.
There are going to be technical considerations that need to be taken into account for each game and platform that you work with. The above example uses 32x32px metatiles. That is a pretty common size for NES games and is used pretty frequently for projects that have larger level sizes. Other games might require the use of smaller, or even oddly shaped metatiles. In some cases, they might even be larger. Top-down games will generally require different things depending on the gameplay, as well. For the Genesis project Lethal Wedding, we went with metatiles that are 64x32 because we discovered that it was going to be the most lightweight way to store very large explorable levels. It ended up breaking down in a way that each meta tile only takes up 8kb of space, as opposed to having to store a giant array of essentially random 8x8 tiles. When we only have 4MB of total ROM space to work with, and very large maps planned, saving all of that space is pretty crucial.
Little Medusa is an example of a game where it was necessary to use smaller 16x16px metatiles. Due to the fact that the stages were only simple single-screen areas, the level size wasn’t as much of a concern. Also, there were a lot of different kinds of tiles with special properties, like hurting the player, making it impossible to place boulders, pushing things in certain directions, etc. So in this case, having the metatiles be 16x16 just made sense.
A great example of oddly shaped metatiles is actually The Legend of Zelda. Instead of using more commonly seen square metatiles, that game was designed in columns. Each metatile is a 16px wide column that spans the height of the entire playing area. Due to the fact that it had an extremely limited amount of ROM space (128kb for the entire game to be exact), an economical choice had to be made. They went with vertical columns that could be applied across the entire game, keeping all of the different tiles inconsistent spots across all of the tilesets. Doing it this way meant that every single screen in a fairly large game could be made out of the same collection of a couple of dozen configurations of columns. If that was done with 16x16px metatiles that means that the game would have had to store up to 240 different metatiles, and each screen would have needed an array of 240 metatile assignments to create the map. That is a lot of data. With the columns, they only needed to store a couple of dozen column configurations, and every screen only needed to store an array of 16 columns.
Metatiles will definitely be a great way for level designers to make games take up much less space when they design levels. Designing levels in this way is absolutely crucial when it comes to designing larger titles on retro platforms.