Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to restrict layer to a single tileset #153

Open
circutus opened this issue Feb 7, 2012 · 13 comments
Open

Option to restrict layer to a single tileset #153

circutus opened this issue Feb 7, 2012 · 13 comments
Labels
feature It's a feature, not a bug.

Comments

@circutus
Copy link

circutus commented Feb 7, 2012

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.

@bjorn
Copy link
Member

bjorn commented Feb 7, 2012

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.

@KleMiX
Copy link
Contributor

KleMiX commented Feb 8, 2012

Would be nice feature indeed

@circutus
Copy link
Author

circutus commented Feb 8, 2012

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.

@Jocchan
Copy link

Jocchan commented Mar 18, 2012

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.

@bjorn
Copy link
Member

bjorn commented Mar 18, 2012

@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.

@Jocchan
Copy link

Jocchan commented Mar 18, 2012

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.

@Niffy
Copy link

Niffy commented Apr 16, 2012

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.

@eishiya
Copy link
Contributor

eishiya commented Mar 26, 2021

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:

  1. 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.
  2. 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.

@bjorn bjorn changed the title [preferences] one tileset per layer Option to restrict layer to a single tileset Mar 29, 2021
@kisnardonline
Copy link

I want this feature so badly :)

@eishiya
Copy link
Contributor

eishiya commented Jan 16, 2024

This feature has been requested again on Discord, by jseb.

@darkuranium
Copy link

I'd also like this. In my case, it's a separation between front vs back tiles, where back ones have a different tileset.

My $0.02 on above questions:

  1. How should Tiled determine which tileset to limit the layer to?

Layer properties exist, and I'd prefer a manual setting to automated. Something like a string with a tileset name per line or similar would work. Or if "special" type is added for this, not unlike parallax offset, which has a float[2], normally not available as a custom property.

  1. What should Tiled do with layers that already have tiles from multiple tilesets?

I'd argue warnings + a wizard makes sense.
I would not simply implicitly start allowing additional tiles, though setting up allowed tilesets manually makes this a moot point anyhow (since there's no automation to begin with).

@eishiya
Copy link
Contributor

eishiya commented Sep 20, 2024

though setting up allowed tilesets manually makes this a moot point anyhow (since there's no automation to begin with).

I don't think it's moot, since even manually, one can set up this limit after already adding a bunch of tiles from other tilesets.

@SbNanduri
Copy link

I just started using Tiled yesterday and this is the one feature I've been missing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature It's a feature, not a bug.
Projects
None yet
Development

No branches or pull requests

9 participants