a belated update

So I spent a couple of months alternately writing a new game, and making some improvements to my game toolkit. The improvements took, the game didn’t. That’s okay. I’ve learned a lot.

The most important lesson, in fact, wasn’t technical. As a developer, I’m used to working from a plan, a spec, a target. Even if the target is soft, it’s still there, guiding me. As a writer, on the other hand, I’m used to sitting down and banging out something—Pat stood on the edge of the road, watching for a blue car—and just seeing where it can go.

As a gamemaker, I’ve followed the writer pattern, and not the developer pattern. I say: hey, I’d like to explore a cave. Float in space. Talk to a robot. No plan, just an idea. See where it leads.

For the last couple of months, however, I’ve tried to follow the developer pattern. Didn’t work. The hell with it. Back to the writer pattern.

So, here’s a screenshot from a thing I’ve been banging on this week. Don’t know exactly what it is, or where it’s going. Can’t wait to find out.

the spitball development model

Not a lot to report this week on the development front. I’m still tossing ideas at the wall and looking at what sticks, and writing long essays to myself about why they might be sticking. Slowly, a picture emerges.

Testing proofs of concept in a hacking project has worked much better than trying to code the actual game project from the start. I feel more productive when I’m working on production code, but it’s a false economy, as I wind up rewriting most of the code and introducing plenty of bugs along the way. Better to do the rewriting in notes and hack modules that I can toss out.

I mentioned HTML5 audio a couple posts back, and specifically how I didn’t think the callback model was going to be performant when combined with WebGL. In retrospect, it might have been a good idea if I’d actually tested that assertion first. I’m happy to report that I’ve tested it for my own use cases, and I was wrong. I don’t notice any dropoff in framerate from generating raw audio on the fly, nor do I experience audio dropouts from using WebGL.

I still like Webkit’s patch-and-plug model, of course, but I no longer believe it to be the only usable one.

official announcement

I can definitively state that the next game is taking place underground. Not in a cave, though. Caves are so 4 months ago. Anyway, I’m busy drawing up a map, working through some gameplay mechanics. I’m still sticking to my no-code-until-specification-complete rule, and by “sticking to” I mean “getting around via a hacking project”.

Also, some excellent Javascript game development tips.

followup to the infinite

The last post was written late, and I forgot to mention the biggest issue I had with the soundtrack project. Because it has to generate a separate sound clip for every note, it’s constrained to a musical universe of three octaves, one instrument, and one duration. I’d love to mix it up with some whole notes to generate harmony.

Hell, I’d love to avoid the base64 hack altogether. HTML5 audio is in a shocking state, as far as cross-platform solutions go. That base64 hack doesn’t even work on IE. The Webkit audio API rocks, but it’s not available on FF or Opera. Mozilla’s Audio Data API is fine for raw audio processing, but has been deprecated in favor of a future API to be developed by the Audio Working Group. (Someday.)

On that subject, I tend to prefer Webkit’s patch-and-plug architecture to Mozilla’s web worker model. Calling back into JS to process low-level audio works for demos, but I think it’s going to have issues when integrated with other realtime libraries like WebGL. Even with just-in-time compilation, JS is still basically glue-code, and not really suited to processing large blocks of audio on a tight CPU budget. The patch-and-plug model gets this, and though it provides the means to process low-level audio it doesn’t depend on it.

an infinite number of earworms for you

Procedural generation fascinates me. I take a sneaky pride in the fact that all the textures and models for Gas Food Lodging are assembled client-side from pure code. In the next gaming project, I’ll be adding audio, and I plan to generate it on the fly.

My first crack at the problem? An algorithmically generated soundtrack. Click the button below to hear it.


Okay, it’s not the greatest. Source is here. A few points in no particular order:

I’m using the A Minor Pentatonic scale. I tried C Major and C Blues, but neither of them sounded right. I think it’s a problem of dissonance. Both the major and blues scale have dissonant intervals, and the pentatonic scale really doesn’t. Anything you play in a pentatonic scale is guaranteed to sound—well, not “good”, but “acceptable”. Dissonance requires a more intelligent algorithm to manage.

My cross-browser solution to the audio problem was the old standby, generating a base64 representation of the PCM data and producing a URI string from that. I found a helpful library called riffwave to do the heavy lifting. (Thanks to Pedro Ladaria.)

