NSMB Level Format Documentation Written by Treeki. Copyright 2007 All data (except where stated) here was discovered by me (Treeki). BGDAT files: 10 bytes for each object. A map: 2 = Tile type 2 = X 2 = Y 2 = Width 2 = Height Each of these are encoded in 2 bytes. Formula to convert 2 byte format to an integer: ((second byte * 256) + first byte) Formula to convert integer to 2 byte format: first byte = number mod 256 second byte = (number - (number mod 256)) / 256 All positions are in tiles, not in pixels. Each tile is 16x16 pixels. Collisions are determined by the tile; you do not have to set them yourself. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Normal level files: -- To be updated as more is discovered -- These values are encoded using the same 2 byte format described above: 0x74 = Time Limit 0x76 = Background Graphics Set 0x7C = Level Tileset Graphics Set (also, collision data) 0x82 = Background (Near Layer) Graphics Set 0xAA = Background Tile Layout (seems to also change some tiles like question block and brick to their appropiate level's palette) 0xAC = Background Palette 0xC0 = Level Tileset Palette 0xD2 = Background (Near Layer) Tile Layout 0xD4 = Background (Near Layer) Palette 0xDA = ?? 0xDC = ?? 0xE4 = Start position X? (div. by 0x10 to get real X) 0xE6 = Start position Y? (div. by 0x10 to get real Y) 0xF2 = ?? (I think it changes Mario's pose on starting. 00 80 is normal, 08 00 is groundpounding like in 1-2.) Enemies/sprite commands are shown this way: 0x30 = Offset at which the first enemy is located At the offset specified at 0x30, each enemy/sprite command is 12 bytes, as in: 2 = Enemy type 2 = X position 2 = Y position 6 = Additional enemy/sprite command-specific data Enemy-specific data: Koopa Troopa/Paratroopa colours: (Thanks to Tanks) The 4th byte in "Additional data" can be changed as in: 00 = Green 01 = Red 02 = Blue 03 and over = Blue ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TSA Data: (\bg_pnl files) -- To be updated as more is discovered -- 8 bytes for each TSA entry. Map: 1, 3, 5, 7 = Tile numbers (top left, top right, bottom left, bottom right respectively) 2, 4, 6, 8 = Other bytes (one for each tile number) Bit map for other bytes: (INCOMPLETE, I'm not entirely sure about these) 7 = ?? 6 = ?? 5 = ?? 4 = ?? 3 = ?? 2 = Flip on X axis 1 = Flip on Y axis? 0 = ??