Note: This information is very old and may be invalid.

The .SET File

Overview

Based on previous work by sindii with the beta toolset

The .SET file is a file that controls the details of a tileset (for example ttr01.set for the rural tileset). The difficult part of creating a tileset is creating rules for how the set works. These rules are stored in the .SET file.

[GENERAL] Section

This section of the .SET file contains general information about the tileset.
[GENERAL]
Name=ttr02
Type=SET
Version=V1.0
Interior=0
HasHeightTransition=1
EnvMap=ttr02__ref01
Transition=5
DisplayName=4995
Border=Grass
Default=Grass
Floor=Grass
The name line is important. It must match the prefix of your palette file (.ITP).
The DisplayName is a StrRef. StrRefs are integers that refer to a text string in the dialog.tlk file. Right now I don't know of any method of adding a new text string and StrRef combination. However, the new version of Zoligato's BIF extractor allows you to search for strings in the dialog.tlk file. If you want to distinguish your custom tileset from the original you can just search for a replacement name in the dialog.tlk.

The last three lines (Border, Default, and Floor) are also very important. Each line refers to a terrain type. The default terrain will be the corners and parts not given a terrain. The border terrain will outline the new area on initial creation i.e. the walls in the crypt tileset. The default floor terrain will tile the floor of a new area.

[TERRAIN TYPES] Section

Each tileset will begin with basic terrain types. These are the base terrain types upon which all other features will be placed. In the rural tile set there are three terrain types (grass, water, and trees) in the crypt tileset there are also three (walls, floors, and pit).

The [TERRAIN TYPES] section begins with the count of terrain types:

[TERRAIN TYPES]
Count=3

Then one entry for each terrain type:

[TERRAIN0]
Name=Grass
StrRef=63635

The names listed here will be referenced several times in the rest of the .SET file.

[CROSSER TYPES] Section

Crossers are parts that cut through the middle of a tile. For example the stream cuts through the middle parts of the tile and not on its edges. Roads, Paths, Streams, and walls (in the rural tileset) are all crosser types.

The [CROSSER TYPES] section begins with the count of terrain types:

[CROSSER TYPES]
Count=4

A crosser entry looks like this:

[CROSSER0]
Name=Stream
StrRef=63302

[PRIMARY RULES] Section

This seems the most complex part of the .SET file. These rules decide which tiles can go where based on the "edge type" (explained later). They also appear to determine when adjacent tiles need to be modified (more on this below).

Again this section begins with the count:

[PRIMARY RULES]
Count=28

A rules entry looks like this:

[PRIMARY RULE0]
Placed=Grass
PlacedHeight=0
Adjacent=Grass
AdjacentHeight=0
Changed=Grass
ChangedHeight=0

[TILES] Section

The .set file contains an entry for each tile in the tileset. A tile is a divided into 9 sub-sections (a 3x3 grid). When defining a tile you need to give a terrain type to each of the edge sub-sections. Any sub-section not given a type will be set to the tileset default terrain type. It appears that only the corner edge types need to be specified (i.e. topleft, topright, bottomleft, bottomright need to be given). The terrain type of each of the edges determines what tiles can be placed next to each other based on the rules section.

For example if a tile had the top part consisting of this:

Topleft=Forest
Topright= Grass

