Archive for September, 2014

Lessons Learned from Love Bandit and #TAGJam14

Screen Shot 2014-09-09 at 9.55.17 AM thumbnail

Here’s my game, Love Bandit, made in ~72 hours for The Arbitrary Gamejam 14 (Sept 2014)

Play now (Unity Web Player on Gamejolt)

The themes of the game jam were: “Breeder”, “Neutralization”, “Criminal”, and “Surprise!”
The bonus rule was to add a “Did you know…” feature to the game.

I made the game using Unity 4.6 Beta (Pro) to test out some of the new features, Blender for 3D modeling and some simple texture painting.

Lessons Learned:

Most of these are pretty technical except for the last ones. If you know of a better way to do some of these things, or have your own lessons learned about the items, please share. Note that I didn’t necessarily do things the “right” way or even the best way, just the most expedient way during a game jam.

1. Linear Lighting Model:

After watching the videos from Unite 2014 about physically based shading (here and here), and seeing how they use a linear lighting model (rather than gamma), and HDR (high dynamic range), I’ve tried using a linear lighting model with HDR, bloom, tonemapping (AdaptiveReinhardAutoWhite), color correction. With this setup, you get a lot more control via effects on the camera, instead of just the in-scene lights and render settings. It allows smoother transitions between lit and dark areas. I didn’t notice that much else besides for the haziness around the brighter areas due to the bloom.

2. New UI:

Unity 4.6 Beta’s new UI are a lot easier to work with than the old UI which I have often complained about. The new RectTransform component on them makes it a snap to position UI elements or make UI elements stretch according to the screen. For example the Love Meter bar automatically resizes based on the game screen’s width so that it’s right side is at 50% of the width, but the left side of the bar is a fixed position from the left (See first image in this post)

Here was a super quick last-minute title screen made using the new UI. I was planning to add buttons to it that allowed you to jump to a level, but didn’t have enough time:

Screen Shot 2014-09-09 at 9.31.02 AM

Not the best layout, but given only few minutes, and that the background is animated, it will pass. I think I took 5x more time picking out the font.

3. More Shader fun:

The cross-striping on the ground and mushrooms is made using a custom written shader, as opposed to the ground in Boobstorm (my game from the previous gamejam) which was just a texture. Custom writing a shader allowed me to keep the stripes sharp at any resolution and at any zoom level since it is procedural. The stripes are based on the position in the world. This also allowed me to get away with not doing UV maps/skinning for the stripped elements, saving some valuable time. It also allows elements to be resized or stretched without the texture being stretched:

Screen Shot 2014-09-09 at 9.14.24 AM

If anyone is interested in learning shaders for Unity, here is a good tutorial series on

4. Map indicator:

This was my first time trying to do a direction indicator UI 2D, pointing to the direction of an objective, and hiding itself when the objective is onscreen. See the little black arrow on the left:

Screen Shot 2014-09-09 at 9.51.03 AM

Here’s the pseudocode:

– Project the 3D position of the objective to screen space.
– Calculate the acceptable portions of screen space that the arrow will be visible in (margins from the sides of the screen, taking the radius of the directional arrow sprite into account, assuming a central origin to the directional arrow sprite)
– Check whether the objective’s screen space location is inside that acceptable portion
– If not in acceptable portion, disable the arrow.
– If in acceptable portion, clamp the arrow’s position to the acceptable portion of the screen, and rotate it to point away from the center of the screen, and enable it.

Here’s the actual c# code.

I had tried using a second camera looking at the objective (your face in the game) and using that as the arrow. It was cool, but didn’t do the job as well as just a plain arrow. I should have made the arrow more visible.

5. Coroutines, Pausing, and Cutscenes:

I had previously avoided using coroutines for many things because I was afraid that they wouldn’t stop if the game was paused. This time around, I learned that Unity coroutines behave according to Time, and if you set Time.timeScale to 0, it will pause the coroutines as well! This allowed me to come up with a quick cutscene framework to easily script and coordinate different actions (camera movement, fade-in fade-out, text display) in the intro and tutorial without having to fuss around with separate animations.

For example, the intro cutscene is scripted with just a few lines using the framework:

Screen Shot 2014-09-16 at 10.43.08 AM

Also, scheduled coroutines can be terminated using the StopAllCoroutines() method, allowing for an easy way to skip a cutscene. Of course, at the beginning of the next cutscene, set the state to what it would be after the first cutscene, just in case it was skipped.

I’m planning on perhaps generalizing the cutscene scripting framework for reuse in future projects and to share on the asset store. Right now it is just messy code I cobbled up during the game jam.

6. Ugh happened with Unity beta:

[Update: I figured out that the Tonemapping (AdaptiveReinhardAutoWhite) image effect does not work well with the Vignetting image effect on wife’s machine. This is not specific to just Unity 4.6 Beta, it also happens with Unity 4.5. When the camera has both of these, it causes the colors to go super dark.]

Somehow the game did not work right on my wife’s computer. It worked right on every other computer. I made this game all cutesy since my wife likes cutesy games! The lighting somehow ended up super dark on her computer (as if there were no lights or ambient lights). I wondered if it was because of the Linear Lighting Model (see point 2).

So after the jam, I went through the trouble of making a branch of the game to be the normal gamma lighting model and retweaked all the lighting, but nope, it still looked the same, lightless, regardless of web build or native build.

She’s got a Mid-2010 iMac, running Mac OS X 10.9.4 with an ATI Radeon HD 5750 1GB. It works fine when booted up in Windows 7 mode though.

I’ll chaulk it up as a Unity 4.6 BETA issue with Mac OS X since my past Unity 4.5 stuff all worked fine on her computer.

7. Tutorial and explicit gamejam mention:

With my last game jam game, the players mostly seemed to miss that the game was part of a game jam with really wierd themes/rules (and I made a game too tailored for those themes/rules). They also missed out on the instructions too. This time, I built in a tutorial, and based on the feedback comments and youtube videos (by patient38 and by DeathandGrim2), it worked.

Unfortunately still, our poor sleep-deprived host (@SnoutUp, thank you for hosting!) missed the statement that is boldly on the first line of the Gamejolt page’s description: that the game was a non-competition entry , and he declared it the winner initially :) Next time, I’ll make sure to put a statement that it is a non-compo entry within the game itself so that no one will miss it. I’m just not fond of having to add so much extra text to the game – the title screen is getting crowded. The real winner was BroodStop, by @ThumbsBlue, whose game I probably spent more time playing (and still haven’t beat, but it is on my bucket list) than I played my own.

8. Last Minute:

Level 2 and 3 were built in the last 2 hours of the gamejam. I had a choice of building them or just polishing the existing intro, tutorial, and Level 1. I’m sure glad I added level 2 and 3, since they demonstrate some different possibilities (obstacles, and moving faces) for future levels. I literally finished submitting the game with less than a minute left. So the lesson learned is to go for the gusto. It’s a game jam after all – the place to have fun and push yourself without much consequence of failure. If not here then where?

9. Recovery:

It takes about a whole entire week after a game jam for me to get back into doing my normal gamedev. This may be due to my lack of sleep from the jam, burnout?, marketing of the gamejam game, playing the other gamejam games, writing a blog post, or just the resting on laurels and procrastinating. It shouldn’t be like this. I should be able to use the momentum from the gamejam and spring right back into my normal gamedev. Dunno.

All in all, I had a ton of fun, and definitely honed my gamedev abilities in the frenzy that was Love Bandit. I’m excited for The Arbitrary Gamejam 15 in October 2014. I hope you to see more of you join in!

Comments Off on Lessons Learned from Love Bandit and #TAGJam14