From The Mana World
(→‎Comments: unit of delay property)
m (status: red)
Line 1: Line 1:
{{Status_red}}
This is a first attempt at defining a new animation system which should improve the current behaviour of beings, especially the player.
This is a first attempt at defining a new animation system which should improve the current behaviour of beings, especially the player.
The general idea is to have an xml document defining everything about an animation. Here follows an example of what I'm talking about.
The general idea is to have an xml document defining everything about an animation. Here follows an example of what I'm talking about.

Revision as of 18:24, 12 March 2006

This article is currently only a proposal

The features or design guidelines described in this article are only a proposal made by one or some persons. It has not been evaluated or accepted by the core development team yet. Feel free to add your personal opinion about them or make counter proposals.

This is a first attempt at defining a new animation system which should improve the current behaviour of beings, especially the player. The general idea is to have an xml document defining everything about an animation. Here follows an example of what I'm talking about.

<?xml version="1.0"?>
<animation name="player">
 <images>
  <image id="0" name="misc" file="player-male-misc.png" width="64" height="64"/>
  <image id="1" name="stab" file="player-male-stab.png" width="64" height="64"/>
  <image id="2" name="bow" file="player-male-bow.png" width="64" height="64"/>
 </images>
 <actions>
  <action name="stand" image="0" frames="1"/>
  <action name="walk" image="0" frames="6">
   <frame delay="20">
   <frame delay="20">
   <frame delay="20">
   <frame delay="20">
   <frame delay="20">
   <frame delay="20">
  </action>
  <action name="sit" image="0" frames="1"/>
  <action name="die" image="0" frames="1"/>
  <action name="stab" image="1" frames="4">
   <frame delay="20">
   <frame delay="30">
   <frame delay="20">
   <frame delay="20">
  </action>
  <action name="bow" image="2" frames="5">
   <frame delay="10">
   <frame delay="10">
   <frame delay="40">
   <frame delay="20">
   <frame delay="20"
  </action>
 </actions>
</animation>

So if you want to load the playerset you just load player.xml and it takes care of loading all related images. Reuse of frames should also be considered, so we could specify the exact frames sequence. Just take the bat as an example. The standing animation as well as the walking one require 4 frames. A bat can hardly stay in flight without flapping his wings as it does now. And in the spritesheet the first 2 rows are identical suggesting one of them could be removed.

<?xml version="1.0"?>
<animation name="bat">
 <images>
  <image id="0" name="misc" file="monster15.png" width="60" height="60"/>
 </images>
 <actions>
  <action name="stand" image="0" frames="4"/>
   <frame delay="20" frame="0">
   <frame delay="20" frame="1">
   <frame delay="20" frame="2">
   <frame delay="20" frame="3">
  <action name="walk" image="0" frames="4"/>
   <frame delay="20" frame="0">
   <frame delay="20" frame="1">
   <frame delay="20" frame="2">
   <frame delay="20" frame="3">
  </action>
  <action name="die" image="0" frames="1"/>
 </actions>
</animation>

Comments

Maybe the <frame> tags should define the spriteset id and the number of the sprite inside the spriteset. That way a single animation could consist of frames from different spritesets and any combination inside the spriteset. then i don't see the reason why the number of frames has to be in the <action> tag. isn't it possible to just count the child <frame>'s? a walk animation where the middle animation phase is used twice would look that way:

  <action name="walk">
   <frame number="0" delay="20" spriteset="0" image="4" />
   <frame number="1" delay="20" spriteset="0" image="5" />
   <frame number="2" delay="20" spriteset="0" image="6" />
   <frame number="3" delay="20" spriteset="0" image="5" />
  </action>

--Crush 16:37, 12 March 2006 (CET)

Oh, and something else: it isn't mentioned what exactly the unit of the delay property is. i think the delays should be defined as milliseconds, not frames. that way the animation speed would be independent from the framerate. --Crush 16:56, 12 March 2006 (CET)