tiled
tiled copied to clipboard
Option to restrict layer to a single tileset
Cocos2d only allows one tileset per tile layer. It is very easy to accidentally click the tile stamp tool on the wrong layer and it can be difficult to undo the problem if it is not noticed immediately. What is worse, Cocos2d can not recover from this problem and completely fails to load the tileset.
I would like to request a checkbox option in preferences to enforce "one tileset per layer". After a given tileset has been used in a layer, then an error dialog will appear if the end user tries to use a different tileset with that layer.
There was also a plan to be able to associate a layer with a tileset, so that when switching to that layer, Tiled will automatically jump to the right tileset.
Would be nice feature indeed
Sometimes one would need multiple layers to use the same tileset, for example if we have an expansive map and for performance reasons can only display X regions at a time (one region per layer). Please take this use case into consideration.
Or one can use a common tileset for universal tiles, together with level-specific ones, not to have to duplicate the common tiles in each. Being able to use more than one tileset in the same layer can be a pretty useful feature, please take it into account.
@Jocchan Using more than one tileset in the same layer is already possible. The problem is that cocos2d-iphone does not support this, so this issue is about adding an option to Tiled to limit the user to one tileset per layer, to prevent him from creating maps that won't work with cocos2d-iphone.
Oh, I know it's already possible. I guess I misread your comment, as it looked like you were planning to add the restriction of one tileset per layer, more than the option of doing so. My bad.
The same goes for Andengine, it uses a sprite-batch to draw the tiles, so its only possible for a layer to use 1 tileset at a time, so its not really a problem if you manage the tile sets correctly.
You could easily get around this by modifying the code to plonk all the tilesets in the same texture region on a layer, but is a disadvantage because you're using up resources.
But as a feature for Tiled it would be quite nice.
Musing on this, as this is a feature I'd quite like for my own projects. If all the tiles are in a single tileset, I can use a single batch draw call to draw the whole layer, and it would be very useful to enforce this in the editor. For now, I'm instead enforcing limitation of one tileset per map because it's much easier to keep track of.
It would be most convenient if the layers in the TMX/JSON map files included a reference to the tileset they use. It would suck to have to figure out the tileset for each layer by finding a non-empty tile and checking its gid. Since these formats provide a list of tilesets, this reference could just be an index into that list.
Since Tiled has gotten Projects since this issue was created, I think this should be a Project setting rather than a Preferences one.
In Tiled itself, there are two major challenges for this feature:
- How should Tiled determine which tileset to limit the layer to?
- I guess it makes sense to go with whatever the first tile placed was. When stamping multiple tiles at once on an empty layer, the topleftmost one could be it.
- However, it may be desirable to explicitly set which tileset to use on a particular layer? Maybe I'm overthinking though; I don't need to set it explicitly myself.
- What should Tiled do with layers that already have tiles from multiple tilesets?
- Tiled can raise Warnings in the issues panel when opening and saving maps that don't conform to the limitation, but that doesn't help the user make their maps conform.
- A clean-up wizard/action could be added, but it would only make sense when this option is enabled, and would confuse users who don't have it enabled.
- Should layers that already have tiles from multiple tilesets still attempt to limit what tiles are placed on them?
Additionally, Tiled will need to communicate when a brush contains some tiles that will not be allowed to be placed. I think it would be intuitive if it showed the allowed tiles with the default brush preview highlight, and the disallowed tiles with the red highlight you get when trying to paint on a locked layer.
I want this feature so badly :)
This feature has been requested again on Discord, by jseb.