[Tiled] - animated tiles

Got something on your mind about the project? This is the correct place for that.


Forum rules

This forum is for feature requests, content changes additions, anything not a Bug in the software.
Please report all bugs on the Support Forums

Post Reply
User avatar
Bertram
Manasource
Manasource
Posts: 1026
Joined: 07 Sep 2004, 14:55
Location: France

[Tiled] - animated tiles

Post by Bertram »

Hi there, :)

As I've been trying to bring back interest to add animated tiles support in tiled,
-> See there: https://github.com/bjorn/tiled/issues/57

I thought it would be a great opportunity to get feedback from a mature project like TMW about the xml format specs we should use, the options/parameters not to forget, ...

Feel free to comment there if you can, I will also try to merge and comment back there depending on what is added in this topic.
Try also to remember to not over-engineer the thing and keep it simple and clean, right? ;)

Best regards,

Bertram
User avatar
o11c
Grand Knight
Grand Knight
Posts: 2262
Joined: 20 Feb 2011, 21:09
Location: ^ ^

Re: [Tiled] - animated tiles

Post by o11c »

At a very minimum, animated tiles needs (as properties on the first tile of the sequence)
  • the requested time delay between tiles. Milliseconds seems to be a common unit.
  • the number of frames before it repeats. At a minimum, this *could* be inferred from the width of the tileset, but that does limit flexibility. However, it *would* make a good default when adding an animation.
TMW also specifies:
  • the time delay for every single frame. I'm still not convinced this is useful.
  • the exact frame order. TMW does this as a sequence of individual properties, but it might be better as one property separated by commas (assuming there is an appropriate GUI). The GUI for this should include common repeat styles (forward+restart and forward+backward+restart), as well as the ability to loop arbitrary subsequences. It is easy to go from high level constructs to the frame sequence, but might be harder to go from the frame sequence to the higher-level construct. So, it *might* be beneficial to actually store the high-level construct.
I can think of one feature that is (probably) not implemented in TMW.
  • a boolean flag for an animation to terminate on the last frame instead of repeat. This only makes sense if an animation has a defined "start" and "end" time, which is likely to be engine-dependent so needn't be implemented in Tiled.
Former programmer for the TMWA server.
User avatar
Bertram
Manasource
Manasource
Posts: 1026
Joined: 07 Sep 2004, 14:55
Location: France

Re: [Tiled] - animated tiles

Post by Bertram »

Hi o11c,

Thanks for sharing thoughts about this.
- the requested time delay between tiles. Milliseconds seems to be a common unit.
the time delay for every single frame. I'm still not convinced this is useful.
I, for one, will need the time to be specified for each frame, so I'd like to see this in.
The millisecond unit is indeed a good choice in term of animation time for a game, IMHO.
- the number of frames before it repeats. At a minimum, this *could* be inferred from the width of the tileset, but that does limit flexibility. However, it *would* make a good default when adding an animation.
- the exact frame order. TMW does this as a sequence of individual properties, but it might be better as one property separated by commas (assuming there is an appropriate GUI).
Since I'll need each frame times and will need to specify as well the frames order (one frame could be reused several times with a different delay, right?), I'd be all for keeping the frames as subtags, and parse their each single properties.
The GUI for this should include common repeat styles (forward+restart and forward+backward+restart), as well as the ability to loop arbitrary subsequences. It is easy to go from high level constructs to the frame sequence, but might be harder to go from the frame sequence to the higher-level construct. So, it *might* be beneficial to actually store the high-level construct.
A GUI permitting to look at the animation could be cool, indeed. Maybe we shouldn't ask for full-fledged animation editor in the first go, though. (The amount of work would increase intensively). But I agree something showing the animation looped or not would be enough in the first place.
a boolean flag for an animation to terminate on the last frame instead of repeat. This only makes sense if an animation has a defined "start" and "end" time, which is likely to be engine-dependent so needn't be implemented in Tiled.
I don't actually remember but I thought terminator frames were implemented in mana/manaplus. A flag telling whether the animation should loop would be good indeed.

Packing all that in a starting format spec, here is an example. Feel free to point out whatever is needed:

tile_id, duration : 0 or positive integers
loop : boolean
N <animation tag>, containing 0-N <frame>
if no <frame> is given, then no animation, fallback to the original tile.

Code: Select all

<!-- This could be placed after the tile layer definition, for instance. -->
<animation tile_id="3" loop="true"> <!-- The tile id placed in the map view -->
    <frame tile_id="4" duration="75" />
    <frame tile_id="5" duration="150" />
    <frame tile_id="4" duration="75" />
    <frame tile_id="6" duration="75" />
    <!-- ... -->
</animation>
Note that the original tile_id (3) isn't used in the animation.
This is done on purpose in case the map maker wants to point out animated tiles with a special one in Tiled.

Regards,
User avatar
wushin
TMW Adviser
TMW Adviser
Posts: 1759
Joined: 18 Dec 2012, 05:56
Location: RiverBest, Brew City, Merica
Contact:

Re: [Tiled] - animated tiles

Post by wushin »

