# Map Maker

Contents
Startup
Layers
Map Properties
Grid Settings
Map Operations
Build Transition Layer
Build Map Layer
Map View
Tiles
Composite Tiles
Grow Tiles
Navigation
Export

Note:
The Map Maker is as yet not finished. A great deal is already done, but many things are yet to come. I will describe only functionality which is already in place. If you find GUI elements which are not described below, it is likely, that they will not function as of now!

Map Overview

The Screen is divided into a couple of sections:

1. Top Section
   In the top section the Map Management stuff is shown. Maps can be loaded and saved.

2. Left Side
   All "stuff" that can be set to a map, that is not graphics. Behaviour of the map, sizes, layers and grid setting, also movement control.

3. Right Side
   Here the current map is shown. Tiles can be placed and deleted. The slider can be used to set a zoom factor.

4. Bottom Tile section, here you can select the current TileSet to be used with the map (a map can have tiles from as many differen TileSets as you like).

## Name

What is "Name"? A Map is saved to a simple (xml) file, which includes all information about the Map. Some operations are only possible the map has been saved to a file.

## Layers

Map Layers

A Map consists of an arbitrary number of layers (at least one). Each layer can have any number of tiles placed on it. The layers of one map are displayed from layer depth 0 to layer depth (max). Tiles on a higher numbered layer will be displayed above tiles on lower layers.

Tiles in one layer may overlap one another. Tiles in one layer are also ordered, the lower numbered tiles in one layer are displayed below higher numbered tiles.

Tiles in a layer are saved with its set of coordinates not in some or other "grid" system.

The default settings for tiles is, that they are not allowed to overlap - you can change that by checking the checkbox "allow tile overlap". If checked, tiles in one layer can be placed above one another.

If the checkbox is unchecked and you place tiles on the map, you get an indication whether a tile would overlap:
The text "Tile" next to the current tile under the mouse (just below the map area) will be colored red.

Tile overlap

### Height/Width

This displayes the current width and height of the current layer. Calculated is the distance between the tile with the lowest coordinate plus the tile with the highest value of coordinate an tile width (height).
This does not correspond to the highest/lowest coordinates!

### Tile count

How many tiles are currenrly in the layer.

### Allow tile overlap

Whether overlapping of tiles in one layer is allowed.

### Single position

Whether tiles in the layer on exactly the same positions are allowed.

### Wraping

Apart from obivious reasons for a map to wrap (simulation in globe). Wraping may also be used to build a background layer, consisting only of few tiles, but spanning in all directions endlessly. Since wraping also occurs on maps consisting only of few or one tile. Wrapping in these cases might be looked as a "repeater".

Note
Do not edit a map, while wrapping is active, the results are a bit unpredictable!

#### No Wrap

No Wraping

#### Wrap horizontally

Horizontal Wraping

#### Wrap vertically

Vertical Wraping

#### Wrap both

All Wraping

Advanced Wrapping!
Wrapping of ISO-Maps.
Wrapping of ISO-Maps is a bit tricky, depending on the dimensions and the "coding" of the the maps.
First rule to wrap ISO-Maps!

- The number of columns and the number of rows must be even

Otherwise wrapping is not possible (in a clean way).
While pondering why this is not possible look at these two image:

ISO 3 rows, 3 columns

wrapped horizontaly

There are empty tiles in between and there is no "correct" way to fill the space!

This also means at the moment there is no wrapping support for diamond ISO-Maps!

Even ISO-Maps

Small even ISO-Map

The wrapping of this small map is not obvious either. If you just hit "WRAP" the following will be shown:

Small even ISO-Map - horizontal wrap

The wrapping is of by one half tile, since each row has an offset to its neighbours of one half tile. The maps maximum width is calculated by the lowest and the highest position - so the resulting gap of 1/2 tile is only logical.
But if we give the tool a little bit of help -> it can offset all wraps by 1/2 tile. The help to give is to check the checkbox "assume ISO", if you do that - the tool assumes that the Map consists of ISO tiles and can act accordingly - amongst other things, do a correct wrapping!

