TilemapData

Entitytracker.Modelceramic.TilemapData (Class)

Unified tilemap data structure that represents a tile-based map. This format is inspired by the Tiled TMX format but provides a format-agnostic representation that can be populated from various sources.

Key features:

  • Multi-layer support with different tile sizes per layer
  • Multiple tilesets with automatic GID resolution
  • Support for various map orientations (orthogonal, isometric, etc.)
  • Observable properties for reactive updates
  • Serializable for save/load functionality

Ceramic's built-in tilemap visual only supports orthogonal maps, but this data model supports:

  • Orthogonal maps (standard grid-based)
  • Isometric maps (diamond-shaped tiles)
  • Hexagonal maps (honeycomb pattern)
  • Staggered maps (offset rows/columns)

This is a Model class from the Tracker framework, providing:

  • Automatic serialization support
  • Observable properties with @observe
  • Computed properties with @compute
  • Change notifications

Reference: https://doc.mapeditor.org/en/stable/reference/tmx-map-format/

See: Tilemap Visual component for rendering this data, TilemapLayerData Individual layer data, Tileset Tileset definitions

Instance Members

ldtk
ldtkLevel: LdtkLevel

Reference to the LDtk level this tilemap data was generated from. Only set when the tilemap originates from an LDtk file. Provides access to the original LDtk-specific data.


tilemap
name: String

Optional name identifier for this tilemap. Useful for debugging and when managing multiple tilemaps.


tilemap
orientation: Anonymous

Map orientation type that determines how tiles are arranged and rendered.

  • ORTHOGONAL: Standard grid layout (most common)
  • ISOMETRIC: Diamond-shaped tiles for 2.5D appearance
  • STAGGERED: Offset rows or columns
  • HEXAGONAL: Hexagon-shaped tiles

Note: Currently only ORTHOGONAL is fully supported by the renderer.


tilemap
width: Int

Total width of the map in pixels. This is typically calculated as: columns × tileWidth


tilemap
height: Int

Total height of the map in pixels. This is typically calculated as: rows × tileHeight


tilemap
renderOrder: Anonymous

Determines the order in which tiles are rendered within each layer. Affects which tiles appear on top when they overlap.

  • RIGHT_DOWN: Left to right, top to bottom (default)
  • RIGHT_UP: Left to right, bottom to top
  • LEFT_DOWN: Right to left, top to bottom
  • LEFT_UP: Right to left, bottom to top

tilemap
hexSideLength: Int

For hexagonal maps only: The length of the hex tile edge in pixels. This determines the size of the hexagon sides. Set to -1 for non-hexagonal maps.


tilemap
staggerAxis: Anonymous

For staggered and hexagonal maps: Which axis has alternating offsets.

  • AXIS_X: Alternating columns are offset (vertical hex)
  • AXIS_Y: Alternating rows are offset (horizontal hex)

tilemap
staggerIndex: Anonymous

For staggered and hexagonal maps: Which indices are shifted.

  • ODD: Odd rows/columns are offset (1, 3, 5...)
  • EVEN: Even rows/columns are offset (0, 2, 4...)

tilemap
backgroundColor: AlphaColor

Background color displayed behind all map layers. Includes alpha channel for transparency. Default is fully transparent (alpha = 0).


tilemap
maxTileWidth: Int

Computes the maximum tile width across all layers. Useful for allocating buffers or determining map bounds.

Some maps may have layers with different tile sizes (e.g., detail layers with smaller tiles).


tilemap
maxTileHeight: Int

Computes the maximum tile height across all layers. Useful for allocating buffers or determining map bounds.

Some maps may have layers with different tile sizes (e.g., detail layers with smaller tiles).


tilemap
tilesets: Array<Tileset>

Array of tilesets used by this map. Tilesets define the graphics and properties for tiles.

Ordered by firstGid (ascending) for efficient GID lookups. Each tileset handles a range of global tile IDs (GIDs).


tilemap
layers: Array<TilemapLayerData>

Array of layers that make up the map. Layers are rendered in array order (first = bottom).

Each layer can be:

  • Tile layer: Grid of tile GIDs
  • Object layer: Positioned objects (future)
  • Image layer: Single background image (future)

tilemap
asset: TilemapAsset

Reference to the TilemapAsset that loaded this data. When the asset is destroyed, this data is also destroyed. Set automatically by TilemapAsset during loading.


tilemap
invalidateLdtkLevel(): Void

tilemap
invalidateName(): Void

tilemap
invalidateOrientation(): Void

tilemap
invalidateWidth(): Void

tilemap
invalidateHeight(): Void

tilemap
invalidateRenderOrder(): Void

tilemap
invalidateHexSideLength(): Void

tilemap
invalidateStaggerAxis(): Void

tilemap
invalidateStaggerIndex(): Void

tilemap
invalidateBackgroundColor(): Void

tilemap
invalidateMaxTileWidth(): Void

tilemap
invalidateMaxTileHeight(): Void

tilemap
invalidateTilesets(): Void

tilemap
invalidateLayers(): Void

