Tiles and Objects (Puzzle)

From NSMBW Modding Database
Jump to navigation Jump to search

Puzzle Tileset Editor can be used to set various attributes on tiles. These include setting the Properties and the Core Type (collision data). Most of these properties can be changed from within Puzzle, but unfortunately not all of them. It's for example not possible to give an object the item from a specific ?-block. Such edits have to be done by HEX-editing files from the tileset directly.

Changing Attributes (Behaviors, Properties and Collision Data) for Tiles and Objects

Please see the Puzzle Tileset Editor documentation, to learn how to set available attributes on tiles.

Attributes for objects on the other hand cannot be modified at all from within Puzzle. To set attributes on objects, a file from the tileset needs to be modified with a HEX-Editor.

Step 1: Extracting the required Files from a Tileset

Start BrawlBox, then open the tileset you want to modify.
Now, extract two files from the tileset.

From the folder BG_chk:
d_bgchk_TILESETNAME.bin, for example: d_bgchk_Pa0_jyotyu.bin
And from the folder BG_unk:
TILESETNAME.bin, for example Pa0_jyotyu.bin


Save them in a folder so that you can find and modify them. Keep BrawlBox open because we need to replace the modified files later.

Step 2: Understanding the Purpose and Structure of the extracted Files

The file d_bgchk_TILESETNAME.bin in BG_chk is used to store the attributes for tiles.
The file TILESETNAME.bin in BG_unk is used to store the attributes for objects.


Structure of d_bgchk_TILESETNAME.bin (Tiles)

This file contains all the attributes that can be set on tiles, such as behaviors and collision data.
Each tile utilizes 8 bytes of data, starting from the very beginning of the file.


Each byte can set one attribute from a list of available behaviors or Core Types.
The data for each tile is identical to what is shown in Puzzle under "HEX-Data".

Thanks to the Newer Team and Tempus, the values for those 8 bytes are mainly known. The full lists can be seen here on the same page.


Structure of TILESETNAME.bin (Objects)

This file contains all the attributes that can be set on objects, such as tile/slope properties, tilenumber, and tile attributes. The full lists can be found here on this page.
Each object utilizes 3 bytes of data for objects with normal tiles, and more bytes for objects with sloped tiles. The first object starts from the very beginning of the file.
The linefeed for objects and sub-blocks of slopes is FE in the HEX-Code, while the end of each object is denoted with FF in HEX.


Each byte can set one attribute from a list of available behaviors or slope properties.


All used values of BG_chk

Jump to BG_unk (Objects)


Byte 0: (missing 0x1, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80)

0x0
0x2 Used for Ice Walls. Meltable.


Byte 1: (missing 0x4, 0x20, 0x40, 0x80)

0x0
0x1 Pipe Flag
0x2 Falling Block Flag (Donut Blocks)
0x8 Steep Ledges (shimmying/hanging)
0x10 Fake Block? (Pa1_obake)


Byte 2: (missing 0x1, 0x2, 0x20)

0x0
0x4 Climbing Grid Flag
0x8 Partial Solid Flag
0x10 Spike Flag
0x40 Pass-Down (Solid-on-Bottom)
0x80 Pass-Through (Solid-on-Top)


Byte 3: (missing 0x80)

0x0
0x1 Full-Solid
0x2 Coin
0x4 Used for invisible Question Blocks
0x5 Question Block
0x8 Explodable Block (Byte 7 = 0x2)
0x8 Used Block (Byte 7 = 0x0)
0x10 Breakable
0x20 Slope
0x40 Flipped Slope


Byte 4:

0x0


Byte 5:

0x0
0x1 Icy Ground Flag A (Penguin Sliding? Slipping?)
0x2 Icy Ground Flag B (Penguin Sliding? Slipping?)
0x3 Quicksand Flag (Gets Replaced w/ Quicksand)
0x4 Conveyor Belt (Left/Right?, Fast/Slow?)
0x5 Conveyor Belt (Left/Right?, Fast/Slow?)
0x6 Horizontal Climbing Rope/Pole
0x7 Half Spike Terrain Flag (Test more)
0x8 Ledge Terrain Flag
0x9 Vertical Climbing Pole
0xa Staircase Terrain Flag (No sliding?)
0xb Carpet Terrain Flag
0xc Dusty Terrain Flag
0xd Grass Terrain Flag
0xf Beach Sand Terrain Flag