Small even ISO-Map - horizontal wrap

### New layer

You can add a new layer by pressing the "New" button, enter a name and press "Save". The new layer with the name you gave will be added as newest "top level" layer. To change the depth of a layer -> see below.

### Active

If a map has more than one layer, only one layer may be active. Active here means "is editable". To activate a layer double click on the corresponding row in the table of the layers.
The active layer is allways visible!

### Visibilty

In the layer table you have checkboxes for each layer for the visibility of the layer. You can toggle those checkboxes (not for the active layer), to change visibility of single layers.

### Layer Order / Delete

To change the order of layers, select a layer and press "Up" or "Down" button.
You can delete the selected (selected in the table, not the active layer) layer by pressing the "Delete" button.

### Layer Join

You can join consecutive layers. All tiles of selected layers will be added to a new layer, and the old layers will be deleted.

### Background Layer

A layer (must be layer with the depth of 0 (zero) ) can be a background layer. A background layer may be associated with a color. This color will than be displayed as the background color.

### Tile List

You can invoke a list of all tiles of the current active layer by pressing the button "Tilelist". Following window will appear:

Tilelist

You see a list of all tiles in the current active layer. The tiles are ordered in display order (first displayed tile is the tile in the top table position (unless table is sorted differently) ).
Displayed is the name and the position of the tile.
Double clicking on the table selects the corresponding tile and displays additional information on the right side of the window.
(on the map area the tile is also selected and displayed with a red rectangle)
You can use the buttons "Up" and "Down" to move the selected tile in the display list.
The "Delete" button can be used to delete the selected tile.

## Map Properties

The only currently implemented Map properties are:

### Save Layers as Binary

Per default a map and its layers are saved as XML-Data files. For large maps (> 10000 tiles) the XML-Files generated are EXTRA-LARGE, which especially for loading a map is extremely cumbersome. For that reason a switch is included to save layers as binary (java-serialization) files. This will speed up loading these files at least while using TT. Maybe in the future other save type (binary) might be supported. As of now, you still can save a map using the "User Export" function.

### Grid Settings

Grid settings

To use a grid check the checkbox under the map display which reads "Grid". If a grid is selected it will be displayed in front of the map.
If a grid is displayed you can also check the next checkbox "snap". If checked you can only place tiles on the map with its origin on the hot spots of the selected grid (see below for explaination of hotspots).

The Grid displayed is zoom factor and map-viewport stable. Meaning the grid is allways displayed:

1. in the correct scaling

2. the grid is allways staying in the correct position

Under the tab "Map Properties" the user can build grid settings he would like to use with his map. Each such setting can be saved and than reused by selecting the setting from the combobox.

Drawtypes
There are four different draw types, resulting in different "shapes" to be drawn:

- Dots

- Square (this is wrong it should be called rectangle)

- Hex

- ISO

How is a "grid" defined?
A grid is defined by finding a hot spot (using the data given for the X- an Y- axis) and drawing a shape on the found hotspot. The shape is defined by two settings:

1. the X- and Y- axis values

2. the drawtype selected

(Hotspots can be shown when the corrsponding checkbox is selected, hotspots will than be painted red on the map.)

The starting hotspot of any grid is allways point 0,0. The next hotspot is determined by the values given.

Rectangle
Easiest example is a "rectangle" grid. You enter (e.g.) the values 32 to X and Y axis. Thus the next hotspot will allways be 32 pixels away, resulting finaly in hotspots at:
0, 0; 32, 0; 64, 0; 96, 0; . . .
0,32; 32,32; 64,32; 96,32; . . .

. .

At each of these hotspot locations a rectangle with a width and height of 32 pixels will be drawn.

Grid Rectangle

ISO
Drawing an ISO shape is straight forward after that:

