zero's a life

An extra chance.

Upgrading to Mavericks

| Comments

This week I upgraded to Mac OS X 10.9 Mavericks. To keep octopress working, I had to uninstall and reinstall Ruby.

Upon trying a rake generate task, I saw errors in the Ruby gems for processing YAML. I assume this is due to the fact that I built them on the older OS X install.

Interestingly, RVM survived the upgrade and seems to be working just fine.

I followed the instructions here to uninstall and reinstall Ruby, the bundler, and all bundled gems for my octopress install. The instructions mention a specific problem for OS X Lion, but these steps solved the problem for me.

Cut It All Right in Two: Bisect to Find Bugs

| Comments

Imagine there’s a lion in a desert. You need to cage the lion or you will be eaten. In this example the desert is your code and the lion is a bug that you’re having a hard time pinning down.

There are many ways to trap a lion. Here’s one.

Build a fence dividing the desert in half going North to South. Assuming the lion is not in the South section, divide the North section in half with a fence going East to West. Repeat the process until your fence is arbitrarily small and has become a cage trapping the lion.

But how does this relate to code?

Say you have a relatively large file that executes fine, but introduces a bug into your larger system. You suspect that something has gone wrong with the large file, but you’re not getting an error implicating a specific line.

Cut it all right in two.

Comment out half the code in your large file and try to reproduce the bug. If you reproduce the bug, repeat the process as necessary until you isolate the line producing the problem.

I learned about this approach for bugsleuthing from the bot in #emacs on freenode. It’s particularly useful for tracking down bugs in large configuration files. There’s a list of humorous lion-trapping algorithm examples here.

What’s in a Name?

| Comments

Growing up, the seemingly interminable school-week gave way to an anxious car drive home from the rental store with the weekend’s score. You remember those, right?

Usually the rental would include the instruction manual. On the ride home, I’d pour over the manual, trying to glean useful information to supplement my Nintendo Power-fueled strategies to maximize my fun in the limited time I had with the game. Often I’d get so engrossed with the manual, learning the universe for the game, I’d let my brother or a friend play the game first.

The looming question, not covered in the manual, was always: When will my turn end? When will my brother run out of lives, so I can get a turn?

We developed a vocabulary to deal with the count down to game over. On your first play-through it was unclear whether the last life was when your stock counter read 1 or 0. If you had one life left, you could play extra hard, using a rush of adrenaline to try to stay alive longer.

Sometimes, it was game over when the stock counter ticked over from 1 to 0. In other games, when the stock counter reads 0, zero is a life.

The name of this blog comes from that reassuring sense that you have an extra chance. “Don’t worry, zero’s a life.”

Setting Up Emacs-like Key Bindings in MonoDevelop

| Comments

I’m playing around with Unity to try to learn how it works. Shout out to Infinite Ammo for the excellent video tutorials.

Since I don’t know much about Unity, I’m reluctantly using their included MonoDevelop IDE. While I’d heard that Emacs-like key bindings were included, in the build I installed they weren’t present.

MonoDevelop does not make it easy to import new key binding schemes (the blog post linked here suggests submitting a bug report to propose new key bindings…). So, I did a little digging around on github and found the default emacs key binding scheme that I imagine should have been included in the MonoDevelop build I installed.

There was no way to add this key binding scheme to my available key bindings in MonoDevelop, so I hacked my Custom key binding file located at ~/Library/MonoDevelop-Unity-4.0/KeyBindings/Custom.mac-kb.xml.

I started with some simple copypasta. But then I found some useful navigation features were lacking. So, I added key binds that immediately came to mind, like Alt-f for moving forward one word and Alt-b for backward word. Yes, I know these are M-f in Emacs, but I’m using MonoDevelop’s syntax here.

My key bindings are available in the gist below. I’ll update this gist when I add key bindings, to keep a current working version available.

Bunnies Don’t Surf #flappyjam

| Comments

Here’s a WIP FlappyBird-like game prototype for #flappyjam: Bunnies Don’t Surf. You are an unfortunate rabbit whose warren is being flooded by a passing thunderstorm. You have to navigate the tunnels of the warren, propelled by the wave of water flooding your home. There’s only one problem: Bunnies Don’t Surf. So you’re stuck hopping up and down in a futile attempt to survive.

Bunnies Don’t Surf requires Python and pygame (version 1.9.1) to play.

Tap SPACE to hop. That’s about all there is to say about the controls.

As I’m sure you can see, the game is in dire need of art assets, sound assets, and some sort of high score system. I’ll do my best to add these, once time allows. If anyone has feedback or art design ideas, please let me know in the comments section or on Twitter. I’d love to hear it.

I’ll post updates as the game progresses, and officially submit it to #flappyjam if it’s done before the jam ends on February 24.