I originally used a Markov chain to generate the “riffs”, and the results were even worse: no recognizable motifs emerging, just random noodling. Music needs repetition, though not too much—just enough to keep the pattern-hungry brain happy.

So, I’m putting this aside. Fun project, but I doubt I’ll take it much further. Bits of it are going into a sound effects generator. But keep it running if you like. I’m sure there’s a symphony in there somewhere.

a bit of this and that

I spent so much time playtesting Gas Food Lodging that I’ve developed a case of trigger finger from holding down the W key. Never let it be said that I don’t suffer for my art. It’s also instructive to note that if you make a game with basically one button, you’re going to be pressing that button a lot. I think the next one will use a few more controls, just so I don’t have to spend another two weeks soaking my hand afterwards.

The Nexus 7 looks amazing. It’s the first tablet I’ve seen that has me checking my budget. The lack of WebGL on Chrome makes it unlikely I’ll go much further, though that may come in time. On the positive side, I’m seeing more people here and there asking about WebGL support on mobile, so hopefully there’s momentum building.

Regarding the issues I was pondering in the last post, I’m still dithering about open world vs. linear narrative. As it happens, I have a second project I want to work on, so I’m dithering about that now. Sorry, it’s all a bit vague. The important thing is that I’m not jumping right into code. Lesson learned.

Giles Thomas of LearningWebGL gives Gas Food Lodging a nice mention in his latest dispatch. Awesome!

locked doors and broken dishes

The locked door problem is driving me crazy.

It’s been said specifically about Half-Life, but applies to many other games, that a player winds up having to travel through miles of monster-infested corridors just to get to the other side of a locked door. Concerned made good use of this trope: you’ve got a crowbar, a pistol, a machine gun, a rocket launcher, and you can’t get through a locked door? Hell, you’ve got a foot. Door frames aren’t made from adamantium.

Of course, the door can’t be blasted into bits because going down the monster-infested corridors is the point of the game. The locked door enforces the narrative flow.

Another way of enforcing the narrative is to let the player go anywhere they want, but lock them into a sequence of interactions. Bob won’t talk to you until you’ve talked to Amy, and Amy won’t talk to you until you’ve found the broken dish, and the broken dish isn’t even visible until you’ve talked to Steve. Seriously. Like talking to Steve made it just magically appear. Steve is not a fucking wizard, okay? And what’s Amy’s deal, anyway? Why’s she acting like a stuck-up dork? I didn’t break the goddamn dish.

Same problem as the locked door, but in some ways, more frustrating. In the real world, people won’t refuse to talk to you just because you’re missing an item of crockery, and things certainly don’t just appear out of thin air because it’s the “right time”.

There is a third option: the out-of-order narrative. Let the player go anywhere and do anything, and let a narrative assemble itself from these interactions. No plan, no flow. It’s the mode of play that most resembles real life, but oddly enough, it’s used the least. Wander around a city sometime looking at random things, and talking to random people, and see how much of a story you can put together. Human beings don’t find this sort of thing very satisfying. We need to see the arrows: this happened because of that.

The reason I’m obsessing about this right now? I’m writing the narrative for a new game, with as much detail and thoroughness as possible up front, and I’m getting angry over how much work I’m going to have to do to keep the bits of narrative from bumping into each other. Like, okay, there’s a corridor over here that holds plot point 1A, and the room over here holds plot point 1B. There is no earthly reason why you can’t go to 1B if you haven’t gone to 1A yet. And yet, to maintain a linear narrative, I have to put a locked door in front of 1B (that magically unlocks once you’ve dealt with 1A) or take 1B right out of the game (and have it appear, mirable dictu, just when you need it).

Or I let players visit 1B before 1A, and the game makes no sense half the time.

Most successful game designers just pick one and get on with it. I’m not there yet so I have to rant a bit. It strikes me that the problem arises from wanting a game to work like a story and like real life. This is something that writers deal with all the time. You can make a story realistic or you can make it interesting. Even gritty cop shows have to use dramatic conventions to keep viewers from tuning out. Every reality show involves some degree of editing to cut out the dull bits, or even to synthesize conflict out of random bits of tape.

I haven’t found the right compromise. Still looking.

Also: Darien Acosta of webgl.com has written some very kind things about Gas Food Lodging. Bookmark that site.

a little post mortem

After the last project, I said that I’d be trying to write the game script sooner in the process. I was half-right, though I’m not sure which half.