- enter the ISO settings as your X and Y axis values, for a 4:3 ISO you may enter 64 / 48 or 128 / 96...

- select ISO as draw type

And voila you display an ISO grid.

Grid ISO

Hex
Hex values are a little bit more complicated to enter.

Grid Hex

- first is HotSpot at 0,0

- the next hotspot is 96 pixels away (X-axis) (the sum of all X everies) -> on each X-axis the hotspots are 96 pixels apart

The alternating checkbox is checked with the X-axis, this means the second X-axis starts of in reverse order, subtracts the offset. So the first HotSpot in the second line will be at 48,32 followed by hotspots every 96 pixels.

Using this rather complicated method to define a hex setting still allows us to draw hex grids in many different flavours.

The trick with these grid setting is to have no shapes overlap each other. For the hex settings this as a rule of thumb means:

- the second X - "Every" setting must be double of the first

- the X-Offset must be half of the first X (and the second 0)

- Using the Y setting than stretches the Hex

- Using the base X setting defines the size of the Hex

Usage of a grid
All tiles will come in rectangle dimensions. Other than vector graphics no image format saves graphics data in any other way. Therefor even if you want to build a hex or ISO map, the tiles you use will allways come in rectangles. The usage of a hotspot reflects this. If the tiles are correctly build, you can use rectangle tiles to build ISO or hex maps using the hotspots to place the tiles on the map!

## Operations

### Save Map as Image

Which does exactly that -> it saves the current displayed map as an image. It saves exactly the current map, meaning all grid, hotspots, zoom factors, layers. . . .

### Build Transition Layer

See also the documention in ImageCollection -> Filtering and TileManager -> Tile Transitions.

The transition is allways done for the current selected layer!

In order for transitions to make sense, the map should meet certain criteria:
(These are not enforced - but the results might be less than pleasing if not met!)

- The map should be build by rectangular tiles (even better square tiles)

- tiles should not overlap

- tiles should be placed exactly NEXT to each other

- tiles should be placed in the "correct" natural order

- tiles should have the same size

- not a must, but will speed things up, the map should be "complete" (not spaces in between tiles)

If you build a map with tiles that support tile transition, this button "applies" the tile transition to the current map. What it does:

- Look for tiles, that have tile transitions enabled

- sort these tiles by priority

- create a new layer, to this layer all transition tiles will be added in order of the priority

- for each tile the neighbouring tiles are checked, and in correspondence to the neighbouring tiles, the "correct" transition tile is placed in the new layer.

On large maps, the last bullet point might lead to problems. If the map is not what I call regular (tiles ordered sequentially, all tiles have the same size), the searching for neighboring tiles can take very long! (imagin a map with 100000 tiles, for each tile the neighboring tiles must be found, if the tiles are not ordered this means MANY comparissons!)

For maps created by hand, the map usually is not regular from the start. If you want to build a map which meets the above criteria do the following:

- on the tap "Layers" make sure the checkbox "allow tile overlap" is not selected

- select a square grid, which corresponds to your square (rectangular) tile size

- enable "Grid"

- enable "snap"

- start placing tiles on the layer as you wish

- after you finish editing under the tab "Operations" press the button "make regular", this will order the tiles!

The feature can (if configured correctly) be very nicely used for maps created automatically!

Example:

Handrawn map befor transition

After building a transition layer:

Handrawn map after transition

Note
This feature does not replace tiles and does not change tiles!
All it does is: add a new layer in front of the current layer, with tiles already available!

Advanced Transitions A
Building transitions described above is more or less straight forward. It gets tricky if you add wrapping! Since for two layers to wrap seamlessly the layers must have the same settings and the same size. If you do Transitioning on a map, than the resulting map is usually 2 tiles larger than the original map, since the border is "transitioned" to nothing.

If you want to build transitions for a map that is "wrapable" following rules must be followed:

1. the map must be "complete"

2. the map must be "ordered"

3. the map must be "regular"

