Tile Animations (#4636)


I’m shocked that Defold doesn’t have a built-in method of animating tiles on a tilemap. This is a basic feature of every tile map system out there. Actually Defold does have animated tiles, but for some reason they work perfectly well in the tilesource preview window, but not in the actual build…? Like if tile animations already work, did someone just forget to play them when they’re drawn on screen?

Not sure why people are creating workarounds and such for this. Also not sure why this isn’t part of Defold yet. Very… dumb. Just my two cents. I think this should be given top priority, considering how important it is and the fact that it’s already implemented in the tilesource preview. I get that there may be some underlying difficulties that the Defold team is aware of, but it’s hard to believe.

1 Like


There is at least one: should the collision shape of the tilemap also change as the visual representation changes?

Another is if the tile source animations should play immediately or if there should be a function that starts the animation. Should the function start the animation on a single tile or should it start animations on all tiles on all layers? You seem to have experience with other engines. How does it work in those?



I don’t think I’ve ever heard this request before to be honest.

There are many users requests that have top priority, and we’re constantly revising our list of tasks to do.
WIth that said, the list is of course very long, and we cannot always cater to everyone, or as fast as they would like.

Might I also take the time to ask you to dial the tone back a little bit?
We strive for a forum that is friendly and welcoming to everybody.
We of course understand that some issues might be frustrating,
but there is always ways to express yourself politely.



It has come up a few times over the years:

2016 - Is it possible animate tiles in tilemap?
2018 - Animated Tiles in the Tilemap
2019 - Animated tilemaps
2019 - A year with Defold (under “Some feature requests:”)

But it’s not that hard to do it with a script (just not very convenient), which is probably why it never stood out and got priority.



Thanks you @ross.grams.
My memory clearly failed me here.

I couldn’t find anything related amogst the current issues, so I added it as # 4636



I don’t mean to sound rude! Difficult for me to get the tone right in plain text.

Yes, I am just trying to emphasize my surprise that a seemingly (in my view) very simple feature of tilemaps doesn’t exist yet in Defold. After all, playing a game on a static-looking stage seems like it would sometimes hinder the immersion.

I understand there are many other issues to look into and that animated tiles aren’t the bane of Defold’s existence or anything like that. Again, no negative judgement towards the folks on the Defold team. You guys always do a good job from what I’ve experienced. :slight_smile:

…But yeah. Animated tiles. Please look into this.



Animated tiles/sprites can be easily added with a layer above your tilemap with separate animation atlases and all the features. Guess tilemap in a current version is too far from having all the functions the overall engine has. Judging by how tilemap addresses tilesource, I think adding animations might take a serious conversion.

Plus with the next update there should be a sprite trimming… not sure if it should be a top priority, but definitely crucial feature for a 2D engine too. =)

PS And tilemap definitely needs some kind of tilemap.clear(tilemap, layer) feature. =)



To clear an entire layer? And because iterating over the tilemap clearing individual tiles in a layer is slow?

1 Like


Not sure if it can be any faster (we’re aiming for PC mostly), but it might save us a few dozens lines of cycles. =) We use 3 tilemaps with multiple layers both logic and visual. Possibly just resetting some of those layers to zero might be useful. Few layers for pathfinding getting renewed quite often for example.



I would suggest that you start with a utility function to do this work and if it is having a negative impact on performance we’ll discuss adding it as a native engine API function. We try to keep the Defold API as small as possible. Every API function we add will add a little bit of size to the engine and we really want to keep the engine as small as possible. Not everyone would have a need for a tilemap.clear() function but everyone would be affected by the increased application size.

1 Like


Thank you, britzl! As always.

Tilemaps are a great tool, so just can’t stop imagining all the features that can be added to it… Clearing function is absolutely not something we can’t go on without right now.

PS …unlike sprite trimming. Our 2048*2048 atlases are ready for .165 Can’t wait. =)



Oh, hold on. The first step is the rendering that will leverage polygonal sprites (to increase performance). The texture packing is still going to be based on rectangles. The next step is to also pack the atlas better (to reduce disk and runtime memory).



that is absolutely enough for now
Just an illustration on how much we’re waiting for it)