:title Tile Manager

:label tileManager

** Contents **~~
<<tileManager#startup|Startup>>~~
<<tileManager#tileCollection|Tile Collection>>~~
<<tileManager#graphicsData|Graphics Data>>~~
<<tileManager#tileData|Tile Data>>~~
<<tileManager#tileAttributes|Tile Attributes>>~~
<<tileManager#tileActions|Tile Actions>>~~
<<tileManager#tileTransitions|Tile Transitions>>~~
<<tileManager#tileVariants|Tile Variants>>~~
<<tileManager#tileExport|Export>>~~

 
:anchor startup
The Tile manager is not yet at its development height. There will be enhancements in the future. But as it is, one can already use the tiles produced to build nice loking tilemaps. ~~
This is how the TileManager window looks like:

:image TileManager.png|Tile Manager|fileopen

For information regarding the wording used (Tile, TileSet, TileAction, TileAttributes) see the FAQ -> Wording.


The Screen is divided into 4 sections:~~
1) Top ~~
In the top section the tile management stuff is shown. TileSets can be loaded saved and divided into classes.

2) Left Side~~
On the left side you can see the current loaded TileSet displayed with the corresponding graphics. You can select the images using the mouse button.

2) Middle Top~~
Here you can set a graphic for your tile. Input for the graphic is an ImageCollection.

2) Middle Bottom~~
Here you can enter all information you might associate with tiles. Like a name, ID, height and width restrictions, descriptions, a set of attributes etc.
~~Not done yet: Tile actions.

:h2 File
What is "File"?
A TileSet is saved to a simple (xml) file, which includes all information about the TileSet.
The ". . ."-Button opens a file dialog do open a TileSet. To save to a new TileSet you MUST enter a filename.
Some operations to are only possible if a filename (and a class) is given.

:h2 Class (es)
Each TileSet can (must) be divided (at least one) into classes. 
All classes and all information in those classes are saved into one (xml) file (see above). 
To allow distinguishing tiles in one TileSet, you can also give each tile a specific class. All tiles that have the same class in one TileSet are displayed together.~~
E.g.~~
Filename:~~
____Nature (the TileSet will be saved to a file in directory "xml/Tile" named "Nature.xml")~~
Classes:~~
____Rocks~~
____Trees~~
____Flowers~~
etc.~~
Some operations to Tiles / TileSets are only possible if a class (and a filename) is given.

:h2 Tile Collection
:anchor tileCollection
:image TileCollection.png|Tile Collection|fileopen
The current loaded Tile Collection is displayed on the left side of the window.
You can select a tile using the mouse (clicking). 
To add / remove a tile click the appropriate buttons. Add overwrites any tile in the collection with the same name.

The "new tile" button does as it is labeled.

**Attention**~~
The name of a tile must be unique within one TileCollection. Even tiles in different classes in the same TileCollection //must// have different names! Otherwise the "other" tile will be overwritten.~~
BTW. this allows "easy" transfer of tiles from one class to another class within one TileCollection -> just change the classname and save the TileCollection!


:h2 Graphics Data
:anchor graphicsData
:image TileGraficsData.png|Tile graphics data|fileopen

When you build a new tile or TileSet you usually start with the graphical representation of the tile. ~~
In graphics data area, you can load (previously defined) ImageCollections. You must give the corresponding filename of the ImageCollection followed by the class of ImageSequences you would like to see in that collection.~~
All ImageSequences are displayed in a horizontal stripe (scrollable). By clicking you can "activate" the clicked ImageSequence. Some data will be displayed.~~
To set a selected ImageSequence to the current tile press the "set image" button.

**Info**:~~
The "link" between a tile and an ImageSequence are the two attributes:~~
- filename
- name

of the ImageSequence (and the ImageCollection). If at some stage you would like to change the graphics of a complete TileSet to a new set of ImageSequences you can do that by building a new ImageCollection, with ImageSequences which have the //same// names as the original ImageSequences and save the collection with another name.~~
You can than change only the ImageCollection name of the tile and voila new graphics are set for the tile.~~
(Not Done: exchange ImageCollection name for an entire TileSet)


:h2 Tile Data
:anchor tileData
:image TileData.png|Tile data|fileopen
Here you can enter basic data of the tiles you wish to use. Actually once you set an image to a new tile, there is no other //compulsory// data.
It is usefull to enter a meaningfull name. You may enter an ID and a description.
If you plan to build a map with tiles of all the same sizes, you might want to enter height and width of the tile and check the "Force tile size" button. If you do so, the tile will be scaled to that size - no matter what size it actually has.
Default are the values of the graphics image and the checkbox not checked.

:h3 Tile Attributes
:anchor tileAttributes
:image TileAttributes.png|Tile attributes|fileopen
You can supply a tile with attributes, as many attributes as you like. Per default a tile does not have any attributes. To build a new attribute, click the "New" button. 
Enter the Attribute name, select the type of Attribute (Integer, Boolean or String) and enter a value (depending on the type you selected).

