Tiled maps

1. Introduction

We feature an extensive support for maps designed in Tiled map editor.

Tiled map

2. Usage

  1. Design your map in Tiled, and save the resulting map (.tmx) along with images (tilesets) somewhere in the project data subdirectory.

  2. Add to your viewport a TCastleTiledMap component and set TCastleTiledMap.URL to indicate your map (.tmx) file.

3. Features

Tiled isometric map
Tiled hexagonal map
Tiled map in 3D perspective
Choosing Tiled layers to show

We support many Tiled features, like

  • Any number of layers, any map sizes, multiple tilesets.

  • All map types: Orthogonal, Isometric, IsometricStaggered, Hexagonal.

  • Flipping of tiles (diagonal, horizontal, vertical).

  • Optimized rendering with static batching of map layers.

The TCastleTiledMap is a TCastleTransform instance, and as such you can move, rotate and scale it.

Inside the viewport you have a regular camera. You can move the camera, you can change the camera orthographic height (TCastleOrthographic.Height) to zoom in/out. Add the TCastle2DNavigation component as a child of your viewport to allow user to move/zoom on the map too.

To show/hide specific layers use TCastleTiledMap.Layers. Click on the button with 3 dots …​ at the Layers property to invoke a nice dialog where you can select layers by names.

The TCastleTiledMap.Map exposes internal map data (read-only) to query for various information about the map.

To improve this documentation just edit the source of this page in AsciiDoctor (simple wiki-like syntax) and create a pull request to Castle Game Engine WWW (cge-www) repository.