Tile Randomization

Introduction
After you have created your tileset you may have some problems with repeating tiles like this: This is how you want it to look like: This page will help you to create randomized tilesets for Newer Super Mario Bros Wii and Reggie.

Requirements
- Puzzle Next

Tutorial (in-game & Reggie)
Credits: Nin0

If you use a Newer based mod you can edit a so called RandTiles.bin file to add randomizations in-game. Otherwise you will only be able to use tile randomization with the Reggie level editor.

With Puzzle Next you can open both RandTiles.bin files and tilesetinfo.xml files from Reggie. You can then edit the randomizations in the .xml format and save it to both RandTiles.bin and tilesetinfo.xml.

In a sense the RandTiles tab of Puzzle Next is a converter for both formats!

If you want to edit or add randomizations just follow the "Reggie tile randomization (old version)" section of this page. It is recommended that you edit the randomizations in Puzzle Next itself while you have opened the tileset for which the new randomizations are being created, as you can hover your mouse over the tiles to see their row and column.

Requirements
- Newer Source Code

- Puzzle

- Ruby

- Notepad++

In-game tile randomization
'''NOTE: This part of the tutorial was originally written by CLF78 on HorizonWII.net so credit goes to him for this part. Some parts were rewritten because not everything was mentioned before.'''

Pre Steps
- Go in  and open the code in Notepad++

- Open your tileset in Puzzle, to better visualize what tiles you want to randomize

Step 1 - Adding your tileset to the Script
- This will add your tileset to the randomization list. For this example we'll be using the tileset Pa1_chika. - Scroll until the end of the file in Notepad++ (before the directory), then paste the following (If it doesn't exist already) and DON'T forget the PaX_ prefix - Edit this template as you wish (remove the second tileset, if you don't need it) - When you're done it should look like this :

Step 2 - Choosing the tiles to randomize
- These steps will allow you to find what tiles will be randomized

- Go back to Puzzle

- Now you have to find the tiles' coordinates. You have to count the tiles from left to right in hexadecimal which goes like this:

- Remember that you have to write the Y-postition first and then the X-position.

Step 3 - Adding randomization to the code
- It is now time to add the randomization code to the newly-added tileset!

- Paste the following template in a new line inbetween the start and the end of the code of the tileset you want to randomize:

If you have many tiles that are next to each other, like in the example above, you can do that in a quicker way by using the following template:

Note that a parameter is not necessary. For example if we want to randomize the tiles from X=2 and Y=0 to X=7 and Y=0 it would look like this:

Parameters
Parameters tell the game in which direction to randomize. Their usage depends on the tile's usage in Reggie

-   is for tiles that are only expanded horizontally

-   is for tiles that are only expanded vertically

-   is for tiles that are expanded in both directions

-   and   are for couples of tiles, as they allow to apply randomization to both while matching each top tile (where   is applied) to the respective bottom one (where   is applied ).

Examples
- For example 1 we'll randomize the top tiles. The code would be: - For example 2, we'll randomize the inside ground (which gets expanded in both directions), so this time the code will be: - In example 3, the tiles are not next to each other, so they will have to be listed individually. This also applies to vertical walls. In this case the code will be: Use these examples as a template for your randomization.

Step 4
- At the very end of the file you'll find a directory. Change it to the NewerRes folder you want to have it inside of:

- Make sure that you have a folder with the randtilegen.rb file and a shortcut of the terminal in it

- Open the terminal window from the folder, and type the following:

- This will generate a RandTiles.bin ready to be used in-game

Presteps and differences
There aren't many differences between the code of the randtilegen.rb file and this one except it's written in the XML language.

While the code of the Ruby file looks like this: The code of the XML file looks like this: As you can see there are some small differences which is whythis part of the tutorial exists as well. - Head to the directory where your reggie folder is located and then go to

Step 1 - Adding your tileset to the Script
Because it is in XML this means it will also have a different listing method. The template below will help you: - Again edit this template as you wish (remove the second tileset, if you don't need it)

- When filled, it will look like this :

Step 2 - Choosing the tiles to randomize
- It's almost exactly like the method with Ruby. It's written in hexadecimal as well and you have to write down the Y-Position first and then the X-Position

Step 3 - Adding randomization to the code
- It's now time to add the randomization code to the newly-added tileset!

- Paste the following template in a new line inbetween the start and the end of the tileset code:

If you have many tiles that are next to each other, like in the first and second example, you can make it in a quicker way, using the following template (the first and last tiles are included): For example from X=2 and Y=0 to X=7 and Y=0 it would look like this:

Parameters
Parameters tell the game in which direction to randomize. Their usage depends on the tile's usage in Reggie:

-   is for tiles that are only expanded horizontally

-   is for tiles that are expanded vertically

-   is for tiles that are expanded in both directions

-   and  are listed as special parameters and will be added behind the normal parameter:

Examples
Top tiles Center tiles Wall tiles Use these examples as a Template for your Randomization.

When you're finished you just need to save the file and reload the tilesets. Then you're done with randomizing your tilesets in Reggie.

Tileset Editing