I’ve added a custom property to each tile in a tileset, and my layer is consists of only tiles in this tileset.
I wonder if it is possible to set different value for the custom property for each tile on the layer, rather than each tile in the tileset?
I think tile objects might be the best candidate for achieving this.
Also, welcome to the forums!
Thank you for the warm welcome!
I’m thinking of “binding” the properties to the tile, so that when I move tiles thoes properties will also move along with the tile. By using “tile objects” I’m actually creating two individual objects, one for tile graphic and one for the property, am I right?
If you need these custom properties on every single tile in the map, and if the properties have a reasonably small number of valid values, you may be better off using a separate, hidden layer of tiles to convey that information more easily than Tile Objects (which exist to use tiles as distinct, non-tile entities in the world, rather than to let you attach additional information to regular tiles). Either the tiles themselves can convey the information, or the properties can be attached to them in the tileset.
In my current game, I handle collision this way because my tiles don’t have a 1:1 mapping to different collision types, which means I can’t use Tiled’s built-in collision tools.
My game reads the “Logic” layer as a special case, it never gets added to the list of layers to render. Each tileID in this layer gets translated to a per-tile collision value the physics system can understand. The visible tiles I see in Tiled exist only in a work-in-progress tileset, for release, they will be cropped off the tileset since only the tileIDs are needed and the actual collision tiles are never displayed in-game.
The same approach can be used for height maps in top-down games, and probably some other things that exist on the tile grid but can’t be tied to specific tiles.
Thank you for the advice. For now I think this is the best way to reach my goal.
Just to answer this one question. With tile objects you create one object, which both renders as a tile and can hold individual properties. Usually, only certain “interactive” tiles on your map need custom properties, like signposts, pickups or NPCs.
Do you mean the one that can be placed in Object Layer? I found it is not snapped to the grid. Is there any settings to force it snapped? Then I’d be happy to move all my map onto an Object Layer, rather than on a Tile Layer.
This is not the intended use of Tile Objects! Think of Tile Objects as just regular objects that happen to use tiles for their artwork, rather than as anything actually related to tiles. Using them for your entire map will most likely be very slow in-engine unless you specifically parse Tile Objects as tiles somehow. In addition, using Tile Objects for your map also means you lose the use of almost every mapping tool Tiled provides!
If using an extra layer of tiles or some other method is absolutely not possible though, you can position Tile Objects on the grid, same as any other object, by turning on Snap to Grid in View → Snapping.
But again, if you resort to doing this, you might as well use some other level editor to get the results you need, because this is a hella broken use of Tiled that forces you to bypass most of the features that make Tiled useful.
What are you trying to achieve, specifically? What are these special properties you want to attach to tiles, and why? Perhaps I or other users can suggest a better way than abusing Tile Objects.
I think it goes a bit far to call this a broken use of Tiled. Tile objects are very much part of Tiled’s feature set and much effort has gone into making them somewhat comfortable to work with. What other level editor would you use in this case?
Whether using tile objects is slow or not entirely depends on your use-case and implementation.
That said, indeed the tile layer specific tools like the stamp brush and filling tools don’t work on object layers. Tile objects can currently only be placed individually, apart from using copy/paste. Depending on your level editing needs this can mean a hit in productivity. In the next Tiled release, it will be possible to alleviate this by scripting custom tools.
It is hyperbolic, I agree :'D I suppose I was just trying to drive home the point that Tile Objects are not “regular tiles with properties”, but rather something very different, and that OP should carefully consider alternative solutions before committing to such an approach. Besides the productivity hit, depending on their engine/importer, the approach could also mean a big performance hit for their project, since without a specialised implementation, every tile would be an Object with the associated additional storage, read, and draw costs.
I don’t have a level editor suggestion, I suppose that would depend on what specifically OP is trying to achieve and what other tools they’re using. I suspect whatever it is can be done in Tiled without resorting to hundreds of Tile Objects.
If they’re going to be placing all these tiles by hand, chances are using their engine’s built-in tools would save time in the long term by avoiding importing, or perhaps they’d be better off building a small tool that does nothing but add custom per-tile properties to their Tiled map file with a UI specialised to their specific needs. It would be a time investment, but I think it would be a smaller time investment xP (If they want custom per-tile properties, then presumably they have the programming expertise to get their project to read them. Making a tool to write these properties would not be much more difficult.)
Holding down Ctrl should snap the objects to the grid.
sorry to necro this post but I came across it today researching Tiled objects and how to associate more data on tiles and after reading this thread/after some consideration and experience in working with Tiled so far I think OP would agree with my sentiment on this regard that Tiled needs a “tile data” layer type that lets us plant tiles that can simply contain more data about the given cell.
They would work same as placing a regular tile in your map ie- you can use a tile from a tilesheet or alternatively you could simply use a blank tile since the main graphical tile may already be placed already in a normal Tiled layer (in this case, for blank tiles Tiled UI would let you choose a solid/semi transparent fill color )
That way OP and others dont need to get confused or get perplexed about why objects/object layers dont allow tiles
OP can simply create a Tile Data layer and be on his way
Oh and then the main feature in Tiled editor UI for these new data tiles (in map editing mode) is that you get the same Custom Properties panel as you do in tilesheet edting mode.
The difference is that edits in map editing mode don’t apply to your tilesheet. Creating and settting properties in map editor mode for data tiles applies the data to the map only.
If there has since been a feature like this since been added to Tiled or is actively in development let us know. Otherwise i might open a tracker issue to lobby for it (or dig into the codebase a bit deeper)