The notion of games as a comedic medium is not completely foreign - companies like Lucasarts and Sierra managed to create comedy extremely well in some of their adventure games, a spirit which then fed into Double Fine and Telltale Games. Other games attempt to create a "comedic tone" through art styles (MediEvil, Borderlands and Bulletstorm spring to mind). The secret to these games, it seems, is to create a simple, light gaming mechanic, and apply absurdist comedy through the graphics and dialog. Rarely (if ever) does the comedy truly arise from the gameplay itself, but instead the games rely on pithy one-liners and reactions from in-game characters.
Comedic Tension vs Dramatic Tension
To understand how we can create comedy that comes from gameplay, we need a better understanding of the art of comedy itself. Nobody likes someone that explains why a joke is funny, but for the purposes of this discussion, I'm afraid I can't avoid it!
Comedy, like anything in drama, arises from a form of tension. You might understand that giving readers or viewers of linear media like books and TV/Movies a fright is about timing - well, comedy is the same. It's about the setup and the punchline, and the space in between. This space is something we call "comedic tension".
Comedic tension is more or less the same as dramatic tension - its about the knowledge that something is going to happen before it does. The difference between comedic and dramatic tension lies in perspective. Let's look at a good example of comedic tension from The Simpsons Movie.
Take a look at this shot. We already know Homer is an idiot - and if not, we can tell from subtle cues in the way he's presented. We know something bad is going to happen to him. What makes this funny, and seperates this from dramatic tension, is that Homer doesn't know something bad will happen. Now let's see what does happen:
Well, that wasn't what we expected! This is a great example of a joke that hits from two angles - we expected something that Homer didn't see coming, and then we get hit with something else entirely. In other words, we played a trick on Homer while the movie played a trick on us at the same time. Comedy, at its heart, is about subversion of expectations in a scenario.
One of the key narrative tricks here is foreshadowing - we need to be aware of what an idiot Homer is, and we need to see the potential for his idiocy to come to a head. In this case, we see something of a trope in the situation - "the old hammer-and-nail injury" has been a timeless staple of movie and TV comedy for years.
Horror works similarly - we fear the unknown, the darkness, and the things we can't control, but we need some idea of what might lurk to really ramp up the fear. It's one thing to have a couple making out in a car be decimated out of nowhere by a roaming psychopath, but if the radio warns of a killer on the loose beforehand, we get a sense of what might be coming.
Imagine the situation of hiding around the corner, waiting to jump out on someone. If you're the one doing the hiding, then from your perspective, the situation is hilarious - you know what will happen, but the other person won't. From the opposite position, it's scary - you don't know who it is that has leapt out at you at first. If you were given a clue that something might be waiting for you, the situation becomes infinitely scarier. When the person does jump out, and turns out to be a friend, it becomes a joke because they've subverted our expectation that the assailant leaping out from hiding is, in fact, just a harmless friend.
Comedy through Gameplay
If a game were to do something we didn't see coming, we'd find it frustrating - but we frequently do things the game doesn't expect us to, and we expect the game to respond. At times, the game doesn't, and this is frustrating. At others, it becomes hilarious. Which brings me to my prime example of how to handle comedy in gameplay.
Dead Rising 2 was, in my opinion, one of the funniest games of all time. It might have lacked the witty dialogue of a Monkey Island title, or the comedy animation and characterisation of Psychonauts, but what it did was master this concept I've discussed of comedy through subversion. Dead Rising 2 let you basically mess with the otherwise remarkably po-faced and deadpan story of Chuck Greene by dressing him up in ridiculous outfits, ignoring requests for help, and indulging in all manner of ridiculous chicanery.
This is the same subversion as in the Homer Simpson example - but in this case, it is the player subverting the expectations of Chuck Greene, and - in a way, of the developers themselves. Chris Crawford (or was it Eric Zimmerman?) described games as the end result of a dialogue between the designer and the player - in this case, the player is making a joke within that dialogue by subverting what the designer wanted. The comedic tension arises in this case because the player knows what they want to do, but this goes against what the developer thinks is about to happen.
Of course this joke exists only to the player. The developers wholly expected this - and that's what's so great about the way that Dead Rising 2 handles its comedy. Much like how the aim of a game is to present the player with an interactive scenario that still retains a sense of linear story, and how sometimes a developer has to "trick" the player into seeing more interactivity than actually exists, the developers of Dead Rising 2 embraced the potential of their game to be subverted by the user for comedic purposes. They placed those elements of subversion in the game, and the game doesn't fail to respond through a lack of planning, but rather through a deliberate lack of response. If characters told Chuck he looked ridiculous in Daisy Dukes and a women's hat, and he was properly humbled, the game would lose a lot of its comedic charm.
Another game which handles this well is Halo - sure, the grunts provided a little amount of comedy with their squeaky voices and overacted animations, but the real comedy tended to come from the sticky grenades, the sniper rifles that let you hit people from nowhere, the bouncy physics on the Warthog, and that most ever-hilarious and unpredictable game element of multiplayer.
Horror through Gameplay
Similarly, you can look at examples of dramatic tension in play working the other way around. While games like Resident Evil and FEAR attempt to scare us by throwing enemies at us out of nowhere, nothing - for me - will ever compare to two particular games: Doom and Minecraft.
In Doom's case, it was the first time I encountered the now-classic "empty room with a powerup in the middle" trap. As soon as I collected the alluring bonus item, the lights went out, and the familiar howl of the undead spelled my doom. Had I (as I have done since) circumvented the powerup and attempted to move on, I'd have realised this was a fixed trap, set for me by the developers - I couldn't progress until I'd faced it and overcome it. That would (and, again, has ever since) ruin the suspense for me. After the first couple of failures, as well, the moment lost all fear for me and became repetitive. In fact, little could scare me in that way again once I realised the pattern, and it would be some time before a game gave me that fear again - not until my first couple of games of Minecraft.
When you play Minecraft, there's a truly unforgiving moment for all players when you experience your first day/night cycle. As night descends, visibility drops to zero, and monsters spawn from the darkness, intent on your destruction. If you don't have coal to build torches, you are forced to wall yourself up in a cave and wait for the sun. For most, it becomes so frustrating that they just quit the game - but if you happen to have caught the bug, and have been drawn into the game, then sitting there, in the darkness, staring at the little patch of sky you've left for yourself, listening to the moaning, screeching and scraping of the skeletons, zombies and spiders outside quickly becomes one of the most terrifying experiences in gaming.
This is about more than just a lack of predictability - this is about the dramatic tension of the scenario. On one level, those creatures outside know what is, or could be, about to happen. On another, the game knows more about what is going on than the player does at that time. And at the same time, this is a scenario of the player's own creation. They can't blame the game for restricting their understanding of the situation - its their fault they can't see out into the darkness, a fact which - for some - negates the frustration of the situation and leaves only the dramatic tension that makes it terrifying.
Obviously I'm rather fond of emergence in games, and so my viewpoint on the matter might be a little skewed, but I feel there's more room to create comedic and dramatic tension in games if we pay attention to these concept of subversion of expectations and the control of information.
Instead of working to ensure everyone plays your game as seriously and po-faced as you intended it to be played, perhaps you should embrace the comedic potential of letting players mess with the setting for their own amusement. Would it add to replay value if, as well as tackling Gears of War on a higher difficulty level, the game offered you a reward for your first play-through of painting pick daisies on Marcus's armour? Dead Rising wasn't the only game to let the player run roughshod over its story, and different games have handled it in different fashions - Deadly Premonition deserves a nod for, without wanting to give away too much, working the player's interruption of the narrative linearity into the game itself in a way that feels cohesive but still amusing. Remember that it is about creating the illusion of subversion in the player - about making them feel like they're playing a joke on the game, or the game's designer, without letting on that you intended it to happen all along.
When creating horror in games, perhaps it would pay to consider how to allow the player to construct their own horror scenarios, to task it to them to look ahead and see what is coming, thus letting their own failures propel them into fearful scenarios of dramatic tension rather than rigidly constructing the scenarios. Thus we can avoid the tension-killing repetition of moments like Doom's classic booby-trapped door key, and produce a moment in which the player cannot blame the designer of the game as much as themselves for the situation they are in.