Okay.... to try and put this to bed once and for all. Here's how the animations work.
we have 4 tiles (not including 0), 2 with no anims, one with 4 and one with 16. The IDE builds up a table like this.... (so actually 23 tiles in total)
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
2,3,4,5,2,3,4,5,2,3,4,5,2,3,4,5
3,4,5,2,3,4,5,2,3,4,5,2,3,4,5,2
4,5,2,3,4,5,2,3,4,5,2,3,4,5,2,3
5,2,3,4,5,3,3,4,5,2,3,4,5,2,3,4
6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6
7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22
8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,7
9,10,11,12,13,14,15,16,17,18,19,20,21,22,7,8
10,11,12,13,14,15,16,17,18,19,20,21,22,7,8,9
|
etc
|
20,21,22,7,8,9,10,11,12,13,14,15,16,17,18,19
21,22,7,8,9,10,11,12,13,14,15,16,17,18,19,20
22,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21
So before tiles are drawn they are animated, that is the current "index" into this table is calculated once at the start, then when drawing tiles, there is a single indirection lookup into this table, regardless of whether you setup an animation or not. EVERY tile animates, but it'll probably just animate with itself. This removes the "cost" associated with animation.
The reason for the odd sequencing (2,3,4,5 then 3,4,5,2) is so that you can draw with later frames and this will automatically stagger animations in the world for you. If you have a flower waving around, then you don't want them all to wave around in sequence. You want them to look more random - staggered, This allows you to do that without having to do anything fancy at all.
Consider the alternative.
You have the animations above. Currently each tile takes up an INT only. If we were to have variable tile animations, then each tile you put down could be one of 2 anims, or no animation. This requires - per tile, an animation index, and a frame index and probably a current delay tick etc. You might be able to get by without this if animation sequences were held globally, but you'd still need the first 2. This would require at least 16bits for an animation index, and probably 9 for a frame index. 512 frames is probably a reasonable max - although someone would complain it wasn't at some point. So this leads to another 4 bytes. On top of this, each calculation and frame count would be MUCH slower, since we'd have to run over the whole map every frame - not just the tiles being drawn, but everything so that animations were seamless as they went on and off screen.
On top of this. Keeping Powers of 2, means it can easily workout these repeating sequences for frames - you just take the largest one, and it'll easily fit on a texture so you can look it up in a shader if you so wish.
Lastly.... even with these small restrictions, the new asset layer means you can still - without having to create an instance to hold an animation, place down some "detail" where ever you like - even off grid.
Every choice we made for this was done for a damn good reason, so that
1) Tiles are now lightning fast
2) Animations are not only supported - but free! You can animate every tile in the whole map, without cost or effort. It just works.
3) It's expandable into shaders for added effects.
4) Asset layers allow you to drop in non-grid aligned detail, and have it animate if you wish
5) if you need the ultimate control of code to animate, you can still place an instance and have dedicated animation control for these very rare cases.
So now you have total control over tiles, and animations. From simple "free" animations, to a little more expensive overlays, to instances for total control. You can pick whichever one you wish because you now actually have a choice of strategies.