deepnight /ldtk

Modern, lightweight and efficient 2D level editor

★ 4,883⑂ 321👁 46⑃ 88● 1,172▤ 51◈ 0
HaxeMITCreated 2020-05-29ldtk.io
4,883
stars
321
forks
46
watchers
88
prs
1,172
issues
51
releases
0
discussions

README

!

Level Designer Toolkit (LDtk) is a modern, efficient and open-source 2D level editor with a strong focus on user-friendliness.

Links: Official website | Haxe API (on GitHub)






 Getting LDtk latest version

Visit LDtk.io to get latest version.

 Building from source

 Requirements

 - Haxe compiler: you need an up-to-date and working Haxe install  to build LDtk.
 - NPM: this package manager is used for various install and packaging scripts. It is packaged with NodeJS.

 Installing required stuff

 - Open a command line in the ldtk root dir,
 - Install required Haxe libs:
 
 haxe setup.hxml
 
 - Install Electron locally and other dependencies through NPM (IMPORTANT: you need to be in the app dir):
 
 cd app
 npm i
 

 Compiling master branch

First, from the root of the repo, build the electron Main:


haxe main.debug.hxml


This should create a app/assets/main.js file.

Then, build the electron Renderer:


haxe renderer.debug.hxml


This should create app/assets/js/renderer.js.

 Compiling another branch

If you want to try a future version of LDtk, you can checkout branches named dev-x.y.z where x.y.z is version number.

IMPORTANT:
 - these dev branches might be unstables, or even broken. Therefore, it's not recommended to use, unless you plan to add or fix something on LDtk.
 - because dev branches might change quickly, you will need to update haxelibs often.
 - you will need to switch the LDtk haxe API to the same branch as LDtk repo. (adapt the branch name below accordingly):


haxelib git ldtk-haxe-api https://github.com/deepnight/ldtk-haxe-api.git dev-0.6.0


 Running

From a command line in the app folder, run:


npm run start


 Running inside Hide (as an editor plugin)

LDtk can run embedded in a Hide tab.

First build the plugin (from the ldtk root dir):


haxe hide-plugin.hxml


This creates app/nwjs/hide-plugin.js (sources in src/hide/plugin/). Then add to the Hide project's res/props.json (ldtk.project is optional and resolves relative to res/):

json
"plugins": [ "/path/to/ldtk/app/nwjs/hide-plugin.js" ],
"menu.extra": "",
"ldtk.project": "path/to/world.ldtk"


LDtk then opens from the menu, in its own tab. Bonus: its CastleDB enum sync reads Hide's live database, unsaved changes included.

 Running in NW.js (instead of Electron)

The renderer can also run standalone in NW.js, without the Electron main process:


nw app/nwjs


 Contributing

You can read the general Pull Request guidelines here:
https://github.com/deepnight/ldtk/wikipull-request-guidelines

 Related tools & licences

 - Tileset images: see README in samples
 - Haxe: https://haxe.org/
 - Heaps.io: https://heaps.io/
 - Electron: https://www.electronjs.org/
 - JQuery: https://jquery.com
 - MarkedJS: https://github.com/markedjs/marked
 - SVG icons from https://material.io
 - Default palette: "Endesga32" by Endesga (https://lospec.com/palette-list/endesga-32)
 - Default color blind palette: "Colorblind 16" by FilipWorks (https://github.com/filipworksdev/colorblind

Top issues

Latest release

1.5.3 v1.5.3 2024-01-15
1.5.3

- Fixed a crash when trying to add a newly created Entity
- Fixed crash on async painting with no default Tileset
- Fixed a crash with empty identifiers
- Fixed a potential infinite loop with empty identifiers
- On macOS, CTRL+Left click should now behave like Right Clicking for editing tools and open context menus
- Added ne,nw,se,sw corners directions for Level.__neighbours in JSON

Snapshot: 2026-11-11T15:31:17Z · Data license Apache-2.0 · JSON