I am working on a 32x32 metatile background engine, but started thinking about this when I started making some dummy data to test with. Would it be better to store the attribute byte with the metatile, or separate from it? As an example, if I were to store it like this:
... I would then have the attribute attached to the end of each tile. There is also the option of this:
I'm starting to think that maybe I should store them separate, because there is the possibility of compressing the attributes. I don't know which is really more beneficial, or if I'm overlooking anything. Any thoughts?
Code:
; 32x32 metatiles = tile_name: four bytes for 16x16 metatiles and one byte for the attribute table
tile32_000:
.byte $00,$00,$00,$00,$00
tile32_001:
.byte $01,$02,$00,$00,$00
tile32_002:
.byte $00,$00,$01,$02,$00
tile32_000:
.byte $00,$00,$00,$00,$00
tile32_001:
.byte $01,$02,$00,$00,$00
tile32_002:
.byte $00,$00,$01,$02,$00
... I would then have the attribute attached to the end of each tile. There is also the option of this:
Code:
screen_00:
.addr tile32_001, tile32_001, tile32_001, tile32_001, tile32_001, tile32_001, tile32_001, tile32_001
.addr tile32_000, tile32_000, tile32_000, tile32_000, tile32_000, tile32_000, tile32_000, tile32_000
.addr tile32_000, tile32_000, tile32_000, tile32_000, tile32_000, tile32_000, tile32_000, tile32_000
.addr tile32_000, tile32_000, tile32_000, tile32_000, tile32_000, tile32_000, tile32_000, tile32_000
.addr tile32_000, tile32_000, tile32_000, tile32_000, tile32_000, tile32_000, tile32_000, tile32_000
.addr tile32_002, tile32_002, tile32_002, tile32_002, tile32_002, tile32_002, tile32_002, tile32_002
screen_00_attrib:
.byte $00, $00, $00, $00, $00, $00, $00, $00
.byte $00, $00, $00, $00, $00, $00, $00, $00
.byte $00, $00, $00, $00, $00, $00, $00, $00
.byte $00, $00, $00, $00, $00, $00, $00, $00
.byte $00, $00, $00, $00, $00, $00, $00, $00
.byte $00, $00, $00, $00, $00, $00, $00, $00
.addr tile32_001, tile32_001, tile32_001, tile32_001, tile32_001, tile32_001, tile32_001, tile32_001
.addr tile32_000, tile32_000, tile32_000, tile32_000, tile32_000, tile32_000, tile32_000, tile32_000
.addr tile32_000, tile32_000, tile32_000, tile32_000, tile32_000, tile32_000, tile32_000, tile32_000
.addr tile32_000, tile32_000, tile32_000, tile32_000, tile32_000, tile32_000, tile32_000, tile32_000
.addr tile32_000, tile32_000, tile32_000, tile32_000, tile32_000, tile32_000, tile32_000, tile32_000
.addr tile32_002, tile32_002, tile32_002, tile32_002, tile32_002, tile32_002, tile32_002, tile32_002
screen_00_attrib:
.byte $00, $00, $00, $00, $00, $00, $00, $00
.byte $00, $00, $00, $00, $00, $00, $00, $00
.byte $00, $00, $00, $00, $00, $00, $00, $00
.byte $00, $00, $00, $00, $00, $00, $00, $00
.byte $00, $00, $00, $00, $00, $00, $00, $00
.byte $00, $00, $00, $00, $00, $00, $00, $00
I'm starting to think that maybe I should store them separate, because there is the possibility of compressing the attributes. I don't know which is really more beneficial, or if I'm overlooking anything. Any thoughts?