Here's some actual map data from my current game. Just like suggestions above, it's all structures of arrays. (except for the row_offsets array, that's just an array of words with row offsets typically used for horizontal maps, but also for horizontal transitions into vertical maps) It's a pretty simple format where I've got "big metatiles" which are full 32x32 pixel sized chunks which contain regular "metatiles" which are just 16x16 pixels or a square containing 4 nametable tiles. Each metatile has additional metadata such as the color attribute, and properties which is a bitfield with information about which direction to eject the character and an action to perform, if any.
Code:
.scope
map_header:
.byte MAP_MODE_VERTICAL
.word 0
.word 240
.word row_offsets ;note for a vertical map the only row offset that is provided is row[1] which is the stride, used for decoding columns when doing a horizontal transition into a vertical map). otherwise this is used for horizontal maps so no multiplication by row width must be done.
.word metatile_table_properties
.word metatile_table_params
.word metatile_table_attributes
.word metatile_table_top_left
.word metatile_table_top_right
.word metatile_table_bottom_left
.word metatile_table_bottom_right
.word big_metatile_table_top_left
.word big_metatile_table_top_right
.word big_metatile_table_bottom_left
.word big_metatile_table_bottom_right
.word map
row_offsets:
.word 0
.word 8
;metatile properties for collision and actions to perform upon decoding or collision
metatile_table_properties:
.byte $80 | MAP_ACTION_LADDER
.byte $f0
.byte $00 | MAP_ACTION_LOAD_MAP
.byte $00 | MAP_ACTION_LOAD_MAP
.byte $f0
.byte $f0
.byte $f0
.byte $f0
.byte $00 | MAP_ACTION_LOAD_MAP
.byte $f0 | MAP_ACTION_SPAWN_ENTITY
.byte $f0
.byte $00
.byte $f0
.byte $80 | MAP_ACTION_LADDER
.byte $00
.byte $f0
.byte $00
.byte $00
.byte $00 | MAP_ACTION_LEAVE_LADDER
.byte $00
.byte $f0
.byte $f0 | MAP_ACTION_SWAP_UPPER_2K_BANK
.byte $f0
.byte $00
;parameters for actions that require them
metatile_table_params:
.byte $00
.byte $00
.byte >1024
.byte <1024
.byte $00
.byte $00
.byte $00
.byte $00
.byte map_index_carnival_a
.byte entity_type_load_map
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte 2
.byte $00
.byte $00
;color to apply to a 16x16 chunk on the screen
metatile_table_attributes:
.byte $00,$aa,$00,$00,$55,$ff,$ff,$ff,$00,$00,$aa,$00,$aa,$00,$00,$ff,$00,$00,$00,$00,$aa,$00,$00,$00
;these are all nametable tiles describing a 16x16 square on the screen
metatile_table_top_left:
.byte $4d,$50,$83,$80,$01,$5c,$5e,$5e,$80,$03,$54,$80,$73,$4c,$83,$71,$83,$91,$80,$81,$52,$03,$03,$80
metatile_table_top_right:
.byte $4e,$51,$84,$80,$02,$5d,$5f,$60,$80,$04,$55,$80,$74,$4d,$84,$72,$84,$92,$80,$82,$53,$04,$04,$80
metatile_table_bottom_left:
.byte $4d,$56,$87,$80,$01,$66,$68,$6a,$80,$03,$5a,$80,$7a,$4c,$87,$79,$87,$96,$80,$85,$58,$03,$03,$80
metatile_table_bottom_right:
.byte $4e,$57,$98,$80,$02,$67,$69,$6b,$80,$04,$5b,$80,$7b,$4d,$88,$72,$98,$97,$80,$86,$59,$04,$04,$80
;All big metatiles are are 4 indices into regular metatile arrays above.
big_metatile_table_top_left:
.byte $0b,$12,$0e,$0b,$0b,$0b,$0f,$0b,$0f,$0b,$13,$0b,$17,$0b,$0b,$02,$0b,$10,$0a,$08,$0b,$0b,$0b,$0a
.byte $0f,$0b,$0b,$14,$0b,$0b,$0f
big_metatile_table_top_right:
.byte $17,$0c,$0b,$0c,$0b,$0b,$0f,$0b,$0b,$0b,$11,$13,$17,$0b,$0b,$0b,$01,$0b,$0b,$12,$0b,$0b,$0b,$0b
.byte $0f,$0b,$0b,$0a,$0b,$0b,$0b
big_metatile_table_bottom_left:
.byte $0b,$00,$0a,$0b,$10,$0b,$16,$0a,$0f,$14,$0b,$01,$11,$16,$0b,$03,$0b,$0b,$15,$09,$07,$11,$0b,$0a
.byte $0f,$13,$01,$0b,$05,$0e,$16
big_metatile_table_bottom_right:
.byte $13,$04,$0b,$0c,$0b,$13,$04,$17,$0b,$0a,$0b,$14,$11,$04,$0b,$0b,$0b,$0b,$04,$0d,$0b,$11,$01,$0b
.byte $0f,$11,$14,$0b,$06,$0b,$04
map: ;this is just a rectangle of big metatile indices
.byte $17,$0e,$0e,$0e,$0e,$0e,$0e,$03
.byte $17,$0e,$0e,$0e,$0e,$0e,$0e,$03
.byte $17,$0e,$0e,$0e,$0e,$0e,$0e,$03
.byte $17,$0e,$0e,$0e,$0e,$0e,$0e,$03
.byte $17,$0e,$0e,$0e,$0e,$0e,$0e,$03
.byte $17,$0e,$0e,$0e,$0e,$0e,$0e,$03
.byte $17,$0e,$0e,$0e,$0e,$0e,$0e,$03
.byte $17,$0e,$0e,$0e,$0e,$0e,$0e,$03
.byte $17,$0a,$11,$0e,$0e,$16,$09,$03
.byte $17,$0e,$0e,$0b,$02,$0e,$0e,$03
.byte $17,$1a,$07,$0e,$0e,$05,$1d,$03
.byte $17,$00,$0c,$15,$04,$10,$1b,$03
.byte $17,$0e,$0e,$1c,$14,$0e,$0e,$03
.byte $17,$19,$04,$18,$08,$0a,$0f,$03
.byte $12,$0d,$0d,$06,$1e,$0d,$13,$01
.endscope