It could only link to a tile that also had those settings on its adjacent sides. If the adjacent tile is empty (i.e. doesn't contain a feature) the toolset will adjust the adjacent tile as necessary.

The 4 corner sub-sections (i.e. topleft, topright, bottomleft and bottomright not top, bottom, left, right) of a tile can be given a height of either 0 or 1. With 1 being one level above flat ground. The top, bottom, left, right sub tiles will act as transition elements. For example if topleft has a height=1 and topright has a height=0 then the top sub-element is a cliff. However if topleft and topright had a height=1 then the top sub-element will be a flat section.

If a tile has its edge heights definitions like this:

TopLeft=Grass
TopLeftHeight=1
TopRight=Grass
TopRightHeight=1

Then the tiles adjacent to this one must have its heights set to 1 (on its connecting edge). Again if the adjacent tile is empty (i.e. doesn't contain a feature) the toolset will adjust the adjacent tile as necessary.

Any tile listed in the tile section that is not referenced by a group is considered a terrain tile. With terrain tiles the toolset will randomly pick one tile it can find that matches the sub-sections terrain types. For example when you first start an area each tile is set like this:

TopLeft=Grass
TopLeftHeight=0
TopRight=Grass
TopRightHeight=0
BottomLeft=Grass
BottomLeftHeight=0
BottomRight=Grass
BottomRightHeight=0

The unspecified sub-sections default to grass. There are several tiles in the tileset that match these sub-sections that don't appear in groups. The toolset will randomly pick one.

When placing crosser elements (streams, walls, etc.) you are actually setting the non-corner edge types (i.e. top, bottom, left, right). You will also notice that if you are placing a crosser on the bottom edge of one tile you are also placing a crosser on the top edge of the adjacent tile. You are actually setting the terrain type of the top sub-section of one tile and the bottom section of another. For example if you place a road across the tile then its sub-section terrain types look like this:

TopLeft=Grass
TopLeftHeight=0
TopRight=Grass
TopRightHeight=0
BottomLeft=Grass
BottomLeftHeight=0
BottomRight=Grass
BottomRightHeight=0
Top=Road
Bottom=Road

Again there may be several tiles in the tileset that match these sub-sections that don't appear in groups. The toolset will randomly pick one.

Groups and Features

Features are individual tiles while groups are groups of several tiles. This distiction only exists in the palette files (see below). There is no distinction between features and groups in the .SET file. A feature is simply a 1x1 group. Each group is made up of one or more tiles from the tiles section.

A Group entry has the following format:

[GROUP25]
Name=ShipDocked01_2x2
StrRef=63702
Rows=2
Columns=2
Tile0=178
Tile1=180
Tile2=177
Tile3=179

The rows and columns line determine the group size. In this case the group is 2x2 and therefore has 4 tiles.

The next set of lines list the tiles that belong in that group. Each number represents a tile from the [tiles] section. In this case the first tile is 178 with tile 180 placed to one side. Tiles 177 and 179 are placed below the first two tiles. It appears that it fills the columns first then moves to the next row if there is one.

If you need to make a group that has an odd shape (an L shape for instance) then you will still make a rectangular group but you can make certain tiles empty by setting the Tile=-1. For example the following groups is actually an L shape (tile 2 is -1 and therefore unspecified):

[GROUP41]
Name=ShipDocked02_2x2
StrRef=63703
Rows=2
Columns=2
Tile0=230
Tile1=180
Tile2=-1
Tile3=179

Remember to create a group for any tile you want to be placeable as a feature. If you don't the tile will become a terrain tile an will randomly appear in your area.

.ITP files

The ITP files are palette files. These files determine which items appear in the pallet on the right side of the toolset. If you want to add a tile to a tileset you will need to add a entry to the ITP file as well as the .SET file. An entry in the .ITP file looks like this:
ELEMENT
    NULLFLAG
    STRING: NAME = "Anthill 2"
    RESREF: RESREF = "ttr01_p05_01"
END ELEMENT

Notice this entry references a model name (ttr01_p05_01). This same model name is referenced in the Tile section. Now notice that there is no reference to the model name in the groups section. The only connection between a group and an entry in the ITP is through the list of tiles. So if you have the same model in two or more groups how does the tileset know which one to place? The connect is like this:

ITP -> Tile -> Group

Therefore for each entry in the ITP file you can have only one tile in the .SET file that uses that model. Furthermore, you can only have one group that references that tile. A tile can appear in more then one group as long as that's not the tile/model you reference in your ITP.

Disclaimer

This information is based solely on my experience with the toolset. I may be completely wrong. I might be an insane lunatic tricking you into destroying your computer. Either way don't blame me!