Autotiler

by Ter13
A customizable autotile generator
ID:1444226
 


A: Source file state preview.
B: Layer order panel.
C: Layer rules checkgrid.
D: Efficiency options.
E: Override output.

1: Import Button.
2: Update Button.
3: Export Button.

Setting up:

Before using AutoTiler, you need to set up a file that contains all 8 of the edge directions you wish to combine into a 15, 47, or 256-state autotile icon file.

Your dmi file should be formatted like this:



Once you have your file set up, save it in the Autotiler folder, then run autotiler.



1) Click the Import button.
2) Select the input file in the file selection dialog that pops up.
3) Click Open.

Now, you should see your preview states in the state preview boxes. If you don't see your states, you have named them incorrectly. Rename the states, and resave them and repeat the steps above.



Next, you can manipulate the Layering by dragging/dropping the layer order buttons at the left. Layers near the top are appear above layers near the bottom. By default, the order should be SOUTH, WEST, EAST, NORTH, SW, SE, NW, NE.

You can also manipulate and change the layer rules at this time. You can preview your changes at any time by clicking the Update button to the right of the Import button.

Layer rules determine what sides conflict with one another. For instance, by default, we don't include state NORTHEAST anywhere state NORTH is present, the same is true for NORTHWEST and NORTH, SOUTHEAST and SOUTH, SOUTHWEST and SOUTH, NORTHWEST and WEST, SOUTHWEST and WEST, SOUTHEAST and EAST, and NORTHEAST and EAST.

Remember:

1: NORTH
2: SOUTH
4: EAST
8: WEST
16: NORTHEAST
32: SOUTHWEST
64: NORTHWEST
128 SOUTHEAST

Lastly, there are two checkboxes below the layer rules that you can toggle.

If you uncheck "use diagonals", you will only use a 16 tile autotile.

If you uncheck "create overridden tiles" with the default Layer Rules, it will generate a 47-tile autotile. This simply checks to see if a tile has invalid parameters based on Layer Rules that you set, and doesn't generate any of the tiles that you do wind up marking invalid.

If you leave "create overridden tiles", it will generate all 256 icon states, regardless of whether they are valid or invalid. Some of them will be duplicates, because the layering rules will not apply to how the image is generated, so the states that wouldn't be generated due to layer rules use their override image (not showing the disallowed layers) with the disallowed state name.

If you don't select create overridden tiles, you will wind up with blank spaces in your autotiling algorithm, and the Autotile Overrides box will populate when you update the box. The data in this box is a list you can copy and paste into DM, which will allow you to ensure that the proper state is always shown accounting for the override tiles that are missing. Simply access the list with the index based on the true autotile value of the tile, and it will adjust automatically.

Exporting your image:

Now that you are done tweaking your settings, you can save the rules for later use (File->Save Rules/Load Rules).

Make sure your image looks like it is supposed to, and export it:



Note the box at the bottom-right contains the list with all of my overrides in it, and the blank spaces in the preview are all the icons that were not generated.

Go ahead and hit that export button and use the file dialog that pops up to export the file.



That's all there is to it! Special thanks to the Eternia Dev team for allowing me to share this program I wrote for them with you all, and to use one of their graphics as a placeholder for this tutorial.