1. Home
  2. Docs
  3. In-game implementation
  4. 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

QuickType is a neat tool that uses the JSON “schema” to generate typed code structures and even write the code to import the JSON in various languages (eg. Ruby, Dart, Objective-C etc).

Because it’s based on the latest JSON schema, it’s always guaranteed to work even with latest version of LDtk.

First, check the API page to see if your favorite language is listed. If not, you can use QuickType online by following these easy steps:

  1. Download the latest Json Schema file: LDtk Json Schema,
  2. Go to the Quicktype website,
  3. Paste the JSON schema in the left panel,
  4. Change Source Type to “JSON Schema”,
  5. Pick your language on the right,
  6. Optionally, adjust options as you wish,
  7. Download the resulting source code & enjoy

3. The home-made way

It’s quite easy to parse the JSON by yourself. It’s a big one, but you won’t need everything. So don’t worry, we’ve got your back.

Here are a few important things you should know:

  • 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. You can learn more about these helpers here.
  • 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: please read more about the Tile export here. This could be a good approach to try and integrate LDtk quickly.

Warning: the Tiled export comes with some limitations.