By pressing the "Add" button, the new attribute is added to the tile (but not saved as yet). To save the changes, press the "add tile" button, which adds the tile to the current TileSet (or replaces the old version of the Tile).
Still the changes are not saved! You have to press "Save TileSet" in order to save all changed!

As a shortcut, you may press "Save TileSet" at any stage, all changes will be taken into account and saved.

**Attribute Bundles**~~
Once you supply a tile with a set of attributes you may want to reuse with another tile, you can press "Save as Attribute bundle". The current attributes are than saved under a given name (textfield in front of the button). 
You can give (add) a new tile the exact same attributes by selecting the given name of the bundle in the combobox labeled "Attribute bundle".~~
You might save same time adding the same attributes over and over again this way.

**Edit Attributes**~~
To edit an attribute of a tile, double click the corresponding row in the attribute table. The attributes will be "transfered" to edit section above. Press the "replace" button to replace the "old" attribute or press the "add" button to add the edited attribute as new.

To delete an attribute select the row in the table and press "Delete selection".


:h3 Attributes used for Map-Generating
With the map maker you can access an operation called "Grow Tiles". The main configuration behind the ability to grow tiles on a given map is done by giving tiles certain attributes. All attributes used by the Map Maker start with "MAP_".
As of now following attributes are recognized:
- "MAP_Growable"
- "MAP_Type"
- "MAP_SubType"
- "MAP_NeedsType"
- "MAP_NeedsSubType"
- "MAP_GrowProbability"
- "MAP_GrowNumber"
- "MAP_Overborder"
- "MAP_MaxGrowPerMap"
- "MAP_ParentMinSize"
- "MAP_ParentZeroOffset"
- "MAP_ParentNeighbourType"
- "MAP_ParentNeighbourSubType"

Convention:~~
If an attribute is not available, the value of the attribute are assumes as:~~
- if a boolean -> false
- if in integer -> 0
- if a String -> null

Short explaination of the attributes:

Definition:~~
//Source tile// is the tile something can be grown on.~~
//Grow tile// is the tile that can be grown on another tile.~~

**MAP_Growable**~~
Boolean. Grow Tile. If true this tile can be grown!
~~**MAP_Type**~~
String. All tiles. Declaring a "Type" of a tile. Should be something meaningfull tile related, for a map tile it might be "Terrain".
~~**MAP_SubType**~~
String. All tiles. Declaring a "SubType" of a tile. Should be something meaningfull tile related, for a map tile it might be "Water" or "Sand" or "Rock".
~~**MAP_NeedsType**~~
String. Grow Tile. Needed for a tile that may grow on another tile. The tile that this one can be grown on must be of the Type given here.
~~**MAP_NeedsSubType**~~
String. Grow Tile. Needed for a tile that may grow on another tile. The tile that this one can be grown on must be of the SubType given here.
~~**MAP_GrowProbability**~~
Integer. Source/Grow Tile. Two meanings:~~
Source Tile: On what percentage of tiles will something be grown.~~
Grow Tile: The accumulated value of all possible grow tiles (in relation to the source tile) in relation to the value of the single tile determines which tile will actually be grown.
~~**MAP_GrowNumber**~~
Integer: Grow Tile. How many of the current grow tiles are grown on the source tile. (If none is given, the default is 1)
~~**MAP_Overborder**~~
Boolean. Grow Tile. Whether the to be grown tile(s) can "reach" over the Source tile. (Only for source tiles with MAP_GrowNumber >1)
~~**MAP_MaxGrowPerMap**~~
Integer. Grow tile. How many of these tiles AT MOST can be put on the layer. This value is layer dependened, so each grow cycle "resets" the number.
~~**MAP_ParentMinSize**~~
String. Grow tile. How many tiles of the same kind and in what formation must be available in order to grow this tile. 
Value is given as "3x3" meaning a three time three area of the same tile must be available. Growing will be done on the top left tile of that square. (Other values like 1x2, 3x6, are also valid...)
~~**MAP_ParentZeroOffset**~~
String. Grow tile. The offset in pixel the grow tile will be added to the layer. Point zero are the coordinates of the parent tile. Value is given as two numbers, comma seperated (e.g. 10,15) (only for tiles with a MAP_GrowNumber = 1)
~~**MAP_ParentNeighbourType**~~
String. Grow tile. What type of tile must be in the neighbouhood of the parent tile in order for the growth to be initiated.
~~**MAP_ParentNeighbourSubType**~~
String. Grow tile. What subtype of tile must be in the neighbouhood of the parent tile in order for the growth to be initiated.
Think about growing a lighthouse on the beach. Growing is only allowed if source tile is sand and neighboring tile is water.

:image TileGrow1.png|Source tile example|fileopen
:image TileGrow2.png|Grow tile example|fileopen

**NOTE:Tile Attributes**~~
You can use tile attributes for composite tiles (see Map Maker), this also means
you can "grow" composite tiles!


