Anyone have any code or a lib i can use to load tiled map files and display them?
Thanks
Anyone have any code or a lib i can use to load tiled map files and display them?
Thanks
What if you create one yourself and share it with us
Here:
for (int y = 0; y < mapData.getHeight(); y++) {
for (int x = 0; x < mapData.getWidth(); x++) {
roodNode.attachChild(loadModelHere);
}
}
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:
http://doc.mapeditor.org/reference/tmx-map-format/
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.
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ā.
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.
Translated:
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.
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
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.