Sunday, May 19, 2013

OpenInFileBrowser Code

I realized there's a debacle right now in the Unity Wiki Website over its content being under the Creative Commons License.

So to make sure there's no legal problems with using this code, here's a re-upload of my OpenFileInBrowser code for Unity here in my blog.

As always, I put this code in Public Domain as it's quite simple but good enough to be shared.


public static class OpenInFileBrowser
{
   public static bool IsInMacOS
   {
      get
      {
         return SystemInfo.operatingSystem.IndexOf("Mac OS") != -1;
      }
   }
 
   public static bool IsInWinOS
   {
      get
      {
         return SystemInfo.operatingSystem.IndexOf("Windows") != -1;
      }
   }
 
   [MenuItem("Window/Test OpenInFileBrowser")]
   public static void Test()
   {
      //string path = "/Users/Ferds/Unity Projects/BuildReportTool/BuildReportUnityProject/Assets/BuildReportDebug";
      //string path = "/Users/Ferds/Unity Projects/BuildReportTool/BuildReportUnityProject/Assets/BuildReportDebug/EditorMorel.log.txt";
      //string path = "/Users/Ferds/UnityBuildReports/";
      string path = "/Users/Ferds/UnityBuildReports/test4.xml";
 
      Open(path);
   }
 
 
   public static void OpenInMac(string path)
   {
      bool openInsidesOfFolder = false;
 
      // try mac
      string macPath = path.Replace("\\", "/"); // mac finder doesn't like backward slashes
 
      if (Directory.Exists(macPath)) // if path requested is a folder, automatically open insides of that folder
      {
         openInsidesOfFolder = true;
      }
 
      //Debug.Log("macPath: " + macPath);
      //Debug.Log("openInsidesOfFolder: " + openInsidesOfFolder);
 
      if (!macPath.StartsWith("\""))
      {
         macPath = "\"" + macPath;
      }
      if (!macPath.EndsWith("\""))
      {
         macPath = macPath + "\"";
      }
      string arguments = (openInsidesOfFolder ? "" : "-R ") + macPath;
      //Debug.Log("arguments: " + arguments);
      try
      {
         System.Diagnostics.Process.Start("open", arguments);
      }
      catch(System.ComponentModel.Win32Exception e)
      {
         // tried to open mac finder in windows
         // just silently skip error
         // we currently have no platform define for the current OS we are in, so we resort to this
         e.HelpLink = ""; // do anything with this variable to silence warning about not using it
      }
   }
 
   public static void OpenInWin(string path)
   {
      bool openInsidesOfFolder = false;
 
      // try windows
      string winPath = path.Replace("/", "\\"); // windows explorer doesn't like forward slashes
 
      if (Directory.Exists(winPath)) // if path requested is a folder, automatically open insides of that folder
      {
         openInsidesOfFolder = true;
      }
      try
      {
         System.Diagnostics.Process.Start("explorer.exe", (openInsidesOfFolder ? "/root," : "/select,") + winPath);
      }
      catch(System.ComponentModel.Win32Exception e)
      {
         // tried to open win explorer in mac
         // just silently skip error
         // we currently have no platform define for the current OS we are in, so we resort to this
         e.HelpLink = ""; // do anything with this variable to silence warning about not using it
      }
   }
 
   public static void Open(string path)
   {
      if (IsInWinOS)
      {
         OpenInWinFileBrowser(path);
      }
      else if (IsInMacOS)
      {
         OpenInMacFileBrowser(path);
      }
      else // couldn't determine OS
      {
         OpenInWinFileBrowser(path);
         OpenInMacFileBrowser(path);
      }
   }
}

Wednesday, May 8, 2013

My first time selling on the Unity Asset Store

It started with this. Someone was having trouble with his build size so I explained that thing about the Editor.log, in that it actually had info on the breakdown of your build's file size!

So I went and whipped up a simple front-end for the log's build info over a weekend.