:h3 Tile Actions
:anchor tileActions
:image TileActions.png|Tile actions|fileopen
These are not implemented yet, and will be described WHEN implemented.

:h2 Terrain transition Tiles
:anchor tileTransitions
See also the corresponging section in the ImageCollection documentation called "Filtering"! In the following it will be assumed that for one "ground" image, all corresponding transition images allready exist!~~
Lets therefor assume the following scenario. You already have an ImageCollection with required graphics like shown in the following image:

:image TileTransition_1.png|Example tile transition - base|fileopen

Once you hit the button "Add all as tiles" (this may take a few seconds) - all images in the current ImageCollection (&class) will be added to the current TileCollection (if there are to many - you can easily delete them from the tile collection later on).~~
The current setting in the tile description will be saved to all created tiles [like force tile size...].~~
If you do that the display should look like:
:image TileTransition_2.png|Example tile transition - tiles available|fileopen

Once you have all tiles in you collection, you can start assigning transitions.
In general it only makes sense to assign transitions only to "full" tiles, in the above display that means only to the first tile in the collcetion.~~
Switch to the tab "Terrain Transitions" - and select the sub-Tab "Artifact" (that is the only transition type currently fully supported).~~

To enable terrain transition for that tile, check the checkbox named "Enable Terrain transition" (you may also want to set a priority).
Although only one transitions type is available, also do check the "Use" checkbox!~~

Now you have to manually assign the transitions. You can do that by "Drag and Drop". 
From the TileCollection on the left click on a tile and **hold** the mousebutton. Drag the selected tile to its corresponding "transition icon" - and drop it on the square next to the icon.~~
(Make sure that you hold the mouse button, selecting another tile from the list results in losing the changed already done to the previously selected tile!)
:image TileTransition_3.png|Example tile transition - assigning Transitions|fileopen

Naturally you have to save the collection in order for the changed to be persistent - and later use transitions tile while editing your map!

**Note**~~
If you created the transition tiles with the graphics built from a filter (see Image Collector), and the filter was created from a MetaFilter (or your filter has the imageInstances in the imageSequence in the same order as created by a MetaFilter). Building a tileset with transitions tiles is very easy, just do the following:
- **in Image collector:**
- have a terrain image
- have a correct filter (built from a meta filter, or same ordering)
- on the tab filtering select under source the correct filter
- hit "apply"
- enter a new class (and perhaps a new file)
- press "add as multiple images"
- press "save"
- **in Tile Manager:**
- load the above built graphics file
- if you want, enter some tile information 
- press "Add all as tiles" (takes some seconds), you should now have a new tile collection with all tiles for one complete transition sequence
- select the "full" tile (first in the list)
- switch to the tab "Terrain transitions"
- enable transition, enter a pritority and check "Use"
- click the button "Add default tiles" -> all correct transition tiles should now be set to the full tile
- click "add tile", to accept the changes to the current tile collection
- click "Save TileSet" (**Important!** -> otherwise no changes at all are saved!)

**Note 2**~~
The above said also applies for ISO-Artifact transitions. They behave exactly the same in respect to tile handling - only difference is the looks:
 
:image ISOTileTransition.png|Example ISO-tile transition|fileopen


:h2 Tile Variants
What is a Variant?~~
A variant is a different tile (from the current) that "looks a bit different" but should otherwise have exactly the same "behavior" as the original tile.
(This includes, but is not limited to, all transition information and all attributes)

:image TileVariations.png|Example tile transition - tiles available|fileopen

Under the tab "Variants", you can chose:
- whether a tile should have variants
- what the variants will be
- what percentage of all set tiles will be a variant

A tile can have an arbitrary number of variants. To add a variant to a tile, drag the (to be variant) tile to the variant tab.
You should also enter a percentage value on that tab. 

Randomly chosen the given percantage of all tiles you place on a map will be one of the variants. The variant itself is also randomly chosen from all available ones.

**Note:**~~
You can easily create variants in the following manor:
- click the original tile
- under graphics data load the graphic you want the variant tile to have
- click "set image" to assign the "new" graphic to the tile
- on the tab "Overall tile info" change the name of the tile to a new "variant" name
- click "add tile"

The new tile with the given name will be added to the current tile collection.
To add the new variant to the original tile:~~
- click again on the orginal tile
- select the tab "Variants"
- drag the above build vartiant to the tab
- click "add tile" again, to accept the changes to the current tile collection
- click "Save TileSet" (**Important!** -> otherwise no changes at all are saved!)


:anchor tileVariants


:h2 User export
:anchor tileExport
Using the "User Export" button, you can export your TileSet - or a Tile or whatever - to a format you like or would like to use. 
Per default all data is saved in a XML-Format in a subdirectory called "xml/Tile".~~
With the user export you can code your OWN specific export routines in java.
An example is given to export the data to another even simpler xml-format. The library used to implement the export is called Java-Beanshell. The syntax is very much like (old) Java (no template support e.g.). But nonetheless you can very easily export to any format you like. Example:~~

:image TileUserExport.png|User Export|fileopen

