Hello Guest

Author Topic: Objects in Tile Maps?  (Read 3952 times)

MindJuiceKen

  • Newbie
  • *
  • Posts: 5
    • View Profile
Objects in Tile Maps?
« on: January 23, 2014, 07:14:03 am »
I want to have a level-designer/artist work on creating my map(s) using Tiled, and I would like them to be able to position objects in the scene using Tiled's object layers.

Do you have any plan to extend 2D Toolkit to expose TMX object information?  I really only need to be able to access the XML data, but it would be cool if that was mapped to a dictionary for easy lookup instead of ugly XML parsing methods.

Something like this:
  • Get a list of ObjectLayers from the tile map object
  • ObjectLayers have a list of MapObjects.
  • MapObjects have information about their type (rectangle, ellipse, etc.), and a dictionary/map of key/value pairs entered from Tiled.

Also, the ability to replace an object with a prefab (the way you allow with tiles) would be great.

I'd be willing to help out with this if you're interested in including it.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Objects in Tile Maps?
« Reply #1 on: January 23, 2014, 10:59:16 am »
Hi, there are no plans to add TMX object information, not in the immediate future anyway. The issue with the XML stuff is that it adds significant overhead to builds so it isn't really practical to add that for any runtime code. Also there is the Base64 / zip stuff which is required for a lot of tmx files.

We do have something similar to the map objects planned, but I don't know if / when it will be implemented - it would make sense to pull in tmx information for that when there is a corresponding tk2dTileMap component. Sorry I can't be more concrete about plans - I'll have a better idea after tk2d 2.4 is released.

MindJuiceKen

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Objects in Tile Maps?
« Reply #2 on: January 25, 2014, 07:04:00 am »
Thanks for the reply.

There are plenty of game engines with full TMX support, so the overhead can't be so significant that it's not worth doing.

Plus it's something that you could only include if they user chose to.  If you need it, you pay the cost.

Another option would be to import the TMX files in the editor and convert them into your internal tile map format.

That way, we could have artists use Tiled to create game levels, then import them into Unity/tk2d and avoid any additional overhead of XML parsing, Base64 or ZIP.

It would need to be easy to refresh the tile map if the TMX was modified (ideally automatically, but on demand would be okay).

Anyway, just some thoughts.


unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Objects in Tile Maps?
« Reply #3 on: January 25, 2014, 10:08:22 am »
The issue isn't loading TMX, its how the assemblies work in Unity - eg. on iOS, as soon as you use the xml libraries it increases the runtime library size significantly. You're affected as long as the code referencing it is in the assembly, so it can't really be merged in - its why the zlib stuff is done the way it is in tk2d. Thats quite different to adding tmx support to a c/c++ engine where you have full control, you can get a really small xml library (a few k vs a few MB) and make other choices like this.

Having said that we've had a few requests for tmx tile maps in unity. If I was to implement that I'd do that quite differently to the tk2d system - thats optimised for editing. We might implement something, but its unlikely to integrate into the tk2d editor (its a lot more effort than its worth to be honest) but should support all the other runtime features. That way automatic updates etc will be trivial.