Fragments of Him – Programmer Post Mortem

Posted by (twitter: @SassyBotStudio)
May 1st, 2013 12:37 pm

First things first, here’s a shameless plug to our game, Fragments of Him:
http://www.ludumdare.com/compo/ludum-dare-26/?action=preview&uid=15100

I highly recommend playing the game before reading on, it’s a lovely experience which will possibly be ruined by reading this post.

Now let’s get going to the juicy stuff.

Basic mechanics

We’ve had the thought of trying a narrative based game before for a Game Jam, although we never got around to actually trying it. But apparently all the designers we know are totally into narrative, so this time we got to give it a try. I’ll leave the designer talk to him though.

Our tool of choice was easy enough – Unity3D. I’ve grown to love the engine for its simplicity and the possibilities to quickly prototype. How quickly? We decided on the design and I started with a first rough prototype. Moving around in 3D space and clicking on objects. Since this was done within 5 minutes, it became clear that this was going to be a great game jam.

I threw in the default character controller and the default mouselook script, wrote a script that does a raycast when you click on an object. When an object has a certain tag it will be made transparent. Total lines of code written so far: 20.

That was the easy part, next part was telling a story. The story was to be told with individual lines of text which all have an audio file linked to it. Some of these would have to be played after each other, and some wouldn’t. Here’s my initial solution:

Class Action{
public var sound : AudioClip;
public var text : String;
public var isFinal : boolean;
public var nextScene : String;
}

Class ActionWrapper{
public var actions.<Action> = new List.<Action>();
public var percentage : int;
}

ActionHolder.js:
public var actions.<ActionWrapper> = new List.<ActionWrapper>();

An action would always have a sound file and the text. The isFinal boolean would be checked whenever a file should trigger the event to go to the next scene. The ActionWrapper and ActionHolder simply hold lists of data. This data is simply fed to a function which picks the correct data and adds it to a queue. This queue is checked all the time and plays the audio (and shows the correct text). Something that nobody noticed so far, is that each event has 3 different options to pick from. The writing is unique with each of these options and the writing will always make sense, no matter which ones you get. Sweet.

Shaders

I’ve never written shaders in my life and I think I’ve only seen a shader file twice. Now we suddenly needed a shader that could make an outline around objects. Switching shaders on runtime, no probem. Right? Luckily, Unity came to the rescue again! There’s a toon shader which gives it an outline. That did the trick for a while, but it wasn’t what I wanted. The shaders make it toony (obviously), which is very much a different effect than our current shader. On to my quest to make the perfect shader. I hacked together a shader by combining the default Diffuse shader that Unity provides and the Toon Outline shader. I have no clue how it works or why it works. But it works. Sadly I didn’t have time to make a similar shader for the final scene (but then for transparent objects). A shame, because that would’ve been very nice.

Looking back, I think we did well on all of the disciplines. The art looks great, the design was done well, we had great fitting audio and the tech side, well the tech side works.

If you have any questions with how I fixed things I’ll be more than happy to reply. Just note that I’m not that great of a programmer, but I somehow always manage to get things to work.

Here’s the difference between a screenshot that I made after about 3 hours into the jam and one I just made:

mood

If you missed it, another shameless plug: http://www.ludumdare.com/compo/ludum-dare-26/?action=preview&uid=15100


4 Responses to “Fragments of Him – Programmer Post Mortem”

  1. Topaz says:

    Since no one seems to reply to posts much, I thought I’d just say again that I enjoyed playing your game!

Leave a Reply

You must be logged in to post a comment.

[cache: storing page]