Then I asked the forums if they'd be interested in having it on the Asset Store. A handful of people agreed. Then I thought, why don't I try selling it, maybe for just a few bucks to see what's the experience of selling on the Asset Store? We need the money anyway.

There was a discussion in a LinkedIn Unity group where someone was adamant that I should give it for free and that I'd only get a few bucks out of it. It was quite a bummer. It was a bit depressing actually.

So I set it to $2 as an introductory price and waited how it would turn out. The plan went that I'd keep it as $2 for one week then set it to the standard price.

David Helgason even retweeted my tweet about it. I guess it was like... I don't know. Stevie Wonder humming a tune you just made up? It was unexpectedly cool.

David's a pretty awesome guy.

I placed a public poll on my forum thread asking "How much would you be willing to pay for this plugin?" The choices I put where $2, $5, and $10. Majority answered $5. I guess they're not that cheap that they'd settle for the lowest price. Seems like $10 is too much too. So we figured $5 was the sweet spot.

By the end of the week I then set it to $5, only to realize that price changes do, in fact, still have to go through review by the Asset Store team. Then David again helped me out. It's quite awesome that a big company like Unity still has the time to help out the little guys using their products.

So the $2 sale went for approximately 9 days. A total of 117 people bought it during that period.

I'd shudder to think that $163 is only a few bucks. Must be there's a really high standard of living where that guy is.

Now that the selling price is $5, the amount of people who purchased is about 1/3rds lesser. I still got higher sales overall though.

It's selling quite well, for something I just whipped up over the weekend (though I do improve it every now and then). It's managed to get consistent five stars from reviews. It even got to the Asset Store front page one time.


Here's the link to the Asset Store page: http://u3d.as/4u2

