From The Mana World
m (status: red)
(Version 0.2)
Line 1: Line 1:
{{Status_red}}
{{Status_red}}
This is a first attempt at defining a new animation system which should improve the current behaviour of beings, especially the player.
After a mini-meeting between me and Doener we refined the model.
The general idea is to have an xml document defining everything about an animation. Here follows an example of what I'm talking about.
Each animation will be defined by an xml document, here follows an example:


<pre>
<pre>
<?xml version="1.0"?>
<?xml version="1.0"?>
<animation name="player">
<animation name="player">
<images>
<spritemap name="misc" src="player-male-misc.png" width="64" height="64" />
  <image id="0" name="misc" file="player-male-misc.png" width="64" height="64"/>
<spritemap name="stab" src="player-male-stab.png" width="64" height="64" />
  <image id="1" name="stab" file="player-male-stab.png" width="64" height="64"/>
<spritemap name="bow" src="player-male-bow.png" width="64" height="64" />
  <image id="2" name="bow" file="player-male-bow.png" width="64" height="64"/>
   
  </images>
<action name="stand">
<actions>
<frame spritemap="misc" index="0" delay="0" />
  <action name="stand" image="0" frames="1"/>
</action>
  <action name="walk" image="0" frames="6">
  <frame delay="20">
<action name="walk">
  <frame delay="20">
<frame spritemap="misc" index="0" delay="20" />
  <frame delay="20">
<frame spritemap="misc" index="1" delay="20" />
  <frame delay="20">
</action>
  <frame delay="20">
  <frame delay="20">
<action name="bow-attack">
  </action>
<sequence spritemap="bow" start="0" end="5" delay="20" />
  <action name="sit" image="0" frames="1"/>
</action>
  <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>
</animation>
</pre>
</pre>


So if you want to load the playerset you just load player.xml and it takes care of loading all related images.  
So if you want to load the playerset you just load player.xml and it takes care of loading all related images. Of course delays are defined in milliseconds.
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.
 
<pre>
<?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>
</pre>
 
== 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:
<pre>
  <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>
</pre>
--[[User:Crush|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. --[[User:Crush|Crush]] 16:56, 12 March 2006 (CET)

Revision as of 10:18, 14 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.

After a mini-meeting between me and Doener we refined the model. Each animation will be defined by an xml document, here follows an example:

<?xml version="1.0"?>
<animation name="player">
	<spritemap name="misc" src="player-male-misc.png" width="64" height="64" />
	<spritemap name="stab" src="player-male-stab.png" width="64" height="64" />
	<spritemap name="bow" src="player-male-bow.png" width="64" height="64" />
 
	<action name="stand">
		<frame spritemap="misc" index="0" delay="0" />
	</action>
 
	<action name="walk">
		<frame spritemap="misc" index="0" delay="20" />
		<frame spritemap="misc" index="1" delay="20" />
	</action>
 
	<action name="bow-attack">
		<sequence spritemap="bow" start="0" end="5" delay="20" />
	</action>
</animation>

So if you want to load the playerset you just load player.xml and it takes care of loading all related images. Of course delays are defined in milliseconds.