programming in the
twenty-first century

It's not about technology for its own sake. It's about being able to implement your ideas.

Design is Expensive

The result may at first glance seem a trifle, but I have a notebook filled with the genesis and evolution of the iPhone game DaisyPop. All those small, painstaking choices that now get "of course it should be like that" reactions...that's where the bulk of the development time went. I wanted to go over two specific design details, neither of which I knew the existence of at the project's outset.

The core mechanic is tapping flowers and insects that drift and scurry about the screen. Tapping a daisy freezes this wandering and it rapidly expands outward before bursting. Any flowers contacted by the first also expand and so on recursively. Insects, as everyone knows, don't expand when touched; they race forward, possibly setting off other daises and insects.

I put off implementing audio for this chaining process until late. I wasn't worried. I'd just plug in the sounds when they were ready, and I did. And it sounded terrible.

All the sound effects in a ten-length chain played in an overlapping jumble, sometimes four or five sounds starting the same frame. I spent a while fiddling with the chain code, trying to slow things down, to limit how much activity could occur at once, but it didn't help. I might have prevented two sounds from triggering on the same frame, but they were separated by a mere sixtieth of a second which didn't make a discernible difference. Messing with the chain system itself was also breaking the already polished and proven feel of the game.

The eventual solution was to not play sounds immediately, but queue them up. Every eight frames--a number found by trial and error--take a sound from the queue and start it. And it worked beautifully, stretching out the audio experience for big chains over several seconds, a regular rhythm of pentatonic tones. Almost.

Now the sounds weren't in sync with the visuals, and surprisingly it didn't matter. There's no real-life reference for when a purple daisy expanding to touch a white flower makes a sound, so the softness introduced by the audio queueing scheme wasn't a problem. But it was immediately noticeable when the quick run of notes played by a racing insect wasn't lined up with the animation, even by a little bit. The fix was to play insect sounds immediately instead of queuing them like daisy audio. It's inconsistent, yes, but it worked.

In any game there are goals that drive the player forward, such as finishing a level or trying to get a high score. In DaisyPop it's the latter. Typically you're only alerted of an exceptional score after you finish playing (think of when you enter your initials in an old school arcade game). I was thinking about how to give feedback mid-game. If there's a top ten list of scores, wouldn't it be motivational to know you've broken into that list and are now climbing?

A plain message is one option, but it's not dynamic; it doesn't draw your eye amidst the chaos. Eventually I settled on a triangle that appears and drifts upward--signifying rising up the score charts--which acts as a backdrop for overlaid text that moves in parallax: "#5" in a larger font, with "best score" beneath it." (Trivia: the triangle is one of two pieces of art I did myself.) After working out the right motion and how to handle edge cases I'm happy with the result. More games should do this.

I could have dodged both of these issues by wholesale borrowing an existing game concept and not trying something experimental. I would have had a working model to serve as a reference. It would have been so much easier in terms of time and mental effort if I had said sure, I just want to make a version of that game right there that people already know how to play and like.

Thinking about the details, wandering around an unknown space trying to invent the right solution, is expensive.

(If you liked this, you might enjoy All that Stand Between You and a Successful Project are 500 Experiments.)

permalink October 4, 2014

previously

archives

twitter / mail

I'm James Hague, a recovering programmer who has been designing video games since the 1980s. Programming Without Being Obsessed With Programming and Organizational Skills Beat Algorithmic Wizardry are good starting points. For the older stuff, try the 2012 Retrospective.

Where are the comments?