4. the checkbox "consider wrapping" must be checked

5. the checkboxes for the wrapping you wish must be checked

If these rules are met, you can build "wrapped" transitions.

#### Complete

Complete means all rows and columns of the map must have the same amount of tiles as all other rows and columns (respectivly, rows must not be column size).

#### Ordered

The tiles in the map must be ordered correctly, meaning:
for all tiles it must be true that:
tile(i).yPos * tilesPerRow + tiles(i).xpos < tile(i+1).yPos * tilesPerRow + tiles(i+1).xpos

#### Regular

All tiles have the same size, and no tiles overlap.

#### Example

Handrawn map

Handrawn without checkbox "consider wrapping"

Handrawn with checkbox "consider wrapping"

Note
The button "make regular" ensures the above three points - if possible! But in order to do this, the tiles might be shifted from one position to another!

Note 2
In the layer tab, you can see the current status in regard to regularity and complete/ordered.

Note 3
It is not allways possible to create a layer only with transition tiles to the same size that the original layer was. In that case the layer is filled on the lowest x,y or the highest x,y position with a copy of a tile from the original layer. These "copy" tiles are allways the first tiles in the transition layer, so that they can be "overwritten" by the transition tiles later. This also means, that the transition layer might be:

- not ordered

- not complete

- but regular

Even more advanced Transitions B
In the latest release of TT-TileTools ISO maps can also be built, wrapped and transitioned. This is only possible if the points under "Advanced Transitions A" are met. The points under "ISO-Wrap" must also be met!

This is a special even more advanced section, since programming the wrapped ISO - transitions I nearly wrapped my brain too!

And because it realy works - here some images:

ISO Handrawn map

ISO Handrawn map - wrapped

ISO Handrawn map - wrapped and transitioned

### x,y -> 0

This button translocates the map so that the lowest x postion and the lowest y position are translocated to 0,0 (all other tiles are translocated with the resulting offsets).

### Build layer from algorythm (or image)

This feature is as of now not complete - but does already produce nice results!

Here you can create layers from different algorythms. As of now you can "only" build from images. Building and producing of maps directly from the algorythms is not supported yet - but is a feature in the schedule for future.

After pressing the above described button a new window opens, which looks like:

Map building start

The window is divided into four sections:

1. The main display is used to display an image (in the beginning blank)

2. On the bottom (left) is a tab with 4 different pages, each will be described below

3. upper right / and far right: a TileCollection display

4. lower right / and middle right (just left of the tile display) a table with a color to tile mapping

Overview
The objective of this window is to build a map automatically from some other source. As of now - build a map from an image! (and also build nice images!)

The idea to build a map from an image is quite simple.

- load an image

- build a layer

- for each pixel of the image

  - select a fitting tile

  - build the position information of the tile on the map from the pixel position in the image

  - add the new tile to the map

In order for that to work:

- all tiles should have the same size

- there must be a mapping of some sort from a color to a tile

The result is:

- a regular layer (see above)

Lets start
In order to use any created map, the first implemented feature here is:
"Create a map from an image", you can find that on the first tab. To load an image simply press the ". . ." - Button and select any image you like.

Like this nice little Pacman-Ghost!

Build Map from Ghost

On the bottom you see some information about the image, like size, and the how many colors the image consists of (important information, once you want to start mapping colors to tiles).

On the right side you see a list of all colors in the current picture.

Build Map from Ghost - tiles

On the top right you can select a TileSet (you can use any number of tilesets). After you select a TileSet, the tiles are displayed in a vertical stripe to the far right. You can use drag and drop to place a tile next to a color in the table. The result might look something like:

Build Map from Ghost - tiles

On the bottom right you can save the current "Color <-> Tile" mapping for later reuse (naturally you can also load a mapping from here).

On the image tab there is a checkbox called "use nearest". If the checbox is selected ALL colors from the image will be mapped. If the color itself does not have a match - the nearest found color will be used and its corresponding tile (otherwise no tile will be generated).

