Tiled map editor loader

Monkey Forums/User Modules/Tiled map editor loader

bitJericho(Posted 2014) [#1]
Hello I've released my Tiled loader for Monkey here:

https://github.com/bitJericho/bit.tiled/

Place this in your modules folder. If you run "Rebuild Help" from the help menu the documentation can generate.

This module requires the skn3.xml module (not created by me) located here: https://github.com/skn3/xml

Oh and of course the wonderful Tiled map editor can be found here: http://www.mapeditor.org/

Let me know if you have any questions!


Samah(Posted 2014) [#2]
Is there anything this does that the Diddy one doesn't?
https://code.google.com/p/diddy/source/browse/src/diddy/tile.monkey

Less dependencies I guess... keep working on it. :)


bitJericho(Posted 2014) [#3]
Hey, thanks for taking a look. My analysis here isn't meant to put down the Diddy's version, just pointing out the differences I noticed. Just a quick look, it looks like Diddy's version requires pretty much the entire Diddy library. It appears that Diddy's retrieves data from the XML file as requested, whereas mine loads it all into memory. My library is fully documented, but Diddy's is more polished. Diddy's does things far above and beyond what's needed though, including collision detection and rendering, whereas my library only loads images using LoadImage, which can be overridden of course. Overall DIddy's looks more polished and eventually my library will get to that point, hopefully :D


Samah(Posted 2014) [#4]
My library is fully documented

Yeah I'm lazy with documentation. XD
Diddy's version requires pretty much the entire Diddy library

Unfortunately the Diddy one is dependent on a lot of stuff. I recently removed the requirement for the screen framework, but for backward compatibility it still needs to import it. Due to Monkey's dead code removal it should hopefully strip a lot of it though if you're not using it. I might see what I can do about that.

Your work looks pretty clean, keep at it! :D


V. Lehtinen(Posted 2014) [#5]
Neat! I also made TileD loader for fantomEngine, but it requires some changes to be implemented elsewhere... It also requires skn3.xml module, but doesn't have documentation, because I'm as lazy as Samah. :D Our loaders look pretty much the same though.


bitJericho(Posted 2015) [#6]
I added a few new things:
Added external tileset support.
Allow tmx and tsx files to be loaded. (#TEXT_FILES+="|*.tmx|*.tsx") I swear this didn't work before
Tile properties are now supported.
Tileset properties are now supported.
Fixed up some documentation errors and general updates to the docs.

https://github.com/bitJericho/bit.tiled/tree/master/bit/tiled


Nobuyuki(Posted 2015) [#7]
bitJericho: I'm pretty sure that using += in some directives was broken at one point, too. I've made that change in my own code as well in both a diddy-less fork of Samah's Tiled loader and also a fork of AngelFont. These things would step all over each other's toes otherwise! I very much appreciate how well-commented your source code is.

By the way..... Recent changes to Samah's loader include scaling and wrap property support (I believe these were extensions at one point for the old Tiled codebase). Why not take a peek at the recent changes if you're interested ;)


Samah(Posted 2015) [#8]
I just removed all dependencies on the screen framework using some precompiler directives and interface black magic.
I also fixed a bunch of compilation errors that only showed up when I imported reflection (sigh).
Get the develop tip.


SpaceAce(Posted 2015) [#9]
I wish someone would make a complete solution for using Tudee from http://www.diorgo.com/v1/?p=366 It's by far the best 2d tilemap editor I have ever used. Nothing else is even in second place, as far as I'm concerned. With a few interface and functionality tweaks, it would be nearly perfect.

I've gotten it into my head several times to make a TuDee loader and engine for Blitzmax, and later Monkey, but I always get overwhelmed. TuDee just does so damn many things! If I started, I would feel compelled to implement every single feature, and it would end up being a year-long project. TuDee's author did make a Monkey loader after I told him about the language, but it's out of date, and only supports a tiny subset of TuDee's features.

I'm struggling through trying go get Tiled maps working properly with IgnitionX right now, and I keep fantasizing about being able to use TuDee in my Monkey projects. It's a shame TuDee didn't catch on, even after the author released it as freeware.

I recommend everyone who is interested in an amazing 2d map editor check out TuDee.

Edit: Huh, I guess I went a bit off-topic, there. It's great that you're working on another Tiled loader. It's always good to have alternatives. I may have a look at it tomorrow, depending on whether I get my issues with the IgnitionX loader solved.


Nobuyuki(Posted 2015) [#10]
It is likely that you can write a loader that can get basic map data from TDX format to the current iteration of diddy's tilemap loader, seeing as how the loader is now completely abstracted from the renderer. It will not support many of the "extra" features that program advertises (tile groups, paths, entities), but you can likely store it in metadata properties to use in your engine as needed. Tiled abstracts most of these things to shapes and objects in an object layer.

I'm not sure if Tiled supports "per-tile" metadata.


bitJericho(Posted 2015) [#11]
Nope but you can place metadata (called properties in tiled) on a tile in a tileset, but not on a map tile. All of the features of Tudee can be implemented in a tiled map so my first inclination is to make a tiled exporter for tudee rather than a monkey module, since all the major monkey frameworks seem to have tiled support and also my tiled importer if you don't want to use a framework.

I have a few projects lined up right now but I can look into something for you in a few weeks. Of course I'm always amenable to work on specific projects if payment is involved, in case you need something quickly!


Samah(Posted 2015) [#12]
@SpaceAce: Nothing else is even in second place, as far as I'm concerned.

If nothing else is second place, then logically, TuDee *is* second place? XD


SpaceAce(Posted 2015) [#13]

It is likely that you can write a loader that can get basic map data from TDX format to the current iteration of diddy's tilemap loader, seeing as how the loader is now completely abstracted from the renderer.



Yes, it's possible that I could tweak the exporter settings to make the map load using an existing Tiled library. Like the rest of the program, TuDee's exporter is awesome. You can export as XML, and you can select each individual piece of information you want included.


I have a few projects lined up right now but I can look into something for you in a few weeks. Of course I'm always amenable to work on specific projects if payment is involved, in case you need something quickly!



I'm amenable to paying for work when I have money! Unfortunately, I am on the "unemployed and looking for a job" side of the spectrum, rather than the "can afford to pay people for things" side of the spectrum. One of the reasons I came back to the forums was the tiny chance that there might be work available. Free time and money never seem to line up for me. Last year, when I had a job that handed me a five-figure bonus, I didn't have time for personal programming projects. Now, I have time, but I'm eating ramen noodles and looking for couches to sleep on. Life is funny like that. If you decide to take a whack at TuDee on your own time, I'll certainly be interested in seeing what you come up with.


If nothing else is second place, then logically, TuDee *is* second place? XD



I guess it's like the old "eliminating the bottom 10%" conundrum. On my list of "2d tilemap editors that do almost everything I want," it's TuDees all the way down. On my list of "2d editors that do enough to get by, and have some sort of support in one of the languages I use," there are a few other candidates.


bitJericho(Posted 2015) [#14]
Tell me about it haha. Just throwing it out there that my personal projects are not necessarily priority especially over eating something better than ramen :D I will definitely look at tudee in time though!!


Amon(Posted 2015) [#15]
Am I missing something here?

http://www.diorgo.com/v1/?p=399


bitJericho(Posted 2015) [#16]
SpaceAce noted that it was out of date.


Amon(Posted 2015) [#17]
That's what I was missing, apologies!


bitJericho(Posted 2016) [#18]
Hello, I've *finally* committed a complete rewrite now visible here:

https://github.com/bitJericho/bit.tiled

The new version is very buggy but now I have this rewrite to a state that loads some map files without crashing! It's very close to supporting every tiled feature and I plan to commit next week to making that more of a reality.

Right now it can store all tiled data properly (I think maybe) except for external tsx files, which I should have completed next week. What it supports and can read from map files is pretty much everything in this document: http://doc.mapeditor.org/reference/tmx-map-format/

However I don't have any kind of renderer for many of the features yet, like animation or tile rotation/flipping. It'll probably crash in some maps too because the rendering is only just begun. And I'm fairly sure I don't have padding/margins correct yet on image loading as that's completely untested and not well spelled out in the spec.

Right now the renderer I provided can display hexagonal and orthogonal maps but I haven't tested out the others. It supports unlimited layers and draw them in the right order. Documentation is not yet completed.

If anyone would like to contribute, I'd be happy to add any commits. The parts I probably won't get to anytime soon are compression, zlib and gzip. I probably won't get to integrated image assets (png or whatever inside a data field in the map) but all of that would be great to have.

Also I changed the license to a more standard and open license.

Check out the hexagonal-mini.tmx and sewers.tmx files to see it in action. Notice that on instantiation you can specify the image class for storing images, in case you would like to use a different graphics engine.


bitJericho(Posted 2016) [#19]
Busy working today! Added tsx support and fixed spacing/margin settings. You should be able to load and display most maps now but I haven't tested that yet.