I started by writing down the basic idea of the game—you were a young alien chef in training, trying to make a name for yourself by coming up with the greatest dish ever. I figured you could travel around looking for ingredients and advice, cooking for people to get a sense of what they liked, and sooner or later someone would let slip some bit of information about one might go about creating the greatest dish known to, er, alienkind.

I had the basics. I went to work coding the environment and the NPC models.

Once I had those, I started working on the script, and discovered I hated the idea that I’d just spent the time laying the groundwork for. It was stupid. I wanted something—well, something else. Meaty. Grim. Dead Space-level grim, not primary colors in a sunny sky. Wandering through a dark clutch of scary weeds, bumping into the bodies of people you knew. Sweeeeeet.

After toying with this idea for far too long, I told myself to lighten the fuck up and have some fun. This is always good advice. I’d still lost the time, though, and I still didn’t want to make a game where you went around cooking for people without risk, without a motivation other than ambition. (Ambition is a fine motivation in life, but in stories I find it uninteresting unless it leads characters down darker paths.)

I briefly considered combining the two, and creating a game where you had to go around a dark, scary clutch of weeds and cook for people to stop them from killing you. I still think the sheer stupidity of it would have worked, and I may go back to it someday.

In the meantime, I was tinkering with the code. This isn’t usually a bad thing. It’s a useful process, on occasion—test this, try this out, find alternative methods. However, it’s got to be part of a plan, or the tinkering takes over, and turns into bike-shedding. I lost a significant portion of those three months arguing with myself over what color to paint the weeds (so to speak).

Eventually, I came up with the idea of writing a short farce. (Can’t imagine how.) It still took a couple of rewrites to come up with the idea of a reusable minigame. That one got a big cheer.

In all, I suspect I spent half the time thinking how much I disliked my ideas, then desperately trying to come up with new ideas to dislike. This isn’t going to cut it in future.

For the new project, I’m going to try writing a good bit of the script up front before I start coding. I’ve resisted this because writing doesn’t feel like work—at least, not in the way that coding does. But if it saves me time and tedium, then it’s well worth it.

gas food lodging

Hey, gamers! Tired of playing the Chosen One, the hero that saves the world? Haven’t you always wanted to play a fussy hotel manager with a handful of difficult guests? Of course you haven’t! My God, I’ve just wasted the last three months of my life in a pointless exercise!

But what if I told you that the hotel manager is a flying alien from a gas giant planet? And the hotel is a cluster of weeds? And this bucket of dead fish is really my collection of gold coins? I’m rich, I tell you!

Welcome to the world of Gas Food Lodging.

Let’s bring our cast out for a big hand.

Our aliens are called paddlers. They’re asexual bags of gas (insert joke here) living it up in the atmosphere, high above the thick impenetrable undercloud. Paddlers eat, talk, dance, play sports, and stay in hotels. (That’s probably not all you need for a viable civilization, but I had a strict remit.)

You’re Hische, the hotel manager. It’s your responsibility to make the guests feel at home, and it’s their pleasure to call for you at every waking moment. Cross the weeds, find out what the guest wants, and make it happen. Simple.

In real life, sound doesn’t look like this. It’s actually mauve.

The flashing red bullseye tells you someone’s bellowing for your help. Follow it to the source—though once you get there, you’ll have to chase down the guest, who’s too busy calling you to notice you’ve arrived. Once you’re close enough, the guest will stop. Face em and hit E to get an earful. (The em isn’t a typo. An asexual species requires non-gendered pronouns, and I’ve chosen e, em, e’s. Yes, I’m aware that it makes everyone sound vaguely Cockney.)

Most encounters with a guest will require you to do something, like making dinner or dancing. Fortunately, nearly everything in this world can be accomplished by shaking yourself in some fashion. (A planet of pop stars? The mind boggles.) As you move, you fill the progress bar.

The chef makes the best denatured proteins this side of Low Cloud.

Once you complete a task, you’ll be rated so many stars out of five—much like a hotel rating, oddly enough. At the end, you’ll receive an aggregate score. Oh, and there’s a story, or something, but you can ignore that if you’d rather focus on your dancing and stuff.

Gas Food Lodging. Save the world all you want, pal. You’re still paying for the minibar.

Note: if you’re attempting to play this on an integrated GPU, you have my sympathies. I did all I could to optimize the drawing without losing the visual style I wanted. Didn’t help.