Byte 6:

0x0
0x2 Green Large Pipe
0x6 Red Large Pipe
0xa Yellow Large Pipe


Byte 7: (No Flag - mostly Rails)

0x0
0x1 1/1 Diagonal Rail Upslope
0x2 1/1 Diagonal Rail Downslope
0x3 90° Corner Fill
0x4 90° Rail Corner
0x5 Straight Horizontal Rail
0x6 Straight Vertical Rail
0x7 ???
0x8 2/2 Gentle Rail Upslope
0x9 1/2 Gentle Rail Upslope
0xa 2/2 Gentle Rail Downslope
0xb 1/2 Gentle Rail Downslope
0xc 2/2 Steep Rail Upslope
0xd 1/2 Steep Rail Upslope
0xe 2/2 Steep Rail Downslope
0xf 1/2 Steep Rail Downslope
0x10 1 Panel Circle
0x11 2x2 Circle UR
0x12 2x2 Circel UL
0x13 2x2 Circle LR
0x14 2x2 Circle LL
0x15 4x4 Circle 1 (UL)
0x16 4x4 Circle 2
0x17 4x4 Circle 3
0x18 4x4 Circle 4 (UR)
0x19 4x4 Circle 5 (L)
0x1a 4x4 Circle 6 (R)
0x1b 4x4 Circle 7 (L)
0x1c 4x4 Circle 8 (R)
0x1d 4x4 Circle 9 (LL)
0x1e 4x4 Circle 10
0x1f 4x4 Circle 11
0x20 4x4 Circle 12 (LR)
0x22 Rail Stops
0x23 Beanstalk Stopper
0x28 Coin Outline
0x35 Coin Battle Coin
0x36 Red Block Outline
0x37 Red Block Outline
0x38 Cave Entrance Right
0x39 Cave Entrance Left
0x3b Unused in Game (nohara)


Byte 7: (Climable Grid Flag)



Byte 7: (Coin Flag)

0x0 Generic Coin
0x1
0x2
0x3
0x4 Blue Coin / Pow Block Coin
0x5
0x6
0x7
0x8
0x9
0xa
0xb
0xc
0xd
0xe
0xf


Byte 7: (Explodable Block Flag)

0x0
0x1 Stone Block (shards?)
0x2 Wooden Block (shards?)
0x3 Red Block (shards?)
0x4
0x5
0x6


Byte 7: (Pipe Flag)

0x0 Vert. Top Entrance Left
0x1 Vert. Top Entrance Right
0x2 Vert. Bottom Entrance Left
0x3 Vert. Bottom Entrance Right
0x4 Vert. Center Left
0x5 Vert. Center Right
0x6 Vert. On Top Junction Left
0x7 Vert. On Top Junction Right
0x8 Horiz. Left Entrance Top
0x9 Horiz. Left Entrance Bottom
0xa Horiz. Right Entrance Top
0xb Horiz. Right Entrance Bottom
0xc Horiz. Center Left
0xd Horiz. Center Right
0xe Horiz. On Top Junction Top
0xf Horiz. On Top Junction Bottom
0x10 Vert. Mini Pipe Top
0x11
0x12 Vert. Mini Pipe Bottom
0x13
0x14
0x15
0x16 Vert. On Top Mini-Junction
0x17
0x18 Horiz. Mini Pipe Left
0x19
0x1a Horiz. Mini Pipe Right
0x1b
0x1c Vert. Mini Pipe Center
0x1d Horiz. Mini Pipe Center
0x1e Horiz. On Top Mini-Junction
0x1f Block Covered Corner


Byte 7: (Question Block Flag)

0x0 Fire Flower
0x1 Star
0x2 Coin
0x3 Vine
0x4 1-up
0x5 Mini Mushroom
0x6 Propeller Mushroom
0x7 Penguin Suit
0x8 Ice Flower
0x9
0xa
0xb
0xc
0xd
0xe
0xf


Byte 7: (Partial Solids)

0x0 Empty Block
0x1 Upper Left
0x2 Upper Right
0x3 Top Half
0x4 Lower Left
0x5 Left Half
0x6 Diagonal Upwards
0x7 Upper Left 3/4
0x8 Lower Right
0x9 Diagonal Downwards
0xa Right Half
0xb Upper Right 3/4
0xc Lower Half
0xd Lower Left 3/4
0xe Lower Right 3/4
0xf Full Block


