Thursday, November 29, 2012

Battle Maiden Part 2

Day 2: Saturday

Fixed shoulder joint twisting.


Had to leave early because like mentioned, it suddenly turned out to be cleaning day.

It turns out Saturday was also when the meetup for the Game On! Philippines 2012, a game development competition for students. Me being one of the mentors for the participants, and that day was when the participants would meet with the organizers to show progress on their game, I attended the meeting to talk with the participants.

I'll talk about that some other time, but long story short, I wasn't able to do much progress on day 2.

Day 3: Sunday

Got things set up back at home. It's kinda hard to get back to the rhythm since the 48 hour hackathon didn't push through.

Suddenly I'm having crash problems with my Unity.

Every time I click "Apply" on changed prefab settings, there seems to be a 2 out of 3 chance that Unity will crash.


I guess it's because I'm using an old version, 3.5.5f2. So I tried finding 3.5.6, the latest one in the 3.x versions.

The official Unity site, for some reason, doesn't show the links to older versions of Unity. Since Unity 4 is out, this means there's no links to any 3.x versions.

I had to find it from the forums, and even the site had problems.


Dark forces are at play here.

When I finally got to it, the download is slow, as expected. Oh Asian Internet, you so crazy.



It would have been nice to just press Ctrl+S in the Unity editor and be assured that everything was saved in case a crash happens again.

Unfortunately, this isn't the case. When you change settings in prefabs, or GUI skins, or ScriptableObject files for example, Unity holds off saving the changes to the disk until you quit Unity. So I find myself closing and opening Unity after every significant change I make.


Meanwhile, I got the Locomotion system working a little more smoother and I got to test the player model in the game.



Times like these I wish we had motion capture studios. I heard you can use a Kinect as a low-cost makeshift motion capture device.

Day 4: Monday

Have I mentioned that I go to the office only when I feel like it? Yeah, so Monday will be devoted to finishing this, because I say so.

Day 5: Tuesday

Have I mentioned I rarely ever get any work done while at home? Yeah, so I slept all day long yesterday. But I was able to test attack animations today.





Also, seems like the version update for Unity got rid of the crashes.

Day 6: Wednesday

I did a few thumbnail sketches so I wouldn't forget what animations I wanted to do. I should've done this earlier.


Right now the game is sort of on-hold as Wednesday is usually the time I go to the office.

Wednesday, November 28, 2012

Battle Maiden Part 1

In the small game development studio I work in, I wanted to have what we ended up calling "Free Fridays": Every first Friday of the month, everyone stops doing work for clients and make personal projects. At the end of the day, you show your work to everyone.

This was an excuse to find the time to do crazy ideas that we get every now and then.

One such idea came to me when I was about to sleep, I just thought all of a sudden "Damn it, I want to play Assassin's Creed style combat right now on my Android tablet."

I thought, yeah that could work. I actually like the easier, free flow approach in Batman: Arkham Asylum. Batman can dart from one end of the arena to the next so easily, hitting opponents here and there.

H-Here We Go


So when our Operations Director mentioned we forgot to do Free Fridays again for this month, I thought I'd do that idea.

I also requested that Free Friday be lengthened to 48 hours (up to Saturday), since the idea I had was a lot of work. Game jams are mostly 48 hours anyway.

Even with the extended duration, I knew I had to cheat a little. I'm only one guy doing both code and art so 48 hours was probably still not enough.

Day 0: Wednesday-Thursday


I stole some time from work to prepare the 3d models I'd use. For the enemy I used the soldier model I already made from before.



For the player, I used MakeHuman to create a base mesh, then added hair and clothes in Blender.

I did this with the understanding that I'm making a throwaway model just so I can finish this as soon as possible. While her face shouldn't be anime like my old sketches, it shouldn't be the one that MakeHuman comes with either.



I downloaded a bunch of Assassin's Creed 2 and Batman Arkham Asylum YouTube videos for reference.



The idea was that we'd start at 00:00 of Friday and end at 23:59 of Saturday, to really squeeze the 48 hours. It wouldn't be wise to extend to Sunday, and the higher-ups didn't want us to start earlier than Friday.

So by about 1 AM of Friday, I was still preparing the player 3d model. I had a headache and felt like vomiting (as always when I stay too long in the office), so I had to sleep it out.

Day 1: Friday


By morning I was ready to tackle it on.

This was my first draft for the ideas.



I thought I'd try Unity 4 with all its fancy new animation systems with the blend tree. Hopefully that would make my work easier.

As I tried getting myself accustomed to the GUI changes in Unity 4, this happens.



I can't rely on a tool that crashes, given that I have a tight deadline for this, so off I went back to Unity 3.



These were my first few tests:

I wanted a way for the enemies to figure out the path to get to the player's backside. I also wanted them to move in an encircling fashion. So I made a simple waypoint system to track the player's front, back, left, and right sides.



Next I had the enemies actually follow that path.



By afternoon, I swapped in the enemy 3d model. I used Rune Johansen's Locomotion System to make the walk animations look better. Props to Rune!



Unfortunately we were suddenly told that Saturday can't be used anymore because the office will be cleaned. I guess I just have to take my work home or something.

To tell the truth though, not a lot of people in the office was taking Free Friday very seriously. Some understandably still had deadlines to meet and some were just playing videogames.

I actually still needed to fix the player 3d model. It wasn't even rigged/skinned yet, so I ended up taking too much time there.

I wanted a lot of fancy physics effects on the player. The skirt and ponytail should sway, and her boobs should *ahem* move naturally.

For cloth swaying, Unity has the built-in Skinned Cloth component for that and it works as expected. The interface to configure it isn't exactly great, but it works as advertised.



Doing the same thing for the ponytail would be overkill, and besides, it should move more like linked pieces of elongated chains than like a strip of cloth anyway.

I found a link in reddit that explains a simple trick, just use rigidbodies with joints on them and add some swaying motion: http://www.farfarer.com/blog/2011/07/07/unity-skeletal-ragdoll-jiggle-bones-tutorial/

The only problem was that the tutorial needed me to configure my 3d modeling software to specifically disable keyframe animation on the bones that need to jiggle. Unfortunately, no such option exists in Blender, so I just did something quick to fix it.

I made a script in Unity that detaches the ponytail's bone from the skeleton then reattach it again quickly. This would cause it to stop being moved by the skeleton's animations, while still being connected to it.

For the boobs, the wiki site has something just for that: http://www.unifycommunity.com/wiki/index.php?title=JiggleBone

The code for that needed some cleaning up and it didn't seem to work reliably at all for a 3d model created in Blender, so I took some time to fix it.

The day ended with me staring at bouncing boobs.





While I feel a little stupid for doing this, I made pretty sure the physics don't go so far as this:



Damn, I haven't even added combat yet.