An In-depth Tour of Tetris

| Comments

Image from wikipedia.org.

This week I’ve spent quite some time reading this article on MeatFighter.com. The article reverse engineers the inner-workings of NES Tetris. With superb visual aids, the author, o__11 , surveys the mechanics and data structures used to implement Tetris on the NES. Then o__1 designs and implements an AI script to play Tetris with super-human speed and precision. o__1 even describes how to try it at home, providing instructions and the necessary Lua scripts to run the AI on your own copy of Tetris.

I hope to see more articles looking back on classic games with this tremendous attention to detail. An older article looking at Pac-man AI shows similar obsessive depth. Articles like these help supplement our appreciation of these games as works of art by documenting the essential technical complexities underlying these games. I think that’s a good thing for everyone from hobby developers to professional developers, as well as designers and fans.


  1. I’m referring to the author by the contact email listed on the website.

Some Thoughts on Attack of the Friday Monsters

| Comments

It’s hard to say anything new about Attack of the Friday Monsters, a game that splashed on the scene months ago. The work of its creator was lovingly lauded by Ray Barnholt–a noted Boku no Natsuyasumi fanatic–in such a reverent way in his SCROLL magazine that it’s almost sacrilegious to try to write more. So instead of doing a point-by-point review, I’ll mention some details that stand out to me, personally.

I played through most of Attack of the Friday Monsters on a flight the day after I watched Miyazaki’s Secret World of Arrietty. Sure one had beautiful water colors and amazing visual tricks mimicking real camerawork and the other used pre-rendered backgrounds with blocky polygonal actors on the stage, but these art styles complimented one another. They didn’t clash.

I was struck by the ambient sounds that bring the pre-rendered backgrounds and polygonal characters to life. The periodic train sounds, presaging the arrival of an in-engine rendered train–sort of quirky and quaint with today’s game engines powerful enough to render both background and foreground objects–remind me of a previous exposure to Japanese culture: the first time I watched Neon Genesis Evangelion as a teenager. There are the ubiquitous cricket or cicada sounds that were also present in Eva, but for me, they hearken back to a youth spent in the rural South. The drone of cicadas in the sticky summer heat reminds me of falling asleep in a Mississippi home, of walking into cool woods after standing in a sunny meadow.

The whole game engine is full of quirks and reminders of the PS1 era of gaming. But one of the mechanics seems rather novel, an addition seemingly for its own sake, with little influence on actual plot or gameplay. I’m talking about the spell casting mechanic, reminiscent of games children used to play in 70s Japan, the time in which Attack of the Friday Monsters takes place.

If you win the sometimes annoying, somewhat forgettable, rock-paper-scissors card game, fueled by collectibles strewn throughout the world, you gain the ability to cast spells on your buddies, knocking them down. It has no bearing on the outcome of the story. The spell system is simply decoration that deepens the story by providing a more complete world, accurately capturing what it feels like to grow up as a child in Japan during the 70s.

You are allowed to pick, and reorder, the phrases of the spell your character speaks. This type of cosmetic customization is typical in modern games, and in Attack of the Friday Monsters it’s nothing more than cosmetic, but it could have been used in surprising ways.

I realized the potential depth of this mechanic during a phone conversation with my brother. As I told him about the spell casting, he mentioned a Kickstarted pen and paper RPG called Magicians.

Magicians uses spells spoken in another language as both an impulse toward learning the language and a mechanic for determining the success or failure of an action. The game my brother described involved a Harry Potter-esque international school for magicians in Korea.

To use magic, the characters, and thus the players, have to correctly speak Korean words–at least with enough accuracy to satisfy the voice-recognition system of an online translation service. This sets up the potential for a rather clever scenario in which characters’ Bildungsroman stories are echoed by the players’ acquisition of the language.

At present, on the 3DS, the kind of voice recognition required for this sort of is immature. But it’s certainly possible on more powerful platforms.

One way to exploit the 3DS, and other devices with touch interfaces, involves learning written language, such as Japanese hiragana or katakana. I can imagine a magic mechanic that involves correctly writing scrolls, where the fidelity of the player’s calligraphic strokes determines the strength and efficacy of the scrolls.

Another possible approach is to build up language comprehension by constructing words out of syllables. Given several options, one would choose the correct syllable to complete the necessary word, in order to perform an action or cast a spell. A similar sort of approach would work for learning syntax, completing or building a sentence with the appropriate words.

Attack of the Friday Monsters is a quick experience, but the depth of its design has made it a memorable one. If you’d like to learn more about the game and its creator, you can check out this interview by Ray Barnholt, which covers Attack of the Friday Monsters and other games by creator, Kaz Ayabe.