Thursday, March 19, 2009

Avatar Core

I'm naming the new avatar framework Avatar Core. It will be (isn't yet) hosted on Google Code under MIT, just like My Avatar Editor. In fact it will essentially be under the My Avatar Editor umbrella, using www.myavatareditor.com as its home page - of sorts.

I've got a new, very simple Avatar Core demo online using a couple of the Mii character assets from My Avatar Editor. Like My Avatar Editor, it consists of two SWF files, the editor (seen in demo link), and the viewer. The editor loads the viewer, reads its definition (which it, in turn, loads from this XML file), and provides appropriate selections. Both the editor and the viewer were written in less than 100 lines of code each (not counting the Avatar Core framework). Because of the flexibility of this framework, you could potentially grab these SWFs now, put them on your server, and use your own XML definition and graphics to completely change the avatar and all of its features including what it displays and what it could potentially display as well as the options provided in the editor interface.



There have been a few changes in the XML since the last post. The most important are a couple of new features including default transforms and parent definitions. A transform represents how an avatar feature looks (position, scale, rotation). A default transform lets you specify a start transform when a feature is added to an avatar for the first time. Not a big deal, but helpful in terms of having these settings defined in the XML. Before, transform properties were only defined directly within avatar features. Now they exist within a separate transform object.

Parent definitions are definitions that another definition is attached to. Consider an earring on an ear. Both are separate features, but if an ear moves up and down the side of an avatar's head, that earring should follow it. By specifying the ear as being a parent to the earring definition, when the ear moves, so will the earring.

There have been some other naming changes and enhancements to reduce XML verbosity as well. I'm not sure if this will be the final format, but I think it's looking pretty good right now.

Moving forward I'll probably focus on more avatar/editor examples using more features (such as constraints and colors). This will hopefully also flush out any bugs if they exist.

6 comments:

Jenny said...

Love the avatars but you don't have any RED HAIR option. (You've got black, brown, blonde, and grey but no red.)

senocular said...

@Jenny: The avatar features in My Avatar Editor match those found on the Mii Channel on the Nintendo Wii. If the Wii has no red hair (and it doesn't), neither will My Avatar Editor.

Anonymous said...

hey there

FANTASTIC coding!! I'm working on a school website and think this will work great ... but want of course to go one step further.

Is it possible to add more than one mii on a page at once and also auto change the xml file on page load for both miis?Thanks

Jonathan

senocular said...

Hi Jonathan,

In terms of My Avatar Editor, you can load as many instances of the character swf (myavatarcharcter.swf) in a page or swf as you want. From that, you can set the mii hex value or URL for that instance loaded by normal means as described on the developers page.

Avatar core, however, cannot handle Mii characters. Some behaviors like shared color sets or features changing with other features aren't supported. They could be hacked in, but it would be messy and kind of goes around what the framework does for you. It's possible the framework could be extended so support those situations, but I haven't yet decided if I want to go through with doing that. The implementation could be ugly. The sample on this post just uses some of the my avatar editor mii assets to show off the framework. The full mii feature set isn't included (and the reason for that is because, currently, it can't be).

Does that answer your question?

Anonymous said...

thanks for such a quick response.

i tried to load several xml files depending on which mii characters i wanted on the page but when i used the setAvatarXML function to change it it wouldn't work for some reason if there was more than 1 mii on a page.

basically i want to do a few things - have profiles of teachers on a page with their corresponding Miis which are dynamically loaded from each teacher's xml file. Also i would love to have a mii chat area!

not too sure if i can post code here but i really appreciate your help or advice

thanks
Jonathan

senocular said...

Jonathan,

We can continue this through email. Mail me at senocular at hotmail dot com.