Tile Randomization

From NSMBW Modding Database
Jump to navigation Jump to search

If your custom tileset doesn't replace an already existing one, you'll likely have issues with the tiles being repetitive, like the image below.

Tileset without randomization
The Pa1_chika tileset with no randomization

This is how you want it to be, randomized and non-repetitive.

Tileset with randomized tiles
The same tileset, now with randomization

This page will help you create randomized tilesets for both Newer Super Mario Bros Wii and Reggie.

Using Puzzle Next

Requirements

- Puzzle Next

If you use a NewerSMBW based mod you can edit a file in the /NewerRes folder named RandTiles.bin, which adds tileset randomizations in-game (retail tileset randomization is done in the game's code). If you are not using Newer as a base, you will only be able to use tile randomization with Reggie.

With Puzzle Next you can open both RandTiles.bin file, and Reggie's equivalent, the file in /reggiedata named tilesetinfo.xml. With Puzzle Next, you can edit both these files in the XML format and save it to both Newer's RandTiles.bin file and also Reggie's tilesetinfo.xml file (note that you can edit this file in any text editor, as it is in XML format).

RandTiles tab (Puzzle Next)

Making Tileset Randomizations

NOTE: If your tileset is similar enough to another tileset, you can simply add the tileset to the group with the tileset it is similar to.

This applies for both the RandTiles.bin file and Reggie's tilesetinfo.xml file. Both the RandTiles.bin file and Reggie's tilesetinfo.xml are in the same format, so no conversions/edits need to be made to the randomization code when putting it in the files. Reggie's tilesetinfo.xml file is in the /reggiedata folder. If you're using Reggie Next, and want to edit a Game Patch's randomizations, it can be found in /reggiedata/patches/YourPatch, and the file will have the same name.

Step 1 - Beginning Group Listing

To save space, tileset randomizations are defined in groups with the randomization rules inside. This is so tilesets that have similar setups can get randomization from the same group.

This is how a group is defined. The randomization rules go inside the empty space. in the names section (where "TILESETNAME, ANOTHERTILESETNAME" are at), you can define the name of your tileset. To do so, use the name of the tileset file, but leave the .arc extension off. The tileset name in the randomization file must be identical to the tileset file's name, or it will not work.

<group names="TILESETNAME, ANOTHERTILESETNAME">
    
</group>

Here's an example of a group with the Pa1_nohara tileset defined.

<group names="Pa1_nohara">

</group>

Step 2 - Choosing Tiles to Randomize (Finding Tile Positions)

When choosing the tiles you want to randomize, you need to get the X and Y position of them. These positions are in hexadecimal (0 through F, which is 1 through 16), and are above the tileset pane, in the image below.

The X-position is referred to as the Column, and the Y-position is referred to as the Row.

Example of the tile in Row 0, Column 0 being selected (top-left corner tile)

Step 3 - Adding Randomization Rules

Now it's time to actually start adding randomization. Randomization rules start with this tag:

<random />

After that, we will want to define the type of randomization that will be used:

<random range="" />

The first is the range randomization.

<random list="" />

The last is the list randomization.

Range Randomization Type

The range randomization type works by selecting a range of tiles to be randomized. It can be done like so:

<random range="0x00, 0x03" />

In most cases, this is used for the top ground (grass), bottom ground (ceilings), and inner ground tiles (middle ground).

Let's say we want to apply it to the Pa1_nohara tileset's grass tiles. We can do that by getting the XY positions of the leftmost tile, and the rightmost tile. To get the position of these tiles, hover over them to get the Row and Column position. The leftmost tile is Row 0, Column 2, while the rightmost tile is Row 0, Column 7.

When putting the tiles into the randomization rule code, you want to start with 0x, then put the Row number and the Column number, without any spaces. For example, the leftmost tile would be 0x02.

Once you have your tile's positions, you can insert them into the randomization rule:

<random range="0x02, 0x07" />

List Randomization Type

The list randomization type works by listing the tiles to be randomized, which is for when the tiles aren't in left-right order. It can be done like so:

<random list="0x00" values="0x00, 0x10, 0x20, 0x30" />

In most cases, this is used for the left/right wall tiles, which are usually arranged vertically in the tileset.

For this example, we'll randomize the left wall tiles in the Pa1_nohara tileset. To begin, we'll want to get the positions of our tiles (the inner wall tiles, not the grass or ceiling corners). The topmost tile is Row 1, Column 0, while the bottommost tile is Row 4, Column 0.

When putting the tiles into the randomization rule code, you want to start with 0x, then put the Row number and the Column number, without any spaces. For example, the topmost tile would be 0x10.

For lists, you need to also put in the positions of every tile you want to include.

Once you have your tile's positions, you can insert them into the randomization rule:

<random list="0x10" values="0x10, 0x20, 0x30, 0x40" />

The values field is where you can define the tiles that will be used, whereas the actual tile position in the list field is what tile these randomizations are applied to.

Randomization Direction

After the randomization type, there is another field titled direction, which is used for defining which direction the tile will be stretched.

There are three directions that can be used, vertical, horizonal, and both.

  • Vertical is for tiles that go up-down, such as wall tiles.
  • Horizontal is for tiles going left-right, such as grass or ceiling tiles.
  • Both is for tiles going both ways, such as the inner-ground tiles.

They can be defined like this:

<random list="0x10" values="0x10, 0x20, 0x30, 0x40" direction="vertical" />