Here are some things I'd like to share for my experience:

  1. If a customer previously purchased directly from you (not from Asset Store), it cannot be unlocked for them in the Asset Store for free. They have to buy it again in the Asset Store.
  2. Your publisher page is quite bare-bones. There's no sales graph or overall total sales. There's only the sales per month, and you can only view one month at a time. Switching from one month to the next is quite slow (for my Internet connection).
  3. Related to that, when a customer posts a user review, you get no email notification about it, or any notification whatsoever. You have to visit your asset store product's page every now and then to see if someone has a complaint in their review, or some misunderstanding you'd like to clear up. UT's take on this is that it's your job to facilitate communication with your customers, but something like an option for email notification in this case would be nice, no?
  4. The ways you could offer support is usually via Twitter, email, tell them that they can PM you in the Unity forums, or if you have a forum thread about your product, give them a link. You'd usually put such links in your Asset Store product page's description.
  5. I'd like to reiterate the standard warning: If enough customers complain that they are not getting adequate support from you, UT has the right to take down your product.
  6. If your product is something visual, then potential customers will like to see video demos, or web interactive demos to see an example of how your product is useful. Their mindset is: "So what's this Asset Store package? Will it be useful in the project I'm working on?" That second question is what you need to address. And you do it by showing potential scenarios of how it's used, i.e. demos.
  7. If your product is purely code instead, perhaps a video tutorial how to use it can also work. At the very least, post some screenshots. Surely there's something visually presentable that you can show?
  8. If your asset store package has code, customers will appreciate it if you separate your code into your own namespace as much as possible to avoid name conflicts.
  9. Use the lowest possible version of Unity when releasing your asset package. Since they are distributed as .unitypackage files, the version of Unity used to create the .unitypackage is also the lowest version allowed to import that file. Frankly, I think this is just a conspiracy to force you to upgrade your licenses. I keep an installation of Unity 3.5.3 in this case.
  10. Selling on the Unity Asset Store is a non-exclusive deal. I.e. you are free to sell your product via other stores (ex. gameprefabs.com)
  11. You can't verify if a person who emailed you really purchased your product just using your publisher dashboard alone. You can, however, email the Asset Store Team to verify for you if someone indeed purchased it. Dantus in the Unity forums points out email isn't necessary. All you need to do to verify if someone purchased your asset is to ask them for their Invoice Number. Then in your publisher dashboard, there's a tab called "Verify Invoice". You can type the Invoice Number there to verify someone's purchase. (For example, say, someone reported a bug. So you fix it and would like to send it to the bug reporter to test the fix on his machine. What if he didn't really purchase your product? You better verify to be safe.)
  12. Possible places you can use to advertise your asset package:
    1. Main Unity Forums
    2. Google+ Unity Community
    3. LinkedIn Unity Group
    4. Unity South East Asian Mailing List (only if you're based in South East Asia!)
    5. Unity3d Subreddit


Monday, January 28, 2013

Global Game Jam 2013

January 25, 2013. Start of Global Game Jam 2013.

I woke up at 6 PM in our home-office, still a little bit groggy. I think my fever was gone.

Global Game Jam 2013 had already started and I was two cities away from the nearest jam site. What the hell do I do?

The me back in that January 25th would never have thought that I'd bag a Best Art of Manila Game Jam 2013.



Let me backtrack for a moment.

I heard of the Global Game Jams before. I thought it was crazy to try to come up with a game in just two days' worth of time.

But last year I was invited to be a mentor in the Unity Game Jam Manila and I realized, hey, this is pretty fun. I should have participated instead.

So I determined that come 2013, I'll start joining the Global Game Jam.


Boys will be boys

It was the night before the Game Jam. We were bunking in our little home-office as usual.

For some goddamn reason, the whole apartment room started smelling like semen. Seriously man, putang ina, amoy tamod. What the flying fuck??? Is someone jacking off? We're all guys here, but there's this little thing called respect...

But it turned out it was coming from outside the window.

My friends said it was Zonrox. Here in the Philippines we have a bleach brand called Zonrox. And it suspiciously smells like goddamn semen.

Ladies and gentlemen, Exhibit A.

My other theory was that some bored neighbor was masturbating from his window. He probably kept bottles of it, judging from the strength of the smell.

I can't remember if I had my headache before or after that. Anyway I was starting to feel nauseous so I slept early.



The next morning, straight to the toilet I vomited. According to online pregnancy forums, clear and bitter vomit is just normal stomach bile.

I still had a headache so I slept the whole day.

So when I woke up, it was 6 PM, and the Global Game Jam already started.

I was still concerned for my health, so a 48 hour contest sounded risky.

I thought, no way, I want this. Leeroy Jenkins all the way!

You know I heard some people use autosuggestion to actually improve their health, like a placebo but without going through the fake meds.

I like to think Gurren Lagann was a factual story.

Anyway, I packed my stuff and through the graces of public transportation, I was able to hail a cab only after 30 minutes of waiting and overtaking my opponents for the nearest vacant taxi.




Day 1



I arrived about 8 PM I think. The people were just about to the last few pitches. I walked in, bags in tow, looking for the nearest acquaintance.

"Excuse me-- Oh yeah I just got here-- Hey, what's the theme?"

So it was a heartbeat sound.

I looked for the nearest empty table and started setting up.



The first idea I had was a character whose heartbeats physically affect the world around him.

Then I had a visual recollection of this game called Journey, which from a video, I recalled, shows that the way to communicate to your stranger friend was by pulses.

So from there I started my concept on the character.

You can easily see the influence from Journey here.

I like to start with the art even though I already had a rough idea of what gameplay I want.

Usually people would go for using capsules as placeholders for character graphics and refine their mechanics until it's good, then swap in the real graphics.

And that's really how you should do it, because you need to concentrate on refining the gameplay first.

But my brain just doesn't want to work that way, at least, at that moment.

I really need to see the guy in there. He doesn't have to be normal-mapped and everything, but just see his shape, see him walking, really makes me feel focused.

Note: Actually I did not have the time to animate him walking.



I also recalled my past idea of sound locks.

Sound locks are locks that have no tangible keyhole. Instead the lock is adorned with a figurehead of an animal.

You have to play a sound of the other animal it fears so the lock will open.

So a lock of a cat would open upon playing the sound of a dog bark. Subsequently, it would lock upon hearing the sound of a mouse squeak.




The table behind me was of a group of students. This jam site was sponsored by iACADEMY, a local college (actually the college I went to and subsequently dropped out from).

The students were kinda obnoxious. But it was likely a wrong first impression on my part.

In retrospect, I should have introduced myself. But I was not in networking-for-business mode, I was in I-need-to-finish-this-game-in-48-hours mode.

They were also understandably amateurish (well, they were still students). I could overhear them having problems over the simplest things in the Unity game engine. I did my best to stop sighing out loud. I kind-of wanted to help them, but I also needed to concentrate on my game.

I didn't want to come off sounding like a showoff also, considering I'm a one-man team competing in an otherwise roomful of teams who are mostly looking healthy in the members quantity section.

Marnielle Estrada was the only other one-man team in the jam afaik. Hats off to Marnielle for an awesome game! Check it out: Traversal.





Just being there working alone, I felt I was being obnoxious.

It made me feel like kind-of insecure, and it probably did affect my productivity in some way.

To their credit, that team behind me received the "Best Technology" award. This is their game: http://globalgamejam.org/2013/pound-pound-i-dont-want-diet

My ego is saying "Ha! One time I finished a multiplayer mecha game in under 10 hours". But well, now that, is being obnoxious.






Back on the game.

For some reason, I recalled this Unity game called Silence in the Mist. A really, really beautiful looking game with minimalistic graphics.



Screenshots from Silence in the Mist



I thought I'd follow in its footsteps and make the world of the game similar to that.

For some arbitrary reason, I thought of making the trees pulsate with life every time you emit a heartbeat near one. I just thought it made sense.

So over time, I thought of the idea that your character went into this gray, lifeless world, and use his ability of emitting heartbeats to bring back life and color.

I only realized now, the trees look like cherry blossoms and the scenery reminds me of old Japanese films. The character is even wearing a straw hat, which I really put there on a whim, and didn't really have any significance.



I, using the expression loosely, called it a day at 5 AM. I got my character walking, a camera system in place, and the pulsing heartbeat visuals.

But what exactly do you do with the heartbeat ability you have?

I was wrestling with the sound lock idea. How do you play sounds other than a heartbeat? I thought that your character would absorb other animals' sounds.

Your character's color would change to reflect it. Absorbing a meow sound from a blue cat would turn your character blue, absorbing a bark sound from a red dog would turn you red.

How do you absorb and how do you release? It felt like it's veering away from the heartbeat theme.

My internal brainstorming was going nowhere. So I slept.

I, being the free spirit I am who does not plan ahead, did not bring any means to sleep comfortably.

Get the spare t-shirts, bundle them up like a pillow on the floor, BAM. There's your bed. End of problem.

Even while trying to sleep I can hear people judging my choice of bedding.




Day 2

By Saturday afternoon, I did the Barber's Knock puzzle, which took the whole day.

It's that distinctive "tap-ta-ta-tap-tap tap tap" melody of knocking you probably already know.



The reason why it's "Barber's Knock" is because I read in a novel that it was called that way. I didn't know it had a name.

Apparently, a lot of people too. I tried Googling for more info and the best I saw was only one forum post that was asking about it. Apparently it came from the phrase "shave and a haircut, two bits!"

No one got the reference though. I guess that makes the game hipster.

In code, I used the Listener/Observer design pattern, to let objects know of incoming heartbeats the player made. The objects are quite literally, listeners.



By night I started on the sound locks, or rather, a sound gate. I just went with the standard idea I had, a cat blocking your path, wherein you need to play its opposing sound for it to stand aside.



I couldn't think of a really nice looking dog (his bark would be the "key") but I did see a really cute drawing of a small cat, so on a whim, I made a small cat whose meow opens the gate.

I probably should have used a dog instead. A dog would have been easily associated with a cat, rather than a cat with another cat.

My idea then, was that pulsing a heartbeat on an animal will bring it to life, which will then follow you around.

After that, whenever you pulse heartbeats, your animal friend will meow or bark to the tune of the beat you did.

I had the sound gate working by 4 AM I think.




I then turned my attention on the really glaring problem of what the whole place will be and how you will achieve your goal.

So the goal was to bring the world back to life. My simple idea was to have a tower at the end of the level where you do something and a shining, blinding light you activate will finally brings things to life.

Something like that. Journey had a mountain you went to, so I thought mine would be a tower.


My idea then was the player needs to search the place for three animals and bring them to the tower. With all of them there, the tower rumbles with some mechanism and activates a pillar of light of some sort, and the game ends.

The three animals would be the cat, a wolf, and an owl.

Getting to the wolf would be puzzles based on driving away sheep with the use of the wolf's howl.

I thought of the standard see-saw puzzle where you need to put things at one end to tip the platform to where you want it, but it was kinda weird to explain it in story. Why would there be sheep in a see-saw platform anyway.


I also thought of raised platforms that act as levers. This is pretty standard puzzle fare on many 3d games.

I then thought of a Sokoban style puzzle where you push flocks of sheep so you can find a way to the exit. I spent too much time on that when in the end I decided the see-saw platform was more intuitive.


All of the ideas were pretty generic puzzles that don't really take a lot of advantage of the sound mechanic, it was basically conforming the sound idea to already existing game ideas (i.e. the see-saw physics puzzle, switch-platforms, or the Sokoban puzzle).

Then the owl was mainly on the idea of illuminating the darkness. It was a pretty standard puzzle: you walk on a platform of square tiles. There is usually only one path of tiles that are walkable but since it is pitch black, you can't tell which tile is a hole and which isn't.

The idea then was to manipulate light so you can see the path, usually for a limited time, which then you had to commit to memory as you walk through the path in pitch black again.

So I thought the owl, while having a hoot, will also illuminate the path with its eyes like a pair of spotlights.

It was again, a pretty generic puzzle but I had little time left so I had to settle with that.

It was already Sunday of something like 5 or 6 AM, and I had only settled on the concept of it.


Things didn't look very good. I called it a day.




Day 3

When I woke up at 10 AM or something, I thought, why don't I just sleep through the rest of it? I felt defeated.

Inside my head I can already hear the critics and the I-told-you-so's. I can already imagine my friends berating me.

Somehow I felt that I had to prove to myself that I was better than that. There are people whose greatest critics are their own selves.

I knew I had to drop some a lot of features. That much was clear. (That's also how it goes in work when the reality of deadlines loom on your face.)

So in the end, I just made the tower and basically when you went inside it, the game ends.




But I couldn't resist adding another puzzle so I put in a big fire bowl inside that you had to activate by sending continual heartbeats. Doing it enough would cause the whole tower to gain color and, at its peak, some flash of light would activate whatever power was sleeping in that tower.





Results

Play tests proved that the game sorely needs a tutorial level. I purposefully decided against a help/instructions screen explaining the finer details because I want the game to naturally teach you as you play.

It seems to me people don't want to bother reading walls of text instructions anyway.

Unfortunately I wasn't able to deliver that "natural teaching" part. In this regard, I consider my game in its current state then to be a definite failure.

Maybe I should have made a tutorial level instead of the ending?

Yes, this was my genius plan to compensate for the lack of content. I got quite a few laughs from the audience at this, so it was probably worth it.

I also realized not everyone is keen on the rhythm puzzles (i.e. the speed of the heartbeat, the Barber's knock puzzle), so it was something I wanted to revise.

I probably could have seen it coming if I had people play-testing the game early and often. I had totally disregarded the "inspect and adapt" mantra of Scrum.


Someone actually had mistaken me for a student. Haha, seriously? How old do you think I am from this image?

Unexpectedly, I was awarded "Best Art" for the game.

I guess they liked the cats.




So that was my first Global Game Jam experience. Expect me in all future Global Game Jams as well! I'll make sure to take more photos next time.

Check out my game in the Global Gam Jam website: http://globalgamejam.org/2013/project-amrak

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.



Saturday, October 27, 2012

Combat-esque conversations?!?

So, to open my argument, here it is:

What if you could take the idea of a combat system, and use it for your NPC conversation system?

We all know dialogue trees are a drab workaround to letting a game's main character partake in conversations with the game's make-believe world.

Aren't you sick of that? Can we try to find a way around that somehow? Isn't it worthwhile at least to experiment, see if there is indeed some better way?

Craig Stern has this to say about dialogue trees in his article:
...This emergent quality makes combat a tempting choice to form the backbone of a cRPG, since it offers a much higher ratio of entertaining possibilities relative to development time spent than a more static system (such as, say, dialogue trees) would.
That was actually what led me to think about this whole idea in the first place.

If combat systems were designed to be so emergent (you can explore so many decisions and tactics) while only an economic amount of programming is required, why can't we try the same idea for conversations?

So how is it going to be? For starters, we can take this:


and turn it into this:


Its a very superficial take, but you get the idea, don't you?

When you choose "Attack", you see your character swing his sword and the enemy takes a hit. Then the enemy takes his/her turn.

When you choose "Insult", you perhaps would hear your character say a pre-recorded line of (insulting) dialogue, chosen partly in context and partly in random. And you'd see the expression on the other person's face, and see/hear his/her reaction.

I'm not proposing some sort of procedurally generated lines of dialogue. I certainly don't think our best technology so far can do it reliably.

What I'm thinking is scripts will still be made, its just that instead of choosing exact lines to say, the player "macromanages" the conversation.

Looking at that, its not such a radical idea, really. Many games experimented with this style before.

In Indigo Prophecy, instead of choosing specific lines of dialogue to say, you choose some topic, and your character automatically shifts the conversation to go there.

Same goes for Mass Effect to an extent.

Update: A whole list of other games with similar ideas by reddit include: Monkey Island's Insult Sword Fighting, Leisure Suit Larry, Deus Ex: Human Revolution.

But instead of choosing contextual topics at hand, what I want to see is a fleshed out system with rules akin to combat and everything that supports it: the importance of movement, targeting, stats, skills, perks and whatnot-- but for dialogue.

Skills and perks... all of that sounds overkill for a conversation system. But its worthwhile to study if some things can be translated here.

Interrogations in L.A. Noire comes very close to what I'm getting to.

Here was another impetus for me to jump-start the idea. Tonio Barmadosa has this to say about behavioral game design in this article:
Very interesting indeed. I can't help but draw an analogy with a totally different field, called Pickup Artistry. Pickup artists pick up hot babes in night clubs using methods from Behavioral Psychology. They push a girl's psychological buttons in order to create attraction, qualification, comfort and eventually seduction.

They use the exact same techniques, for example, being unpredictable and pushing and pulling all the time, which is equivalent to variable ratio reward / punishment.
We're getting somewhere here aren't we? "Picking up" can be thought of as a game. But one thing to note here is that you are not the player anymore, at least not purely. You also partake the role of umpire. You hand out the rewards to the player (i.e. the hot babe/guy) when you deem so. You make the player feel like s/he worked hard for something.

This is, of course, for seduction, but I think we can work out how it plays for other goals.

Goals for why we "talk" to NPCs may include:
  1. To get useful information1
  2. To get useful feedback (as in suggestions, criticisms)
  3. To progress in the story, main storyline or otherwise
  4. For romance, as noted earlier
  5. To coerce, persuade, or fool them for your advantage (bribes, taunts)
  6. etc.



[1]: And this can even be while in a hostile environment. Black Widow's first scene in the recent Avengers movie, is where she fakes naïveté while actually collecting information from the enemy.



Let's see all of our tools at hand in a combat system.

In a combat system, the very first thing you want is a way to assess the enemy and the surroundings.

Practically, this means a health bar, maybe a grid to see how far they are, fog-of-war, etc.

In a conversation, maybe you can have a hostility/friendliness meter on your NPCs. Maybe even an irritability meter, or a boredom meter akin to The Sims.

Your high-level options then fall somewhere along these lines:
  1. Inspection: assess the enemy
  2. Aggression: extinguish the enemy (attack)
  3. Conservation: survive/outlive the enemy (heal/defend)
  4. Subversion: weaken the enemy from within (poison, slow, etc.)
  5. Augmentation: strengthen yourselves (buffs)
  6. Concession: surrender, truce, agreement, etc. (forfeit, load game, etc.)
This is all well and good, but how does "extinguish the enemy" translate to "find out why he's hiding from the bandits" for example?

Let's say that's our "victory condition".

For a goal of "find out why he's hiding", the enemy is not "he", it's his reluctance to say his reason for hiding.

These could be some examples of how it would pan out:
  1. Inspection: asking questions
  2. Aggression: pressuring, convincing the person
  3. Conservation: defending your argument
  4. Subversion: intimidating, lying
  5. Augmentation: make yourself sound credible
  6. Concession: bribery, bargaining with the person
Again, these are high-level examples. In the same way that saying "attack" in combat can be done in a multitude of ways, the act of convincing or intimidating would also be achievable in several ways.

I'm particularly interested in how spatial movement of combat can be translated to a conversation system. Perhaps that can represent the topic of conversation?

The same way attacking the rear of an enemy can deal critical damage, perhaps pushing the topic of conversation to something the person is uneasy with will make your persuasions "deal critical damage".

Even with having these commands and "movement" options, I think the end result of the player inputting such commands should still show two guys talking, complete with dialogue text, and prerecorded lines of dialogue if need be.

In this manner you could say in the end this is actually more complex than a simple dialogue tree system. It is, but imagine how this could change your game (I'm actually content with just text dialogue, but having audio dialogue will definitely make it harder).

If the player is losing, he'd usually just load a saved game, but what if he can bargain with his enemy?

What if the player can talk to a merchant to drop his guard or distract him?

It can open up more emergent possibilities.

Monday, October 15, 2012

Unity Game Jam Manila 2012 Part 3

On the final day, things started to get hectic. As the staff needed to go to the associated event to give a talk about game development, Charles and I found ourselves having to man the game jam (I couldn't find the marshals for a time, they probably needed to be elsewhere too!).


We needed to facilitate getting the participant's builds into the officially designated machine to be used to demonstrate the game during judging. We needed them to submit their builds, let them test it on the machine, and make sure they don't do something horrible like delete the other teams' folders.

Then Charles said he needed to assist some guests from the industry looking at the game jam, and I was left to man the machine (see what I did there?).

Occasionally manhandling the mic to nag them about the deadline, I was checking off which teams have submitted at least one build.

Some cut it close to just 10-20 minutes before the 5pm deadline (I'm not actually sure if it was an exact 48-hour jam).

And there was even one who, get this: she only attended the first day, then left for home, did the jam by herself in her house, then came up like 20 minutes from the deadline asking to get submitted.

As facilitator, Brett was a nice guy and let her submit for presentation, but it was up to the judges if she was eligible for the prizes.


Paul Gadi of IGDA Manila came by the jam venue and went just as fast. Apparently he was on short notice.

Then a guy gave me a scoring sheet and said, "You're going to be a judge. Paul Gadi couldn't make it to the judging so you'll stand in as the IGDA representative."

Haha. Oh wow.

Thankfully, all teams were able to submit before the deadline.

I would have loved to post screenshots of each game made but I don't have them.

And so after presenting the games, and us two mentors presenting our games too, I had to go and judge.

There were immediately three games that stood out to me:

Prologue: Primitive Life

Pretty unusual game. You see a planet in XCOM geoscape style, and your goal is to fling asteroids at the right position and moment to start the seeds of primordial life.

Crystal Boom

A shooter reminiscent of Clean Asia (the Attractor ship) and Gradle Unison, you dash to attack instead of shooting bullets. I'm a big fan of these games. As a cool bonus, your super attack is you can set arbitrary way-points and your ship will dash to all of them instantaneously.

Silhouettes


These guys went for a safe bet and made a side-scroller of the popular running-man subgenre (i.e. Canabalt clone) but it was an interesting take in that you need a light source to see where you're going. You need to collect glowing spheres to charge up your light, so in addition to avoiding obstacles, catching lights is very important.

Playable Web Build: http://dl.dropbox.com/u/80881529/Silhouettes.htm

I am going to share my personal opinions here:
  • Prologue: Primitive Life
    • Pros:
      • Has a good amount of challenge, testing your aim and ability to time your shots.
      • Impressive graphics for something done in 2 days.
      • A very unique game, I don't know of any game similar to this.
    • Cons:
      • Not enough variation. Once you master the skill needed, the fun wears off. My suggestion is to add more types of asteroids in addition to the life asteroid and death asteroid. Perhaps an asteroid that makes depressions on the planet, or ones that build mountains. Perhaps ice asteroids that make oceans, fire asteroids that make volcanoes, etc.
      • The presenters themselves noted there were some bugs.
      • The presenters did a poor job of explaining the game to the judges. Brett had to re-explain how the game works to the other judges so they could understand it. Remember, some of the judges know very little about video games beyond what they have in their smartphones, so that needs to be taken into account.
  • Crystal Boom
    • Pros:
      • Again, a challenging game. Like I said, I'm a big fan of shooters like these.
    • Cons:
      • I find little relevance to the theme of "Primitive Life". Even the title, Crystal Boom doesn't have anything to do with the theme. I think the enemies were supposed to look like biological viruses, so there's that. Thing is, they cajoled an existing game genre into the theme, not the other way around. In the end though, I don't care as a gamer, cause I like to play these kinds of games.
      • Graphics weren't so good. Check Clean Asia and Gradle Unison for ideas.
      • Same problem with Prologue, the judges couldn't understand how the game works even with the presentation that was made. I had to go and explain them.
  • Silhouettes
    • Pros:
      • Challenging game. Running-man games are inherently challenging.
      • Easy to understand how to play. Only one judge didn't get it, and still, after a little explaining, he immediately got it. That's a given though, since running-man games always have simple controls.
      • Very very good amount of polish to the game, they can take the game as-is, and release it on the appstore. And they should.
    • Cons:
      • Not that it matters to me, but I also find little relevance to the theme here, if at all. They explained it was "primitive" in the sense that you're running in fear of the dark, like primitive instincts kicking in. But the truth is, again, they cajoled an existing game genre (Canabalt clones) into the theme. It feels like cheating to me on that bit, resting on some sure-win mechanics that other people came up with. But again, its ok. The thing is, they added their own little twist to the running man genre so it wouldn't be generic.
If it were up to me, all these three would win, but all of us judges had varying opinions. The only thing we could universally agree on was that Silhouettes was very nice overall, so it was no question that that was first place.


What hampered the other two games was that the judges didn't get how those games were played, and presentation was part of the judging categories. In contrast, Silhouettes was easily understandable.

For future games, my tip is to add in-game tutorials, perhaps in the same way Silhouettes does. Also I did that in my game, TopSide.

To the game jammers, here's a tip: NO ONE WILL WANT TO BOTHER READING THE HELP/CONTROLS SCREEN. You can't expect people to be patient when all they want is to see how the game plays.

If you find people getting stuck and you have to explain verbally how the game plays, you're doing it wrong.

The game should naturally teach the player how to play, as part of the playing experience.

It could be in-game tutorial text like in Silhouettes or TopSide, it could be some character in-game talking to you how the game plays, it could be tutorial levels, like in Valve's Portal.

Play again the videogames that you play on your PC's and consoles. You'll see these things. And they're very important. The player won't get to experience the fun part of your game if they can't understand the controls in the first place.



Here's part 1 and part 2 of this 3 part post.