From The Mana World
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Implementation of hairstyles by Modanung

I think the current system with an xml file for every hairstyle with an index and offset defined for every frame is a bit too much. It also takes a lot of work to correct small errors and to add new hairstyles that may have a different frame size and with it a different offset. I suggest we split hairstyles up in three catagories:

  • Static hairstyles
  • Standard animated hairstyles
  • Special case hairstyles

On top of the current system we need a variable that defines which gender can use which hairstyles, in every hairstyle's xml-file.

Static hairstyles

These are hairstyles which only have one frame for each direction and death, so five. All current hairstyles would be static hairstyles. Every individual static hairstyle needs nothing more to be defined then their bitmap, their size and their offset for each direction. The offset for each seperate frame would be defined in a shared file (say hairoffsets.xml), this summed with the individual hairstyle's offset is the offset for that single frame with that hairstyle.

hairstyle1.xml

<offsetfile="hairoffsets.xml", framefile="static_hairstyles_frames.xml">
<sprite variants="10" variant_offset="5">
<gender="male">

	<imageset name="base" src="graphics/sprites/hairstyle1.png" width="40" height="40" />
	<offsetX="0" offsetY ="0" />

hairoffsets.xml

<action name="stand" imageset="base">
		<animation direction="down">
		  <offsetX="0" offsetY ="-29" />
		</animation>
		<animation direction="left">
		  <offsetX="-1" offsetY ="-29"/>
		</animation>
		<animation direction="up">
		  <offsetX="-1" offsetY ="-25"/>
		</animation>
		<animation direction="right">
		  <offsetX="1" offsetY ="-29"/>
		</animation>
	</action>

	<action name="walk" imageset="base">
		<animation direction="down">
		  <offsetX="0" offsetY ="-28" delay="75"/>
		  <offsetX="0" offsetY ="-29" delay="75" />
		  <offsetX="0" offsetY ="-29" delay="75" />
		  <offsetX="0" offsetY ="-28" delay="75" />
		  <offsetX="0" offsetY ="-29" delay="75" />
		  <offsetX="0" offsetY ="-29" delay="75" />
		</animation>
...etc...

static_hairstyles_frames.xml

	<animation direction="down">
	  <frame index="0" />
	</animation>
	<animation direction="left">
	  <frame index="1" />
	</animation>
	<animation direction="up">
	  <frame index="2" />
	</animation>
	<animation direction="right">
	  <frame index="3" />
	</animation>
	
<action name="dead" imageset="base">
	<animation direction="default">
		<frame index="4"/>
	</animation>

Standard animated hairstyles

These are hairstyles that can be compared with hair in SoM or Chrono Trigger, they move as you walk and attack. They have three frames for each direction and death, so thirteen frames all together. These three frames can be devided in a relaxed frame and two extremes. Those two extremes either being up and down or left and right, depending on the hair style. A heavily greased Evil look would wobble up and down as you walk and a pony talk would wave from left to right. Standard animated hairstyles hairstyles use the same offset as static ones only they have a different file for defining the frames. hairstyle2.xml

<offsetfile="hairoffsets.xml", framefile="animated_hairstyles_frames.xml">
<sprite variants="10" variant_offset="13">
<gender="both">

	<imageset name="base" src="graphics/sprites/hairstyle2.png" width="40" height="40" />
	<offsetX="0" offsetY ="0" />

animated_hairstyles_frames.xml

<action name="stand" imageset="base">
		<animation direction="down">
		  <frame index="0" />
		</animation>
		<animation direction="left">
		  <frame index="3" />
		</animation>
		<animation direction="up">
		  <frame index="6" />
		</animation>
		<animation direction="right">
		  <frame index="9" />
		</animation>
	</action>

	<action name="walk" imageset="base">
		<animation direction="down">
		  <frame index="0" delay="75"/>
		  <frame index="1" delay="75" />
		  <frame index="1" delay="75" />
		  <frame index="0" delay="75" />
		  <frame index="2" delay="75" />
		  <frame index="2" delay="75" />
		</animation>
...etc...

Special case hairstyles

And then there are the odd ones, the hairstyles that need a little more freedom. Hairstyles that people want to make wave in the wind, even when the player stands still. Or a birdnest hairstyle with nestlings that constantly open and close their mouth in a random frequency nomatter what you do. I'll take as example a Medusa hairstyle.

hairstyle3.xml

<offsetfile="hairoffsets.xml", framefile=0>
<sprite variants="10" variant_offset="13">
<gender="female">
<imageset name="base" src="graphics/sprites/hairstyle3.png" width="50" height="60" />
<offsetX="-5" offsetY ="-10" />

	<animation direction="down">
	  <frame index="0" delay="100"/>
	  <frame index="1" delay="100"/>
	  <frame index="2" delay="100"/>
	</animation>
	<animation direction="left">
	  <frame index="3" delay="100"/>
	  <frame index="4" delay="100"/>
	  <frame index="5" delay="100"/>
	</animation>
	<animation direction="up">
	  <frame index="6" delay="100"/>
	  <frame index="7" delay="100"/>
	  <frame index="8" delay="100"/>
	</animation>
	<animation direction="right">
	  <frame index="9" delay="100"/>
	  <frame index="10" delay="100"/>
	  <frame index="11" delay="100"/>
	</animation>
	
<action name="dead" imageset="base">
	<animation direction="default">
		<frame index="12"/>
	</animation>

This hairstyle showes a bunch of snakes on your head that always wave 'n wobble unless you're dead. The animation rolls asychronusly with the attack and walking animations and it also moves when you stand still. But the offsets are in sync. Special hairstyles might also use their own offsets ofcourse I think this pretty much finished my proposal.