Fullscreen
Loading...
 
Tile Set File        
Print

Tile Set File

File Extension: .tiles

A tile is a prefabricated object, usually art, that can be placed in a deck. Tiles are most commonly used to create an expansion board for a game, but creative developers will certainly find other uses for them. Tiles are listed in the deck editor's Components section and can be dragged and dropped onto the active deck page.

File Format

A tile set file describes a collection of one or more tiles. It is similar to a typical settings file in that it uses key, value pairs separated by equals signs, but the file is divided into blocks of settings (one block for each tile). Blocks (tile definitions) are separated from each other by one or more blank lines. Moreover, the first two lines of each tile definition do not specify a key name because they are always the same (and appear in the same order). These are the tile's name and image resource. After these two values are listed, the rest of the tile entry may define other settings in any order.

Tile Name

Key: none—first line of tile definition
Default: none, a value is required

The first line of a tile definition is the name of the tile as it will be presented to the user. If the tile name begins with "@" then the actual tile name is determined by looking up the given value (without the "@") using Language.string.

Sometimes a group of tiles is very similar and it is useful to number them as a sequence using a common name. An @-name that ends in /n (where n is a digit) will format the localized string with the value of n. For example, @key/1 would look up the value of "key" in the UI resources. If the value of this key is "Tile %d", then the final name of this tile would be "Tile 1" after replacing the %d with the formatting digit n. Other tiles in the series would use the names @key/2, @key/3, and so on.

Close
noteUnderscores in Key Names
The @-syntax used here is the same as that used to look up interface strings in script files. However, in script files the dash (-) is not a legal character in a variable name, so string keys that include a dash must use underscore (_) instead. Although not required in a settings file, underscores in an @-key will be converted to dashes to remain consistent with the syntax used in script files.

Note that the global interface Language (Language.getInterface()) is always used to look up tile names. If your plug-in creates its own child Language, you must either copy the tile name strings to the parent language or else use a separate .properties file for the tile names and add it to the global language separately.

Image Resource

Key: none—second line of tile definition
Default: none, a value is required

The second line of a tile definition is a path relative to the plug-in's resources folder that names the image file (or a resource creation script) to use for the tile. Instead of a resource creation script (which can be used anytime an image resource is used just by naming an "image" that uses the .js extension), you can instead use a tile script which implements the TileProvider interface. To specify a TileProvider script, the resource should start with script:. Unlike a resource creation script, the TileProvider interface provides access to the tile instance being drawn. This means that the same script can be re-used several times, but paint different variations of a tile based on the tile's name or client properties (see below).

Resolution

Key: ppi
Default: 150

The ppi key sets the resolution of the tile, in pixels per inch. The resolution determines the physical size of the tile. For example, if an image is 300 by 600 pixels, its physical size would be 2 inches by 4 inches (5.08 cm by 10.16 cm) at a ppi of 150.

Snap Class

Key: class
Default: tile

A tile's class affects how it interacts with other tiles in the deck editor when you drag the tile around the deck. The possible class values are:
tile
Tiles with this class will snap to each other but will not snap to any other objects (such as cards or other components). This class is commonly used for tiles used to snap together the background art of a game board.
inlay
Inlays snap to other inlays normally (that is, outside edges snap together). When snapped to an object in the tile class, they snap to the inside edge of the tile. (They are laid in the tile instead of alongside it.) Inlays can be used to create an inside border along one or more tiles.
overlay
Overlays do not snap to any other objects. (They are laid over whatever object they dropped on.) Overlays are commonly used for generic decorations.
spinnable
Spinnables behave as overlays, but they also include a draggable rotation handle so that they can be rotated to any angle. Spinnable tiles work best using small images as arbitrary rotation is computationally expensive on some platforms.


Artist or Creator Credits

Key: credit
Default: none

Adding a credit line can be used to credit the artist or copyright holder of the tile. The value may be any string, but it should be kept short (50 characters or less).

Game

Key: game
Default: all games

A game key names the code for the game that this tile should be used with. Setting a game allows the user to filter the component lists accordingly.

Tile Set

Key: set
Default: other

The set key controls which set of tiles this entry will be included in. This determines which tab the tile is listed under in the Components area of the deck editor. Breaking the tiles into different sets makes it easier for the user to find the desired tile if they are grouped consistently and logically. It also reduces the time it takes to create a new deck editor because tile sets are loaded lazily (when they are first needed). The valid tile sets are:
tiles
Background or map tiles. These are typically large and appear behind other elements on the board.
bits
The set of board "bits"; these are elements that affect the game but which are created using tiles instead of full game components. For example, spinnable arrows that direct movement on the game board would fall into this category.
decorations
Decorative elements that do not affect the game. These are typically small images that are added over other layers (that is, they use class overlay).
other
A miscellaneous category.


Client Properties

Items that appear in a deck can have client properties attached to them. Client properties map a string key to a string value. They can sometimes used by tool plug-ins to mark deck items—for example, to keep track of deck items that were automatically generated by the plug-in. They can also be used to configure the behaviour of tile scripts. To set a client property from a tile set file, add a property with a key consisting of client- followed by the key name, and assign it the desired value.

API Notes

Extension plug-ins can add a new tile set by calling gamedata.TileSet.add with the name of a tile set resource file.

Tools

Tile sets are plain text files; they are edited with the Code Editor. As usual with the code editor, you can drag and drop files from a resources folder in the open project onto the code editor to insert the resource path into the file. This can be used to insert the path for a tile image into a tile entry.

Contributors to this page: Chris Jennings and system .
Page last modified on Sunday 08 of September, 2013 14:05:06 EDT by Chris Jennings.