Animated collection of images - Different sets uses same animation speed settings

What I am trying to do is to add a grass image object to Tiled which has a number of different frames for animation. So I add all the frames as separate objects into a “collection of images”. Then I pick the first frame in the collection, and choose the Tile Animation Editor. In there I add all the frames and set a wanted frame duration for them all. This works fine, but when I want to add another collection with another name but using the same images so I can set this animation to be slower than the other with a different frame duration setting, these changes reflects onto the other collection too.
I am assuming this has to do with that both collections uses the same images, despite being separated into two different collections.
Is there a way to make this work without duplicating my images and changing their filenames?

Thanks! :blush:

Alright so I noticed this only seems to happen if I place any of the images on a tile layer. If I add them to a object layer, they are behaving correctly. I’d prefer to be able to place them on either layer type and have it work though. In this specific case it’s easier to work with a tile layer.

Just tested this, this happens to me too, and it’s not just a performance issue. In my case, the second tileset had the animation faster and the faster animation overrode the slower one. This seems like a bug, perhaps Tiled is using the images as tile identifiers rather than doing it properly like it does for regular tilesets…

Fortunately, there is a workaround, and it’s actually the intended way to do what you’re doing:

Instead of using multiple collections, assign your alternate animation to a tile that was another frame of the original animation. The animation can still start with your intended frame 1, the tile the animation is attached to doesn’t have to be the first frame. This way you’ll also have an easier time telling apart the animations you’re using since they won’t be in identical-looking tilesets, but will be different tiles in a single tileset. There’s no reason to have these duplicate tilesets just for slightly different animations :]

1 Like

Awesome, thanks for the tip there. Didn’t think of being able to do that, but it makes sense. Works perfectly now. :+1:

I don’t think it’s fair to mark this one as solved yet, since there is a legitimate bug here - the behaviour you experienced shouldn’t be happening, data from one tileset shouldn’t affect another. If possible, consider changing the category of this post from Question to Bug.

I’ll leave it as solved because technically @eishiya answer solved @srosie’s issue. But yeah, this is also a bit of a bug.

Before adding tilesets to a map, Tiled tries to detect when a “similar” tileset is already part of the map, and if so, it will replace tiles in the stamp with the tiles from this similar tileset. In checking whether two tilesets are similar, Tiled currently only checks the most relevant parameters and does not do a deep comparison of tile animations, terrain definitions and other per-tile properties. So likely the tiles you’ve placed on the map have been silently replaced by those from the tileset that was already part of the map.

This replacement is somewhat historical, it was more relevant when all tilesets were embedded and should probably just be skipped for external tilesets.

2 Likes

@bjorn @eishiya As Thorbjørn mentions, I marked it as solved at it did solve my issue. Not entirely sure how it’s preferred to treat these subjects here in the forums on discourse. I am used to in other forums that one create a new bug ticket/post in the bug section when relevant and leave any other posts where they are. This too because often they want a more detailed bug report post. But it’s good to know that is a possibility here, to re-categorize when appropriate. I’ll keep that in mind for any future posts in the Tiled forum, thanks! :blush:

I’m not actually sure how it’s meant to be done here either :'D Making a second bug report post with more details seems like a good idea, but IME most people aren’t willing to do that.

I’ve just committed the following change which should avoid this issue:

Unless you were using embedded tilesets, for those the behavior stays the same for now because avoiding duplicates is more important there, even when there are small differences between embedded tilesets in different maps.

2 Likes

Great! Nice to hear, thanks for that. And no, I’m not using embedded tilesets, so it’s all good on that front.