Friday, June 13, 2014

Development update #1

I decided to rename the project from "Habit Media Engine" to just "Habit Engine".

Development has had its ups and downs.  



First, the good news:

1.On the near horizon, the next release of Unity includes a new GUI system, which I should be able to leverage to really improve the UI.
2. Entry on Enter is working.
3. Task colors partially work.
4. Checklists work, though adding and editing them has not be implemented, and their ui could use some work(see #1).
5.  I tested builds for Android and Iphone using "Good ol' Sockets" and they both worked, though the UI would need to be changed for mobile(see #1) and the performance needs to be improved.
6.  I added a 3d character with animations that trigger during certain events.  When a positive habit is clicked, or a daily or todo is checked, the character smiles.  When a negative habit is clicked, or a daily or todo is unchecked, the character frowns.  When you reach a new level, the character jumps.(For more information, see the end of this post)



Next, the bad news:

Currently, there is a bug in Unity's mono ssl runtime that prevents  Habit Engine from communicating with the HabitRPG server.  HabitRPG's certification used a different algorithm until they updated it.  The bug does not exist in Unity 5, but Unity 5 probably won't be released until sometime in 2015.  I'm currently not sure what to do to resolve this in the meantime.  I've created a bug report, and even a pull request, and I'm not sure if there is much else I can do.  This bug is the only thing that prevents me from making a second release.  It also breaks the first release.


More on Character Animations


I spent a lot of time working on importing 3d animations into Unity.  I used a character I had previously made called "Piggly", because I thought that would make the process much simpler and quicker.  Piggly is not a biped.  He's more like a blob with eyes, ears, nose, and mouth.  Supposedly, bipeds are much easier to work with in Unity.

 I created him at a Skills USA National competition, for a short film.
Bad Piggies Director's Cut from Stewart Martin on Vimeo.


I imported Piggly, with a morpher(3dsMax equivalent of blend shapes) and a stretch deformer from 3dsMax.  I then found out that Unity doesn't support deformers.  Additionally something about the morpher was causing the skin to be affected by light differently.

So, I abandoned 3dsMax, imported my meshes into a single Maya scene, made new textures, and tried again.  All of the blendshapes and the main character shape in Maya were simple low poly with a quick smooth applied.  Turbosmooth  with a morpher, from 3dsMax, imports properly into Unity(except for the problem above) but quick smooth from Maya does not.  In Maya, you can use a smooth mesh on the main shape, and it will properly apply the vertex changes to all of the blend shapes, but in Unity, this causes terrible distortions in the skin.

Because of this,  in Maya, I had to apply a smooth mesh, and then remake the blend shapes from scratch using the higher poly meshes.  I did this quickly, and the results were not as good as the previous blend shapes.

After doing a little research, I read that the best way to do squash and stretch on a character in Maya, for use in Unity, was to create a squash and stretch rig like the one outlined in the tutorial here.  So, I spent hours following the first 6 tutorials, and then followed them a second time, applying those steps to my own character.  After creating a jump animation and importing it into Unity, there was a(nother) terrible distortion in the skin, because Unity doesn't support scale compensation.


At this point, I had spent many hours, and the majority of that time was spent trying to import a simple squash and stretch into Unity.  It was then that I realized that, all along, I could have just animated the scaling by hand, and baked the animation.  The scaling is not mathematically accurate for squash and stretch, but it does the job.

After that, I worked on triggering the animations in Unity.  Eventually I was successful using the "legacy" rig type.  I posted an explanation of the process to Unity Answers here.  However, when I first finished the animation didn't work.  It wasn't until I realized I needed to assign my script, that was calling the animations, to the object that owned the animations that it finally worked.

I live streamed some of this process on twitch.  I made a highlight video of the moment I figured it out.  The epiphany happens at 1:15.  I still had to fix a few bugs, but I got it all working.  The pig finally jumps at 4:19.

I would like to create new animations involving bipeds, but I haven't found or created a biped that I want to use.  I'm working on that.

Bonus picture:  I imported the maya piggly rig into 3dsMax, and it looks funny.
Dat Chin Tho



No comments:

Post a Comment