TiledKit
A Swift Package for reading Tiled levels that makes it easy to specialize the loaded level/sheets etc for a specifc game engine.
To simply load a map and any associated tilesets it is as simple as
import TiledKit
let map = Project.default.retreive(map: "Test Map")
print ("Hello, \(map.name)!")
The primary use of TiledKit will be enable you to convert the maps you design in Tiled into playable games using a game engine, and there is significant support for doing that quickly and efficiently (as well as open source projects that already capture them such as SpriteKit). You can find documentation aimed at guiding you through that process Game Engine Specialization.
Here's an example of a single Tiled level being rendered by two different specializations in TiledKit (bottom right, TextEngine in the console output, bottom left SpriteKit using SKTiledKit))
TiledKit works on all Apple & Linux platforms supporting Swift 5.3 or later.
Available Specializations
Documentation
- Worked example of specialization for your chosen platform Game Engine Specialization
- Full API documentation is available for TiledKit
Installation
TiledKit is distributed as a Swift package to be built with SPM. You can include it in your project by adding the following dependency to your Package.swift
file
.package(url: "https://github.com/SwiftStudies/TiledKit", from: "0.6.0")
Compression
In order to support the different compression standards used in Tiled you will need zlib and zstd. zlib is availble already on Apple platforms, but you will still need zstd. In order to make these buildable follow the instructions below, these are very standard libraries and you should not have any issues.
Apple Platforms
brew install zstd
Linux
sudo apt install libz-dev
sudo apt install libzstd-dev