tilemap
destroy(): Void

tilemap
tilesetForGid(gid: Int): Tileset

Finds the tileset that contains the given global tile ID (GID). GIDs are globally unique across all tilesets in the map.

Name Type Description
gid Int The global tile ID to look up
Returns Description
Tileset The tileset containing this GID, or null if not found

tilemap
layer(name: String): TilemapLayerData

Retrieves a layer by its name. Layer names should be unique within a tilemap.

Name Type Description
name String The layer name to search for
Returns Description
TilemapLayerData The matching layer data, or null if not found

tilemap
setTexturesFilter(filter: Anonymous): Void

Sets the texture filtering mode for all tileset textures.

Common values:

  • NEAREST: Pixel-perfect rendering (recommended for pixel art)
  • LINEAR: Smooth/blurred rendering
Name Type Description
filter Anonymous The texture filter to apply to all tilesets

tilemap
size(width: Int, height: Int): Void

Convenience method to set both width and height at once.

Name Type Description
width Int The map width in pixels
height Int The map height in pixels

tilemap
tileset(name: String): Tileset

Retrieves a tileset by its name. Tileset names should be unique within a tilemap.

Name Type Description
name String The tileset name to search for
Returns Description
Tileset The matching tileset, or null if not found

tilemap
new(): Void

Private Members

tilemap
unobservedLdtkLevel: LdtkLevel

tilemap
unobservedName: String

tilemap
unobservedOrientation: Anonymous

tilemap
unobservedWidth: Int

tilemap
unobservedHeight: Int

tilemap
unobservedRenderOrder: Anonymous

tilemap
unobservedHexSideLength: Int

tilemap
unobservedStaggerAxis: Anonymous

tilemap
unobservedStaggerIndex: Anonymous

tilemap
unobservedBackgroundColor: AlphaColor

tilemap
unobservedMaxTileWidth: Int

tilemap
unobservedMaxTileHeight: Int

tilemap
unobservedTilesets: Array<Tileset>

tilemap
unobservedLayers: Array<TilemapLayerData>

tilemap
emitLdtkLevelChange(current: LdtkLevel, previous: LdtkLevel): Void

Event when ldtkLevel field changes.

Name Type
current LdtkLevel
previous LdtkLevel

tilemap
emitNameChange(current: String, previous: String): Void

Event when name field changes.

Name Type
current String
previous String

tilemap
emitOrientationChange(current: Anonymous, previous: Anonymous): Void

Event when orientation field changes.

Name Type
current Anonymous
previous Anonymous

tilemap
emitWidthChange(current: Int, previous: Int): Void

Event when width field changes.

Name Type
current Int
previous Int

tilemap
emitHeightChange(current: Int, previous: Int): Void

Event when height field changes.

Name Type
current Int
previous Int

tilemap
emitRenderOrderChange(current: Anonymous, previous: Anonymous): Void

Event when renderOrder field changes.

Name Type
current Anonymous
previous Anonymous

tilemap
emitHexSideLengthChange(current: Int, previous: Int): Void

Event when hexSideLength field changes.

Name Type
current Int
previous Int

tilemap
emitStaggerAxisChange(current: Anonymous, previous: Anonymous): Void

Event when staggerAxis field changes.

Name Type
current Anonymous
previous Anonymous

tilemap
emitStaggerIndexChange(current: Anonymous, previous: Anonymous): Void

Event when staggerIndex field changes.

Name Type
current Anonymous
previous Anonymous

tilemap
emitBackgroundColorChange(current: AlphaColor, previous: AlphaColor): Void

Event when backgroundColor field changes.

Name Type
current AlphaColor
previous AlphaColor

tilemap
emitMaxTileWidthChange(current: Int, previous: Int): Void

Event when maxTileWidth field changes.

Name Type
current Int
previous Int

tilemap
emitMaxTileHeightChange(current: Int, previous: Int): Void

Event when maxTileHeight field changes.

Name Type
current Int
previous Int

tilemap
emitTilesetsChange(current: Array<Tileset>, previous: Array<Tileset>): Void

Event when tilesets field changes.

Name Type
current Array<Tileset>
previous Array<Tileset>

tilemap
emitLayersChange(current: Array<TilemapLayerData>, previous: Array<TilemapLayerData>): Void

Event when layers field changes.

Name Type
current Array<TilemapLayerData>
previous Array<TilemapLayerData>

tilemap
toString(): String

Returns a string representation of the tilemap data for debugging. Includes all major properties but excludes detailed tile data.

Returns Description
String Debug string showing map properties

Metadata

Name Parameters
:build tracker.macros.EventsMacro.build()
:autoBuild tracker.macros.EventsMacro.build()
:build ceramic.macros.EntityMacro.buildForCompletion()
:autoBuild ceramic.macros.EntityMacro.buildForCompletion()
:build tracker.macros.ObservableMacro.build()
:autoBuild tracker.macros.ObservableMacro.build()
:build tracker.macros.SerializableMacro.build()
:autoBuild tracker.macros.SerializableMacro.build()