User Tools

Site Tools


return_of_samus:technical_information:level_data_banks

This is an old revision of the document!


Level Data Banks

 MII Samus This document aims to give a technical explanation of how Metroid II views its level data banks in an easy to read format, including some diagrams to assist.

Metroid II has 7 banks dedicated to level data and they all follow the same format. An 0x500 (dec: 1,280) byte header, and the remaining 0x3500 (dec: 13,568) bytes for level data chunks.

Bank Header

Level Data Pointers

The first 0x200 (dec: 512) bytes of the bank header deal with creating the actual layout of the room, you can think of Metroid II as having 7 huge 16×16 rooms, with smaller rooms that have been fitted into it Tetris style.

There are 256 2 byte pointers (little-endian (i.e. reversed)) which point to the Level Data Chunks inside the same bank, if we look at Bank 9 we can see the first 8 pointers are:

00 4F | 00 7E | 00 7E | 00 62 | 00 45 | 00 45 | 00 45 | 00 4F

You can see how some pointers are reused, that's because while you have 256 screens in each room to split up into smaller rooms, the bank can only support 59 unique screens, so you must reuse screens somewhere in the area. Below is a quick diagram of how the screens are arranged (so the first two bytes correspond to screen 00, next two 01 and so on till the end of this part of the header)

+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|00|01|02|03|04|05|06|07|08|09|0A|0B|0C|0D|0E|0F|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|10|11|12|13|14|15|16|17|18|19|1A|1B|1C|1D|1E|1F|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|20|21|22|23|24|25|26|27|28|29|2A|2B|2C|2D|2E|2F|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|30|31|32|33|34|35|36|37|38|39|3A|3B|3C|3D|3E|3F|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|40|41|42|43|44|45|46|47|48|49|4A|4B|4C|4D|4E|4F|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|50|51|52|53|54|55|56|57|58|59|5A|5B|5C|5D|5E|5F|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|60|61|62|63|64|65|66|67|68|69|6A|6B|6C|6D|6E|6F|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|70|71|72|73|74|75|76|77|78|79|7A|7B|7C|7D|7E|7F|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|80|81|82|83|84|85|86|87|88|89|8A|8B|8C|8D|8E|8F|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|90|91|92|93|94|95|96|97|98|99|9A|9B|9C|9D|9E|9F|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|A0|A1|A2|A3|A4|A5|A6|A7|A8|A9|AA|AB|AC|AD|AE|AF|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|B0|B1|B2|B3|B4|B5|B6|B7|B8|B9|BA|BB|BC|BD|BE|BF|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|C0|C1|C2|C3|C4|C5|C6|C7|C8|C9|CA|CB|CC|CD|CE|CF|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|D0|D1|D2|D3|D4|D5|D6|D7|D8|D9|DA|DB|DC|DD|DE|DF|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|E0|E1|E2|E3|E4|E5|E6|E7|E8|E9|EA|EB|EC|ED|EE|EF|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|F0|F1|F2|F3|F4|F5|F6|F7|F8|F9|FA|FB|FC|FD|FE|FF|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

In theory, this means you could probably make a 16×16 room in Metroid II, I have not tested this yet, as that's a fair bit of editing but I will when I got more time, it looks like adding in more rooms is as simple as creating more of these level banks.

Scroll Pointers

The next 0x100 (dec: 256) bytes are scroll types, each byte corresponds with a screen and dictates how the scrolling works on that screen.

In binary, each byte is formatted like this:

0000wxyz
 w - Down
 x - Up
 y - Left
 z - Right

1 blocks scrolling in the given direction
0 permits scrolling

Therefore, the corresponding hex values are:

00-Free Scroll
01-Stop Scrolling Right
02-Stop Scrolling Left
03-Vertical Shaft
04-Stop Scrolling Up
05-Stop Scrolling Up Right Corner
06-Stop Scrolling Up Left Corner
07-Vertical Shaft End Up
08-Stop Scrolling Down
09-Stop Scrolling Down Right
0A-Stop Scrolling Down Left
0B-Vertical Shaft End Down
0C-Hallway
0D-Hallway End Right
0E-Hallway End Left
0F-No Scroll

Creating a transition between rooms in the same 16×16 area is as simple as making them not scroll into each other, an example of how this is done is below.

00 | 01 | 02 | 03

Say you had a hallway like this and wanted to make a transition between the two rooms, you would need to set screen 01 to 0D and 02 to 0E, when Samus moves to the edge of 02, the game will scroll samus into 01 in a room transition style.

Screen Transitions Indexes

The next 0x200 (dec: 512) bytes form another 16×16 array of little-endian two-byte values. They serve two functions:

  1. One of the bits of the value (bin:wwwwxxxxyyyy-zzz) determines the priority of Samus' sprite relative to the background for the screen. Yes, really. They put it here of all places. It has no bearing on the screen transition.
  2. The value itself specifies the screen transition number that the screen uses. The data that governs what each screen transition does is located in bank 5.

For more information on how the transition data works, see Screen Transitions.

Level Data Chunks

the next 0x5900 (dec: 15104) bytes are the 59 level data chunks. each chunk is 16×16 bytes. each byte is one tile, and they are orginized 100% linearly. take the final chunk for example (which is, ironically, the first screen you ever see):

7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f
7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f
7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f
7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f
7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f
7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f
7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f
7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f
7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f
3c|0c|0d|0e|0f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f
15|16|17|12|18|19|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f
20|21|22|23|24|25|26|7f|7f|7f|7f|7f|7f|7f|7f|7f
2d|2e|2f|30|31|32|33|7f|7f|7f|7f|7f|7f|7f|7f|7f
37|05|06|07|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f|7f
7f|7f|7f|7f|7f|7f|7f|76|7f|71|70|74|73|76|70|7f
39|39|39|39|39|39|39|39|39|39|39|39|39|39|39|39

all you really need to know to understand what I mean is that 7f is air tiles, and 39 is ground tiles. if you DO want to have a breakdown of tiles hex values, see TILES.txt

return_of_samus/technical_information/level_data_banks.1512142770.txt.gz · Last modified: 2017/12/01 15:39 by liamnajor