It's certainly under-represented as a literary technique in video games.
I write this article while watching the 1937 Marx Brothers comedy classic, A Day at the Races, a film that combines a rapid succession of quick-fire puns and prat falls with an occasional sprinkling of musical numbers throughout. 75 years have passed since the film was released, and it's as effortlessly hilarious now as it was then.
Despite being one of the oldest storytelling devices, comedy as a technique is sorely underused in video games. There are few games that even attempt to write some humour into the scripts, let alone base the entire experience around comedy. Psychonauts is as close as it gets in that regard, with games like the original Donkey Kong Country series and the Uncharted series worth mentioning for their efforts to include a decent amount of comedy.
Why is it such an unused technique though? Humour tends to be universal, yet highly selective at the same time, making it rather difficult to create a script that appeals to a broad audience. Wordplay and puns tend to work for the language they're written for, and don't always translate very well: if a punchline relies on the cleverness of the pun, how would that be portrayed in other languages? Granted, this is a small subset of the difficulty of utilising comedy.
At this point in time, the work of mainstream comedic films is dominated with what I would consider fairly crass material. That right there is a problem immediately: my comedic tastes differ greatly with what is currently being produced for the general populous. A film such as Transformers can more easily skip over its inadequacies as a story and focus on the spectacle, but a comedy relies heavily on its written content to succeed. The same can be said for games: the Serious Sam series has an utterly idiotic story and script, but it succeeds on the basis of its game play experience. A game that purposefully purports itself to be a comedy can be overlooked if the humour does not mesh with its audience successfully. Even fairly universal humour, such as pantomime, is difficult to represent in a game: it's a technique that relies on human physicality, something that cannot be matched in the rudimentary animation featured in the vast majority of games today (the exceptions being games like Team Fortress 2 and Rayman Origins).
However, humour is certainly a technique that needs to be embraced. It can certainly pay off: the cast of the Uncharted series is memorable and more relatable as characters due to their natural usage of humour to make light of their sometimes dire situations. Humour is a natural, human retaliation against fear, and is certainly worth the effort to get right.
Games that pull off humour well are much more memorable than games that don't even try.
In today's world of war shooters and MMOs, there doesn't seem to be much room for humour in video games these days. Video game humour can be tricky to pull off - especially in action games where cutscenes can sometimes be the only opportunity to do so. Sometimes, any attempt to inject humour just feels unnecessary and tacked on, and worst of all: not very funny. See the singpleplayer campaign of Battlefield: Bad Company 2 for a good example of this. I dug through my game library to find some examples of video game humour done (in my opinion) well. The list follows:
1. Ace Attorney
Adventure games are among the easiest types of games to inject humour into. The reason for this is because the majority of the time humour comes from characters doing or saying something funny. Adventure games are usually almost entirely about character interaction, meaning that humour fits naturally into the gameplay. Think about it - if you're old enough, when you think 'humour in games', titles like Sam and Max, Day of the Tentacle, Monkey Island, and Grim fandango will probably pop into your mind pretty quickly - and these are all adventure games.
The Ace Attorney games are no exception - they are definitely among the games that get a laugh out of me, even though I've played them ten times each and know a lot of the script by heart at this point. The interaction between Phoenix and Maya, the prosecutor and Judge, the oddball clients, witnesses and suspects - the list goes on. Almost everything in the series has a hint of the ridiculous nature of the world, but the games can still be deadly serious at times. It's quite amazing.
What would a list like this be without Psychonauts? I mentioned some of Tim Schafer's other works in the adventure game list above, and like everything that comes from Schafer, Psychonauts is incredibly funny. While the character humour is still very present in the game, Psychonauts goes a step further and expresses humour via the game world itself. For me, no other game has done this better than Psychonauts - the Lungfishopolis and The Milkman levels being particularly memorable.
3. Serious Sam
Ok, I was tempted to use this as an example of bad humour, but then I realised that Serious Sam is a case of the jokes being bad intentionally - the one-liners uttered by Sam are so cheesy that you can't help but laugh at them. The Serious Sam series delivers humour a different way, one that's quite unique: the gameplay itself. From the ridiculous (instant-kill bomb), over-the-top (a handheld gunpowder cannon), and sometimes just silly (kamikaze parrots) weapons, to the enemies themselves, Serious Sam is a very amusing game in all regards. My favourite Sam one-liner: "I eat resistance for breakfast!"
There are some others on my list that I would write about as well, but I've run out of space. Some more examples of humorous games would be: Portal, Max Payne, Borderlands, Team Fortress 2, Worms, Uncharted, Advance Wars, Paper Mario. Each one of these expresses humour in a different way, too. There's a lot of variety of the type of humour expressed in games, but there's relatively few that use humour in any significant way. It would be cool to see more.