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

Allow tinting of a tile/object #3950

Open
Quillraven opened this issue May 21, 2024 · 8 comments
Open

Allow tinting of a tile/object #3950

Quillraven opened this issue May 21, 2024 · 8 comments
Labels
feature It's a feature, not a bug.

Comments

@Quillraven
Copy link

Quillraven commented May 21, 2024

Is your feature request related to a problem? Please describe.
I am using Tiled also as an "object editor" for my game. My workflow is:

  • Create a tileset with a collection of images
  • Add an image to the tileset (e.g. the first frame of the idle animation of a game object like the player)
  • Use collision editor to create Box2D fixture definitions
  • Assign a class to the tile to add game properties to it, like damage, speed, ...

One of the properties is a color because it is possible to tint a specific game object. From what I know, this is currently not possible.
You can set a color for the class, which is not correct in my case because it is a general class for all game objects.
You can set a color on an object layer which is also not correct because I need a color for a specific object that is related to a specific tile of a tileset.

Describe the solution you'd like
Ideally, we can have a color attribute for a class with a specific key that will be used for tinting and which is then also considered for the tile rendering in Tiled (tile in tileset + object on objectLayer).
Maybe "tintColor" as a key or just "tint".

Since you can theoretically have multiple color attributes for a class, Tiled somehow needs to know which color it should use for tinting. That's why a special key might be useful or a separate property type "tint color" that can only be added once to a class.

Describe alternatives you've considered
I think there are no alternatives?

@Quillraven Quillraven added the feature It's a feature, not a bug. label May 21, 2024
@eishiya
Copy link
Contributor

eishiya commented May 21, 2024

Perhaps I misunderstood what you meant by "considered for the tile rendering in Tiled (tile in tileset + object on objectLayer)", but if you want all instances of a tile tinted, wouldn't it be better to tint the tile in its image instead?

It's worth noting that class colour is NOT a tint colour, so even if you assigned unique classes to each Tile Object, they'd not be tinted those colours. Class colours are mainly used to distinguish non-Tile Objects from each other. Similarly, the Color attribute on Object Layers does not tint Tile Objects, it just sets the default outline colour for other Object Types.

Only the Tint Color layer attribute actually changes the appearance of Tile Objects, and it is currently per-layer. So, currently, the only way to customise your Tile Object tints in Tiled is to put the Tile Objects on layers corresponding to their tints, you'd need as many Object Layers as you have different tint colours.

I support the idea of a per-Object Colour (that is, a new attribute on Objects, not on Tiles), functioning like so:

  • On Tile Objects, tint the artwork (multiply by that colour).
  • On other Objects, override the colour from their class or Object Layer. Perhaps there could be a View or Preferences option to multiply the two colours instead, but in the scenarios people have requested per-Object colour before, I think overriding would be more useful.
  • Could be stored as just a color attribute on the Object.

@Quillraven
Copy link
Author

Imo adjusting the color of the artwork is not ideal. Imagine you have an art for a dragon in white color. Now, you want to use the same art three different times. Once for the original white dragon, a red version for a fire dragon and a blue version for a water dragon. Like "reskinning" your existing assets.

Most likely you'd solve that by simply tinting the graphic for the different dragons as this saves size on your texture/texture atlas in the game.
Also, it is way quicker to tint the graphic instead of opening your editor -> adjust the color -> save the file.

That's why imo the coloring per tile would be cool. Maybe tile is the wrong wording here. As mentioned, I am using a "collection of image" tileset in my workflow.

In the scenario above I would import the dragon image three times into this tileset. Two images will have a tint color for red and blue.
Ideally, I already see the tinted version in the tileset. Also, ideally I see the same representation in a map itself that uses the image of that tileset.

If it is still not clear, I will try to make some screenshots tomorrow but hopefully I explained it well enough :)

@eishiya
Copy link
Contributor

eishiya commented May 21, 2024

Sorry, I neglected the possibility that you might have the same base image added to a tileset multiple times - I usually work with "Based on Tileset Image" tilesets, so I'm used to it being impossible for two different tiles to share the same source pixels.

While I still think having it be an Object attribute makes the most sense because it's been a recurring request to colour non-Tile Objects independently of their class, there certainly are use cases for it on tiles in Tile Layers as well, and even those engines that implement Tile Layers as meshes can generally tint each tile separately, so per-tile tinting shouldn't be too wild of an idea... Perhaps it could be a Tile attribute as well, with Tile Objects inheriting and possibly overriding it.

@Quillraven
Copy link
Author

You actually get a warning when you add the same image multiple times to the tileset:
image

But you can say "Yes" which will add it correctly:
image

Also, the tsx file looks fine to me:

<tile id="2">
 <image width="32" height="32" source="../../raw_assets/object/frog/idle_00.png"/>
</tile>
<tile id="3">
 <image width="32" height="32" source="../../raw_assets/object/frog/idle_00.png"/>
</tile>

just as an fyi to your last comment. Otherwise, I am fine with your proposals and whatever is the easiest and best solution for you guys as well ;)

@Quillraven
Copy link
Author

Hi,

Is there an progress on this? Or what is the priority of open issues?

It is nothing critical or urgent but just interested in how long it usually takes to get something like this available.

If I can help with something just let me know!

Thank you 😊

@bjorn
Copy link
Member

bjorn commented Nov 20, 2024

Is there an progress on this? Or what is the priority of open issues?

There's currently no priority on this particular issue and no progress has been made. I think you're also the only one to request per-tile tinting, but I could be wrong. Per-object tinting has been requested (though I couldn't find an issue about it now) and I guess is even halfway implemented since it's basically an extension of the unfinished #4031 that adds per-object opacity.

That said, I think per-tile tinting would be a nice feature to add and does not conflict with per-object tinting. The eventual object tint could likely just multiply with the tile tint, like it would with the layer tint.

I do try to listen to what users are requesting, but apart from just giving feedback there's two concrete ways to prioritize an issue, which is to work on implementing it yourself or by donating on a tier that grants development time towards your request. I'm available (also on Discord) in case you have any questions about how to implement this.

@Quillraven
Copy link
Author

Thanks for the quick response! Unfortunately, I think Tiled will take quite a lot of time for me to know how to implement something and I won't have the time to help.

But again, it is nothing urgent or critical. I was just curious how things are prioritized.

And indeed I am a donator but not a huge one 😅 But I really appreciate the editor and all it can do. It is a great tool 👍 thanks for all the effort.

@LJNIC
Copy link

LJNIC commented Dec 17, 2024

I would also like this feature. Can't really find a "game oriented" editor that supports this. REXPaint, Playscii, lvllvl all have this but none of the metadata features.

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

4 participants