Tiled mapeditor loader?

Anyone have any code or a lib i can use to load tiled map files and display them?


What if you create one yourself and share it with us :stuck_out_tongue_winking_eye:


        for (int y = 0; y < mapData.getHeight(); y++) {
            for (int x = 0; x < mapData.getWidth(); x++) {

But yeah, if you want a 2D map designer. There are few available, and you can just display it in JME given that the format is readable. But the question is quite broad.

I think OP is being pretty specific. There is a tile editor called Tiled. (http://www.mapeditor.org/) OP wants to know if anyone has already written a loader for it.

My guess… no.

But a few seconds of googling leads me to believe it wouldn’t be hard to implement if no one steps forward with an existing solution:


You are correct. That’s the editor and was looking for a already made solution. I am new to jme and java. I come from c++. I will take a look and start working on it. Good project to use to learn java and jme with.

1 Like

One exists in libgdx I believe

Also in Slick2D

FYI: Only loader supported out-of-the-box at the moment is for the TMX format that Tiled uses.

FYI: Libgdx has a loader for the TMX format as well.

Good info for me - I’m looking for a format as well. I’ll dive deeper into this to see if I can make it fit my requirements.

That’s what he said.

You do understand that the OP was specifically asking about Tiled’s TMX format, yes?

Until this thread, I did not know there was a map editor named Tiled with a generally accepted format. I understood it as a general term for ‘tiled maps’.

1 Like

Correct. Tiled mapeditor uses the .tmx file

I guess the name is confusing. I already read it correctly so this thread has been kind of strange.

OP: I’m looking for a TMX loader, anyone have one?
P2: There are lots of editors available you should be more specific. (resolved confusion there already)
ME: ^^ resolving that confusion mentioning that Tiled is a thing and TMX is the format.
OP: confirming
P3: libgdx has a TMX loader
P4: Slick2D has a TMX loader
P5: Slick2D only supports TMX out of the box (non-information so far as this thread is concerned) Libgdx has a TMX loader (redundant information)

…so that’s why I was scratching my head a bit since we’d already established TMX as the format. Though I guess if you skipped all of that then it’s still confusing.

And anyway, I forget that Tiled is not instantly a “Thing” to everyone else. :slight_smile:

I think I’ll start working on this, but there’s already libtiled.jar for java-use - so the implementation of processing/using and displaying the data is really the only major gap, and that seems pretty implementation specific. Wouldn’t you agree?

In a Zay-ES implementation, I would create a MapAppState to keep track of currently loaded maps (there could be more on a given server), create entities out of all the different tiles, give them the properties they need depending on the tile information in the Map. My client-side ModelViewState would then already be able to display them in the scene.

Should be fun - I’ll report back once I have an update. Any input is most welcome :slight_smile:

Edit: https://github.com/bjorn/tiled/tree/master/util/java/libtiled-java

Short update from my side:

-Installed Maven
-Cloned Tiled-repository locally and did ‘mvn clean install’ inside the libtiled folder
-Added to build.gradle:

repositories {
    //Dependency (parent-tiled) located here
    maven { url "https://oss.sonatype.org/content/repositories/snapshots"} 
dependencies {
    //Mapeditor format support
    compile 'org.mapeditor:libtiled:0.17-SNAPSHOT'

-Restarted SDK (wouldn’t let me access the jar-content inside code before I did)
-Ready (update will follow)

Just found out that there is no updated dtd or xsd files for the tmx-format. :chimpanzee_facepalm: Kind of hard to work with… Wonder if it’s worth the trouble to implement a framework to process tmx-files not having a schema to work against.