1. Home
  2. In-game implementation
  3. Loading LDtk in your game

Loading LDtk in your game

Loading your shiny new world can be done in 4 different ways.

1. The “Super Simple Export” way

The ideal way for game jams, or if you just want to test LDtk quickly. Almost no parsing required. You can ignore the big LDtk JSON file completely.

Just enable the Super Simple Export and you’re good to go and focus on making your game.

2. The QuickType way

LDtk uses QuickType to generate a full JSON parser compatible with many languages including Ruby, Dart, Objective-C etc. It’s based on the official JSON schema, so it’s always guaranteed to work even with latest version.

Check the API page to see if your favorite language is listed. If not, you don’t have to install any tool, as QuickType operates fully online:

  1. Download the latest Json Schema file: LDtk Json Schema,
  2. Paste it in Quicktype online app,
  3. Select the JSON Schema as Source type,
  4. Pick your favorite language and adjust options as you wish,
  5. Download the resulting source code & enjoy

3. The home-made way

You may check the API section for existing importers and tools.

If nothing fits your needs, it’s quite easy to parse the JSON by yourself. Don’t worry, we’ve got your back.

  • First thing to know: you can ignore all JSON sections marked as “Internal editor data in the JSON documentation. As this label suggests, game devs don’t really need these elements. That’s a big part of the JSON.
  • If you only need level data, check the levels array in the JSON root.
  • Rely heavily on fields named with a double underscore (eg. __tile, or __x), as these values exist for the sole purpose of making your dev life easier.
  • Get started by reading the JSON overview section.

4. The Tiled TMX way

Tiled is a very popular and complete tool to create levels. Many game frameworks support it pretty well. LDtk can export to Tiled TMX file format: see documentation. This could be a good approach to try and integrate LDtk quickly.

Warning: the Tiled export comes with some limitations.