What’s New
- Swift 5 Support
- tvOS Support
- Performance Increases
- Effects Rendering
- Support for Tiled Templates
- General Improvements
- OS Compatibility
- API Changes
- GameplayKit
- New Object Types
- Custom Classes
Swift 5 Support
With v1.23, SKTiled now supports Swift 5.3.
tvOS Support
As of v1.17, SKTiled supports tvOS. For more information, see the tvOS Programming Guide.
Performance Increases
Tile map rendering is faster and less taxing on your CPU. Tile maps now store a tile data cache for faster rendering. For more information, see the Tile Rendering Methods section.
Effects Rendering
Both the SKTilemap
& SKTiledLayerObject
nodes are now subclassed from the SKEffectNode
node. Enabling the SKEffectNode.shouldEnableEffects
flag will render the node’s children into a private buffer. This allows for shader effects to be applied to individual layers or even the tilemap globally. Enabling the option on the SKTilemap
node is a good way to eliminate cracks that sometimes appear between tiles.
Support for Tiled Templates
Template objects are now supported and will be loaded automatically. For more information, see Using Templates in the Tiled manual.
General Improvements
- tile update mode flag allows you to customize how your tile maps are updated each frame
- tile render mode flag allows you to customize how tiles are rendered
- the
SKTilesetDataSource
protocol allows you to easily modify tileset images as they’re created - better group layer support
- child layer offsets render correctly
- hierarchical layer search
- text object support
- tile object support
- better asynchronous map rendering
- tilemap is now fully rendered when returned (issue #3)
- better hexagonal coordinate conversion (issue #9)
- better debugging visualizations
- support for custom user objects
- users can implement custom tile, vector &
GKGridGraphNode
classes
- users can implement custom tile, vector &
- new protocol for interacting with the camera:
SKTiledSceneCameraDelegate
- animated tiles are now updated via the
SKTilemap.update(_:)
method- changing the tilemap’s
speed
attribute affects tile animation speed - tile animations can even play backwards if speed is < 0
- changing the tilemap’s
- functions to help alleviate tile seams (or “cracking”)
- tile object tile data can be accessed via
SKTileObject.tileData
(issue #15)
OS Compatibility
macOS target now requires 10.12, iOS target requires 12.
API Changes
The API has gotten a significant overhaul, mainly to support group layers in Tiled 1.0.
As layers & groups can share names and index values, SKTilemap
and SKTiledLayerObject
methods that search based on name or index will now return an array:
// old way
if let groundLayer = tilemap.getLayer(named: "Ground") as? SKTileLayer {
groundLayer.offset.x = 4.0
}
// new way
if let groundLayer = tilemap.getLayers(named: "Ground").first as? SKTileLayer {
groundLayer.offset.x = 4.0
}
New methods take an optional recursive
argument that will search the entire layer tree. When false
, only top-level layers will be returned:
// query top-level layers
let topLevelLayers = tilemap.getLayers(recursive: false)
print(topLevelLayers.map { $0.layerName })
// ["Skyway", "Buildings", "Terrain"]
// query all layers
let allLayers = tilemap.getLayers(recursive: true)
print(allLayers.map { $0.layerName })
// ["Skyway", "Paths", "Trees", "Buildings", "Roof", "Walls", "Foundation", "Terrain", "Ground", "Water"]
See the CHANGELOG for a complete list of changes.
GameplayKit
SKTiled now has support for Apple’s GameplayKit. Navigation graphs can easily be built for tile layers based on tile attributes:
let walkable = tileLayer.getTiles().filter { $0.tileData.walkable == true }
let obstacles = tileLayer.getTiles().filter { $0.tileData.obstacle == true }
let graph = tileLayer.initializeGraph(walkable: walkable, obstacles: obstacles, diagonalsAllowed: false)!
See the GameplayKit section for more details.
New Object Types
SKTiled now supports tile and text text object types.
Tile Objects
Tiled tile objects are now supported. Objects assigned a tile id will render the associated tile within the object bounds, including animated textures.
Text Objects
Tiled text objects are now supported. Objects assigned text properties will automatically render text within the shape’s bounds. Changing the SKTileObject.text
attribute (or any of the font attributes) will automatically redraw the object, allowing for easy creation of dynamic labels.
See the objects page for more info.
Custom Classes
The SKTilemapDelegate
protocol has new methods for users to easily use their own classes for tile and vector objects, as well as custom GKGridGraphNode
objects.
See the extending section for more info.
Next: Getting Started - Index