Tile Randomization

Introduction
'''NOTE: The ingame part of the tutorial was originally written by customlevelfan78 on HorizonWII.net so credit goes to him for this part. I have rewritten it a bit because there were some things that were not mentioned in his tutorial.'''

After you've created a tileset you may have some problems with repeating tiles like this:

This is how you want to let it look like:

Otherwise i don't know why you are here. ;)

This tutorial will help you to create a randomization for tiles inside Newer Super Mario Bros Wii and Reggie.

Requirements
- Newer Sources

- Puzzle

- Ruby

- Notepad++

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

- Open your tileset in Puzzle, to have it ready and choose the tiles

Step 1 - Adding your tileset to the Script
- This will add your tileset in the randomization list. For this example, i'll use ''Pa1_nohara. (This tileset is already randomized but it wille be the example now)'' - Scroll until the end of the file in Notepad++ (before the directory), then paste the following ( If it doesn't already exist and DON'T forget the PaX_ prefix) - 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
- These steps will allow you to find what tiles will be randomized

- Go back to Puzzle (if it helps, toggle alpha by clicking on the related option in Tasks)

- Now you have to find the tiles' coordinates : to count the tiles you have to count the hexadecimal way which counts like the following:

- Remember that you have to write the Y-postition 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) :

Note that the parameter is not necessary. For example from X=2 and Y=0 to X=7 and Y=0 itwould look like this:

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 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
A small information before the examples: I've written 0x** (** = Tilenumber) to make sure everything works. You could just leave the tilenumber.

- For example 1 we'll randomize the grass top. The code would be: - For example 2, we'll randomize the inside ground (therefore 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.

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

- Now open the terminal window from the foldeer, and type the following :

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

Presteps and differences
- Head to the directory where your reggie folder is located and then go to

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 why I am making a tutorial for this part as well.

Step 1 - Adding your tileset to the Script
Because it is in XML this means that it will also have another listing method. For that reason I will provide another template for 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
- This is literally the same as with the ruby part. It's written in hexadecimal as well as you have to list the Y-position first and then the X-positon

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) :

Note that the parameter is not necessary. 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
- For example 1 we'll randomize the grass top. The code would be: - For example 2, we'll randomize the inside ground (therefore 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.

You don't need to anything else than just to save it.

I hope this tutorial was helpful for you.

Good luck with creating randomized tiles now! ;)