If you press "Build Rect Layer" something like the following layer will be build (zoomed out):

Build Map from Ghost - tiles

The image tab also holds different algorythms to reduce the colors of an image (not all of the are very sensible reduction implementations!). All reductions will be made from the original image. To reset to the original colors use the "Reset" button.

### ISO Maps

A new feature was added - build ISO-Maps from an image. There is no single right way to transfer "rectangle" image data to an ISO-Map. For that reason 3 different transformations to build an ISO-Map from an image are implemented.

The follwing image represents the pixel data from the source image:

Image data

Version A
In version A the pixels from the above data are transfered to an ISO map using the following scheme (the image is stretched horizontally):

ISO Map-Version A

Version B
In version B the pixels from the above data are transfered to an ISO map using the following scheme (image is nearly same size as orginal, but "interlaced"):

ISO Map-Version B

Version C
In version C the pixels from the above data are transfered to an ISO map using the following scheme (which actually is the same as the source rotated with an ISO angle of 45degrees[or whatever]):

ISO Map-Version C

Three Tabs
The next three tabs are different implementations of world generating algorythms found on the net. Each of these tabs allow for different settings, they are fairly selfexplanatory (and have tooltips). Each of the tabs has an origin button which display the licence information and gives a link to the original.

As of now only the button "Generate Image" is implemented for each of these tabs. No direct map generation is supported yet. The Image generated however can be used as described above to build maps!

Examples:

Hero Extant

MapGen

WorldGen

### Grow tiles

Upon hitting the button "Grow tiles" following window will be opened:
(well I allready added some Tile Collections)

Growing tiles

Top of the window
Here you can save/load your grow-configurations - standard.
Left side you can select an view a tile collection. The tile collection you select here contain the "Grow tiles". The "Source tiles" are taken from the current active layer of the map.
You can select an arbitrary number of tile sets and add them to the current configuration.
Available Sources:
Here the combinations of type|subtype which are available on the selected layer are displayed.
Once you are satisfied with your configuration press the button "Grow with selected settings" the settings will be applied and a new layer with the "growth" will be added to the map.

Growing Done!

## Map Navigation

Map navigation

Here you can alter the current viewport to the map. Using the arrow buttons you change the current offset of the map displayed in the Map area.
Movement is done by pressing and holding the button. Every 10th of the second the value in the textfield under the buttons is added or subtracted from the current offset.
You can automate the movement by checking the checkbox in the middle. Meaning if you check it, click on a button, the offset of the map keeps changing.

The "0,0" button resets the offset. The map will be displayed with the coordinates 0,0 on the top left of the screen.

### Movement per layer vs Movement of all layers

The default movement is done with all layers of the map at the same time. If you unselect the checkbox "All layers", only the current active layer changes its offsets.

In the future this might be further enhanced to show some sort of parallax scrolling even in map editing mode.

### Navi

Navi is short for navigation panel. If you press the button a window will open, which gives you an overview of the complete current map (only really usefull, if the map has some considerable size). The little "+" and "-" buttons can be used to adjust the size of the overview panel.

The panel looks like:

Overview panel!

The window can be placed anywhere in TT-TileTools and stays allways on top. Using the mouse you can place the rectangle which corresponds to the viewport of the map.

## Map View

Map area

This is the place, where the actual map editing takes place. You use the mouse to place or delete tiles. The map itself provides you with different usefull information:

- the button "Set Tile" indicates the map is in "Tile Set" mode, toggling the button it will display "Delete Tile" and you will be in "Tile Delete"-Mode

- displayed on the bottom are the current coordinates of the mouse cursor

- next to it the current offset to point 0/0 is displayed

- first in line is the current selected scale factor in percent

- next to it is the tile currently under the mouse position (in the active layer)

- the text "Grid" is colored red:

  - the map is in tile set mode

  - you habe a tile selected

  - the layer settings do not allow placing of tiles on top of each other in the current layer

  - a tile would be touched in the layer if the tile selected would be placed in that location