the current methodology for Animated Tiles works like this:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<tileset name="stone-lab" tilewidth="96" tileheight="128">
 <image source="../graphics/tiles/stone-lab.png" width="384" height="384"/>
 <tile id="8">
  <properties>
   <property name="animation-delay0" value="5"/>
   <property name="animation-delay1" value="5"/>
   <property name="animation-delay2" value="5"/>
   <property name="animation-delay3" value="5"/>
   <property name="animation-delay4" value="5"/>
   <property name="animation-delay5" value="5"/>
   <property name="animation-delay6" value="5"/>
   <property name="animation-delay7" value="5"/>
   <property name="animation-frame0" value="1"/>
   <property name="animation-frame1" value="2"/>
   <property name="animation-frame2" value="3"/>
   <property name="animation-frame3" value="4"/>
   <property name="animation-frame4" value="5"/>
   <property name="animation-frame5" value="6"/>
   <property name="animation-frame6" value="7"/>
   <property name="animation-frame7" value="0"/>
  </properties>
 </tile>
</tileset>
The tileset is a grid and must also contain the other animatations. The placed tile with the animation can be used in it, But I'd suggest not including the placed tile as it makes organizing the tiles/animations easier. (Look at the Evol method for their water) Basically it's easier to find a static set of tiles and map with them. then burying the tiles in the animations tiles.
IMO, doing this right means selecting the Map Tile -> right click -> animate -> select animation tiles that pop-up in a box by themselves. In the Animation box you organize order delay for each tile in set, make a preview of the animation available so I don't have to keep logging in.
Map Properties should also have a preview option. Or be able to turn off things like Animations and Map Properties like we do with layers.
As for the measure to keep time with, it should always be convertible to game time. As you can time animations to events then.
The secret to getting all the important stuff done is doing nothing.
User avatar
o11c
Grand Knight
Grand Knight
Posts: 2262
Joined: 20 Feb 2011, 21:09
Location: ^ ^

Re: [Tiled] - animated tiles

Post by o11c »

If you're going to allow different per-tile, you *must* do it based on the frame order (in the master tile), *not* the tile itself.

Otherwise you can't do: frame 0 for 10 ms, frame 1 for 10 ms, frame 2 for 10 ms, frame 1 for 70 ms.
Former programmer for the TMWA server.
User avatar
Bertram
Manasource
Manasource
Posts: 1026
Joined: 07 Sep 2004, 14:55
Location: France

Re: [Tiled] - animated tiles

Post by Bertram »

o11c wrote:If you're going to allow different per-tile, you *must* do it based on the frame order (in the master tile), *not* the tile itself.
Otherwise you can't do: frame 0 for 10 ms, frame 1 for 10 ms, frame 2 for 10 ms, frame 1 for 70 ms.
I'm also for setting the animation data in the master tile (aka separately from the actual map data) and not the map data tile itself.
And I do think Bjorn wants it that way, too.
wushin wrote:(Look at the Evol method for their water) Basically it's easier to find a static set of tiles and map with them. then burying the tiles in the animations tiles.
Could you dig an example here for reference?
wushin wrote:IMO, doing this right means selecting the Map Tile -> right click -> animate -> select animation tiles that pop-up in a box by themselves. In the Animation box you organize order delay for each tile in set, make a preview of the animation available so I don't have to keep logging in.
Map Properties should also have a preview option. Or be able to turn off things like Animations and Map Properties like we do with layers.
Sounds simple enough, indeed. And doesn't mean the tile animation data has to be part of the tile properties.
wushin wrote:As for the measure to keep time with, it should always be convertible to game time. As you can time animations to events then.
I'll be honest, everything linked a specific game should be done by the game itself, IMHO. That's not terrific to do in term of code anyway.

Thanks for all the feedback!
User avatar
Reid
Lead Developer (SoM)
Lead Developer (SoM)
Posts: 1551
Joined: 15 May 2010, 21:39
Location: Artis
Contact:

Re: [Tiled] - animated tiles

Post by Reid »

Bertram wrote:
wushin wrote:(Look at the Evol method for their water) Basically it's easier to find a static set of tiles and map with them. then burying the tiles in the animations tiles.
Could you dig an example here for reference?
https://www.gitorious.org/evol/clientda ... r-calm.tsx
"Time is an illusion. Lunchtime doubly so."
-- Ford Prefect
User avatar
Bertram
Manasource
Manasource
Posts: 1026
Joined: 07 Sep 2004, 14:55
Location: France

Re: [Tiled] - animated tiles

Post by Bertram »

Thanks Missy :)

I'll hint Bjorn about what has been discussed here.

Thanks for all the feedback!
User avatar
wushin
TMW Adviser
TMW Adviser
Posts: 1759
Joined: 18 Dec 2012, 05:56
Location: RiverBest, Brew City, Merica
Contact:

Re: [Tiled] - animated tiles

Post by wushin »

I do like Evols layout of the animated graphic in relation to the static tiles. Easy to map with and edit the underlying graphic as well.
The secret to getting all the important stuff done is doing nothing.
Post Reply