gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Setting tile sizes for a regular tiled background

#163894 - ZachG - Tue Oct 14, 2008 4:39 pm

I have 16x16 tiles that I use to make my maps. The problem is that they're viewed as 8x8. For instance, if I wanted to have my first 16x16 tile show up, I'd have to put the values 0x0000, 0x0001, 0x0010, and 0x0011 into my map instead of just 0x0000. It's going to make collision detection too tedious.

Is there an option that I can set in grit to make it parse them as 16x16, or is there an option when I'm setting my control register (see below) to tell it that the tiles are 16x16?

-Zach

p.s. Control Register initialization
Code:
BG2_CR = BG_TILE_BASE(0) | BG_MAP_BASE(8) | BG_COLOR_256 | TEXTBG_SIZE_256x256;


p.p.s. Grit file
Code:
# Set the warning level to 3
-W3

# Include the palette
-p

# Tile the image
-gt

# 8 bit, 256 color
-gB8

# Perform reductions
-mRtpf

# Map layout standard format
-mLs

# Column major formatting
-tc

#163898 - Cearn - Tue Oct 14, 2008 6:20 pm

The size of the tiles in backgrounds is 8x8; that's just how the 2D hardware works. However, you can use a process known as meta-tiling. Here the 8x8 tiles are grouped into larger units (the meta-tiles) and you have a meta-map of these larger units instead of in 8x8 tiles. You still have to break the meta-map and meta-tiles down to 8x8 units for VRAM though.

You can create a metamap with grit using the -Mw and -Mh options. For a bitmap named foo, you will get:
  • fooTiles: the 8x8 tiles.
  • fooMap: the metatiles, which are effectively maps of normal tiles (yeah, I know I should probably rename this to fooMetaTiles, but that would break all metamaps produced previously so I'm still reluctant to do so :\ )
  • fooMetaMap: the map of metatiles.
  • fooPal: the palette for the tiles.
There's a example of how to work with this in the grit demo project.