Byte 7: (Slope Flag)

0x0 1/1 Upslope (Null without Byte 3 = 0x20)
0x1 1/1 Downslope
0x2 1/2 Upslope
0x3 2/2 Upslope
0x4 1/2 Downslope
0x5 2/2 Downslope
0x6
0x7
0x8
0x9
0xa Slope Edge (Solid Slope)
0xb 1/4 Upslope
0xc 2/4 Upslope
0xd 3/4 Upslope
0xe 4/4 Upslope
0xf 1/4 Downslope
0x10 2/4 Downslope
0x11 3/4 Downslope
0x12 4/4 Downslope
0x13
0x14
0x15
0x16
0x17
0x18
0x19
0x1a
0x1b
0x1c
0x1d
0x1e
0x1f


Byte 7: (Spike Flag)

0x0 2/1 Spikes Left
0x1 2/1 Spikes Right
0x2 2/1 Spikes Up
0x3 2/1 Spikes Down
0x4 1/2 Spike Downwards
0x5 2/2 Spike Downwards
0x6 1/1 Spike Downwards
0x7
0x8
0x9
0xa
0xb
0xc
0xd
0xe
0xf


Byte 7: (Conveyor Belt Flag)

0x0 ???
0x1 ???
0x2 ???
0x3 ???



All used values of BG_unk

Jump to BG_chk (Tiles)


Upperslope:

0x0
0x90
0x92
0x93
0x91

Possible bits - 0x80 (slope flag), 0x10, 0x02, 0x01


Lowerslope:

0x0
0x84

Possible bits - 0x80 (slope flag), 0x04


First Byte:

0x0 does not tile, which means it tiles fine
0x1 only useful for setting X stretch.
0x2 only useful for setting Y stretch.
0x3 only useful for setting X/Y stretch.
0x4 set for the subblock of a slope


Second Byte: Denotes the tilenumber used for the object.


Last Byte:

0x0 Inherit tile behaviour
0x4 Fire Flower
0x8 Star
0xc Coin
0x10 Vine
0x14 Spring
0x18 Mini Mushroom
0x1c Propeller Mushroom
0x20 Penguin Suit
0x24 Yoshi
0x28 Ice Flower
0x2c empty/unknown
0x30 empty/unknown
0x34 empty/unknown
0x38 empty/unknown
0x3c empty/unknown
0x1 empty/unknown
0x2 empty/unknown
0x3 empty/unknown
0x8 empty/unknown
0x90 empty/unknown
0xff empty/unknown

Possible bits - 0x01, 0x02, 0x04, 0x08, 0x10, 0x20

Step 3: Setting custom Attributes on Objects

Please note: Those attributes can only be used on tiles with behaviour set to "Question Block" or "Invisible Question Block".

To do that, locate the HEX code for the tile you want to change (in d_bgchk_TILESETNAME.bin), then change byte 3 to 0x4 (Invisible Question Block) or 0x5 (Question Block). Other tile types don't seem to work, but not all combinations were tested.

Now back to the objects: The two bottom bits from byte 3 are the tileset slot. That's also the reason why the values for byte 3 are multiplied by 4 (0x0 = Inherit, 0x4 = Fire, 0x8 = Star, 0xC = Coin, 0x10 = Vine etc). This causes the result to "bitshift" to the left, so that the last 2 bits can be used for the tileset slot. Please note that the tileset slot should always be the same for the entire tileset. Pa0 = 0, Pa1 = 1 etc.

For clarity, we've marked the bits for byte 3 in binary notation: XXVVVVTT, where XX = Unknown (tested and no visible change), VVVV = Value, and TT = tileset slot.

After modifying the files, save them and put them back in your tileset with BrawBox, save the tileset and you're done.

Pro Tip:

  • Create 12 identical objects from the tile you want to assign Power-Ups to.
  • Give that tile the property "Question Block" or "Invisible Question Block" by HEX-editing your d_bgchk_TILESETNAME.bin file.
  • Assign the 12 available Power-Ups to your newly created objects, by HEX-editing your TILESETNAME.bin file, as shown above.
  • Save the HEX-edited files, put them back (replace) in BrawlBox, and save the tileset.