mapeditor /rs-tiled

Reads files from the Tiled editor into Rust

★ 300⑂ 117👁 4⑃ 246● 108▤ 15
RustMITCreated 2014-10-07crates.io/crates/tiled
Download: v0.16.0v0.16.0 ↓0.16.02026-07-06
+0
Daily
+0
Weekly
300
stars
117
forks
4
watchers
246
prs
108
issues
15
releases

README

rs-tiled
toml
tiled = "0.16.0"







A crate for reading TMX (map) and TSX (tileset) files from the Tiled Map Editor into Rust.
It provides a huge set of features as well as a strong wrapper over internal features such as GIDs.

Documentation is available on docs.rs.

Code contributions are welcome as are bug reports, documentation, suggestions and criticism.

The minimum supported TMX version is 0.13.

 Example

rust
use tiled::Loader;

fn main() {
    let mut loader = Loader::new();
    let map = loader.load_tmx_map("assets/tiled_base64_external.tmx").unwrap();
    println!("{:?}", map);
    println!("{:?}", map.tilesets()[0].get_tile(0).unwrap().probability);
    
    let tileset = loader.load_tsx_tileset("assets/tilesheet.tsx").unwrap();
    assert_eq!(map.tilesets()[0], tileset);
}



 FAQ
 How do I embed a map into my executable? / How do I read a file from anywhere else that isn't the filesystem's OS?
The crate does all of its reading through the read_from function of the ResourceReader that you create the loader with. By default, this reader is set to FilesystemResourceReader and all files are read through the OS's filesystem. You can however change this.

Here's an example mostly taken from Loader::with_reader's documentation:
rust,ignore
use tiled::{DefaultResourceCache, Loader};

let mut loader = Loader::with_reader(
    // Specify the reader to use. We can use anything that implements ResourceReader, e.g. FilesystemResourceReader.
    // Any function that has the same signature as ResourceReader::read_from also implements it.
    // Here we define a reader that embeds the map at "assets/tiled_xml.csv" into the executable, and allow
    // accessing it only through "/my-map.tmx"
    // ALL maps, tilesets and templates will be read through this function, even if you don't explicitly load them
    // (They can be dependencies of one you did want to load in the first place).
    // Doing this embedding is useful for places where the OS filesystem is not available (e.g. WASM applications).
    |path: &std::path::Path| - std::io::Result {
        if path == std::path::Path::new("/my-map.tmx") {
            Ok(std::io::Cursor::new(include_bytes!("assets/tiled_csv.tmx")))
        } else {
            Err(std::io::ErrorKind::NotFound.into())
        }
    }
);

If the closure approach confuses you or you need more flexibility, you can always implement ResourceReader on your own structure.

 How do I get the crate to work on WASM targets?
The crate supports WASM, but since it does not currently support asynchronous loading, there are some gotchas.

- First, to make it work on any WASM target, enable the wasm feature, like so:
toml
[dependencies]
 ...
tiled = { version = ".....", features = ["wasm"] }


- Second, since you cannot use the filesystem as normally on the web, you cannot use FilesystemResourceReader. As such,
  you'll need to implement your own ResourceReader. This is a pretty simple task, as you just need to return anything
  that 

Top issues

Discussions

Latest release

v0.16.0 v0.16.0 2026-07-06
Completes support for all TMX format changes up to Tiled 1.12, including the oblique orientation, list properties, layer blend modes, capsule objects and various older attributes that were still missing. Also switches the XML parser to quick-xml for a significant speedup, and raises the Rust edition to 2024 (MSRV 1.85).

Note for contributors: the repository has moved to a single-branch workflow; development now happens on main, and the current/next branches are gone.

 What's Changed
 Switch from xml-rs to quick-xml by @bjorn in https://github.com/mapeditor/rs-tiled/pull/334
 Add oblique orie

Snapshot: 2026-11-27T22:26:53Z · Data license Apache-2.0 · JSON