### Scaling

Using the slider on the left side of the map you can use to adjust the scaling factor of the map. Default is scaling 100%, you can scale up to 600% and down to 16%.

### Set / Delete Tiles

The button "Set Tile" on the bottom of the map indicates the map is in "Tile Set" mode, toggling the button it will display "Delete Tile" and you will be in "Tile Delete"-Mode. The tile under the mouse (in the current active layer) is displayed on the bottom left of the map. Pressing the mouse button deletes the current tile under the mouse.

If in the active layer there are tiles overlapping and you wish to delete a tile "under" the current tile and can not select it using the mouse, you can select the tab "Layers", open the tile list window by pressing the "Tilelist" button and select the tile you would like to delete in the tilelist. After selecting the tile, press "Delete" on that window.

Note
There are some keyboard shortcuts which make life easier:

- CTRL & left mouse deletes the tile in the current layer under the cursor (regardleess of the mode)

- ALT & left mouse grabs the tile in the current layer under the cursor (regardleess of the mode) [grabing here means, loads the tileset and selects the tile, it can be placed with the mouse, give it a bit of time for loading!]

## Tiles

Tiles

On the bottom of the window you can select the TileSet you would like to currently use with the map (you can allways switch to another TileSet, you can use as many TilSets as you like with any map, but only one TileSet is displayed at any given time).

Using the ". . ." you select the TileSet. The class of the TileSet must also be selected. On the right all Tiles with that tile set are displayed.

### Mouse Button -> Tiles

You can assign these tiles to your mouse buttons:

- left

- right

- middle

- SHIFT left

- SHIFT right

- SHIFT middle

The current selected mouse button settings are displayed in the 6 little image areas. To delete the current settings for the left button press the "!" button.

Provided the map is set to "Tile Set" mode, once you enter the map area with the mouse, the selected tile (left button) is displayed under the mouse cursor (pressing SHIFT while moving displayed the corresping SHIFT left tile) (the settings for the other buttons can not be displayed in the map upfront)

## Composite Tiles

Composite Tile

There is a second tab next to the Tiles tab called: Composite Tiles. With this tab it is possible to build/load and use CompositeTiles. A CompositeTile is a tile that consists of many tiles, but can be places as "one" tile.
The phrase "consists of many tiles" may already lead to guesses how CompositeTiles are implemented, and why you can only build them from the map display - and not from the TileManager.

Build a Composite Tile
In short any Layer of a Map can be saved as a CompositeTile. For regular maps this is most of the time not really clever, since you would seldom want to reuse a "normal" layer as a whole.

But keep in mind the whole editing and building process of a CompositeTile is realy the same as designing a map - only in a much smaller scale.

Thus to build a CompositeTile make a new map. Build the CompositeTile you want (it can consits of ANY number of tiles!) in one layer, switch to the above mentioned tab an save it. To save a layer as a CompositeTile:

- there should be tiles IN the layer

- the layer must be the active one

- you must give TileCollection name (can be an existing TileCollection)

- you must give TileCollection class

- you must give a name for the composite Tile

- press the button: Save current layer as composite tile"

To load a CompositeTile Collection do the usual, select a filename and a class - the CompositeTiles will be displayed.

Selecting a CompositeTile enables the tile and can be placed with the mouse button (left).

A CompositeTile is not added as a CompositeTile - it will be added as the tiles it consists of. After placing a CompositeTile on a map, it will on the map no longer be discernable whether the single tiles were part of a composite tile or not.

Note
Even though CompositeTiles and normal tiles can be in the same collection, each tile-type will only be displayed in the corresponding tab!

Note 2
To edit attributes of the CompositeTiles, use the TileManager, there you can handle these tiles as "normal" tiles. You can even GROW them!

## User export

Using the "User Export" button, you can export your Map - or a Layer 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/Maps".
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:

User Export