EarthBound Beginnings/Map data

From Data Crystal
< EarthBound Beginnings
Revision as of 20:58, 4 May 2006 by Goplat (talk | contribs) (created)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

EarthBound Zero uses one very large map containing all areas in the game. To accomodate this within the small space available in a NES cartridge, two levels of tiling are used: the map is made of 64x64 tiles, which in turn are made of 16x16 tiles.

Main map data

Map bank layout
RangeBits 0-5Bits 6-7
0000-1FFFMap
2000-2FFF64x64 tiles
3000-37FF16x16 tiles64x64 palettes
3800-3FFFMap sectors

The main part of the map data, located at 2010-2000F, is "organized" into eight 16kB banks, each containing data for 32 rows of the map and 4 tilesets. Bank 0 is at 10-400F, bank 1 is at 4010-800F, and so on until bank 7 which is at 1C010-2000F. You may have noticed that bank 0 is partially outside the range given. Bank 0 is special in that it only contains tilesets; there is unrelated data in the first half of it where the map would be.

Ranges stated hereafter in this section shall refer to offsets within each bank, rather than the whole file.

Map

The map itself is in the first half of each bank, from 0000-1FFF. Each byte corresponds to one 64x64 tile. Bits 0-5 determine which tile to use. Bit 6, if set, will use a tile from the second tileset instead of the first. Bit 7 is set on tiles which change based on events, of which there are only two in the whole game: one north of Merrysville for the rocks blocking the way to Union Station, and one at the very top of Mt. Itoi behind the "XX".

64x64 tiles

The composition of 64x64 tiles is at 2000-2FFF. Bits 0-6 select a 16x16 tile, and bit 7 determines whether to use the first or second tileset again. If the 64x64 tile was from the first tileset, then setting bit 7 will put in a 16x16 tile from the second tileset, and vice versa.

64x64 tile palettes

These are in the upper 2 bits of 3000-3FFF. Each byte determines the sub-palette for one of the 16x16 tiles that a 64x64 tile is made of.

16x16 tiles

16x16 tiles are at 3000-37FF, in the low 6 bits only. Each byte selects one 8x8 PPU tile.

Map sectors

Properties associated with map sectors (squares, 4 tiles wide) are at 3800-3FFF, again in the low 6 bits only. Each sector has 4 bytes here; they are the palette, area, first tileset, and second tileset in that order. Map sectors with palettes differing from the current palette are not displayed.

Map area random encounter table

Map area random encounter table
Game EarthBound Zero
Start Address 0x295A3
End Address 0x295E2
# of Entries 64
Entry Length 1
Total Length 64 bytes (0x40)
Back to the ROM map

This table, located at 295A3 to 295E2, determines both the set of random encounters and the frequency thereof with one byte for each map area. The frequency is in bits 0-2 (lower values mean more battles), and the group in bits 3-7.

Random encounter groups

Random encounter groups
Game EarthBound Zero
Start Address 0x29210
End Address 0x2940F
# of Entries 32
Entry Length 16
Total Length 512 bytes (0x200)
Back to the ROM map

The random encounter group table determines all the possible random battles. Whenever a random encounter starts, a random byte out of the appropriate group of 16 is picked. If it is 0, another byte is picked until a nonzero one is found; in this way there may be fewer than 16 possible battles. The byte refers not to an enemy, but to an enemy group.