Properties/ group IDs for individual tiles


#1

Is there any plan to at one point introduce properties for individual tiles? I understand that you can add properties to a tile but those properties will be the same for each placed tile. It would be awesome if there was a feature to select a specific tile and then give it a custom property which only applies to that selected tile.

I also understand that this can be done with an object layer, however this will quickly become cumbersome for some of the things I want to do. For example, I want to add group IDs do a bunch of tiles which may all be in different layers so that I can apply actions to all those tiles. For example all tiles with a groupID of 2 get moved 10 spaces up. As things are right now, I’m not sure how I’d implement this with any ease. And if I placed all my tiles as objects then that would waste memory since I don’t need custom properties for most of my tiles, just the select few that will have actions attached to them. Custom properties for individual tiles would make this process immensely easier. Thoughts?


(Nathaniel Nielsen) #2

One option you have would be to use the Rectangle tool to define a region in an object layer and apply your custom properties to that Rectangle object. In your engine, you could then apply those properties to any tiles that are within the rectangle’s bounds when you load your map.


#3

Yes that’s an option however what if I wanted to apply properties to multiple layers. Now I need object layers for each tile layer I want to apply my property. Or what if the desired tiles aren’t aligned in a rectangle but some more complicated shape, now I need rectangles for each tile which seems rather tedious. Would it not be easier to simply allow for custom properties for a specified tile? What are the major roadblocks in implementing such a feature?


(Nathaniel Nielsen) #4

The major roadblock would be the amount time involved to implement the feature, and that it would require the map file format to be changed - which would most likely break compatibility with the many engines that support TMX files.

Yes, it is possible, but it would be a major undertaking.
You can find Tiled’s source code here: https://github.com/bjorn/tiled, if you would like to implement the feature in the editor. I’m not quite sure what you’re looking for, but you can certainly customize Tiled to suit your needs.


You wouldn’t necessarily need a separate object layer for each tile layer; you could have a block of code that loops through each tile layer and for each object that had been loaded, apply the properties to the appropriate region of tiles.

The objects wouldn’t have to be rectangles, though they’d be the easiest to write the code for and it would be fine for them to overlap to make more complex shapes.

If you didn’t want a region’s properties to be applied to a particular layer, you could add a property to the object or object layer that wouldn’t be added to tiles, but would tell your block of code to only apply the region’s properties to any layer specified by index.


#5

ah ok, I’m starting to see what you mean. I guess that can satisfy my needs. I thought adding tile properties would be a simple change but then again I haven’t really looked at the source code for any extended period. Anyways, thanks!


(Nathaniel Nielsen) #6

No problem!
I did a little more research on the matter and it looks like another option you have would be to try out Tiled’s automapping feature, which sounds pretty close to what you’re looking for but would take a little bit of time to configure:

Documentation: