Sound and Music

From RogueBasin
Revision as of 11:47, 12 September 2006 by Lochok (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Golly, sound in Roguelikes sure is awful.  Ever play the Windows binary of
Angband with the sound on?  Total silence, until you fight a creature.  Then
a series of odd squeaks that remind you primarily of the sketch in Monty
Python where the man plays a xylophone of little mice.  Then you kill
something, and it's so loud and weird-sounding that you have to turn down
the speakers (when did a mushroom patch -- not counting shrieker
mushrooms -- go "aaargh" anyway?)  We should improve this.

Implementing sound is, of course, an extremely platform dependent thing.
The first thing you need to do is construct your generic sound library,
usually with three funtions: PlaySound(char *sound) to play a sound,
PlayMusic(char *music) to change music, and Silence() to quiet everything.
Plus a few support functions like SoundOn(), SoundOff(), and Volume(int
vol).  Notice that I am suggesting you call the sound funtions with strings.
I would go even farther and say you should use strings, but not file
endings; so make calls like PlaySound("die") or PlayMusic("creepie").  Let
the internal implementation figure out whether playing "creepie" means
loading the "creepie.wav" or "creepie.snd" internal resource and playing it
over and over, or launching "creepie.mid" in a MIDI player, or even running
an MP3 "creepie.mp3".  You will thank me the first time you port your
program and don't have to change 300 sound references.

You also want to design your sound library to react gracefully if the sound
isn't found.  In my games, if I call PlaySound("blowgun") and I don't have a
blowgun sound, PlaySound just doesn't make a sound -- but no errors.  That
way, I can add sounds to the code without worrying if I have the actual
sound yet.  And I can do a simple text search to see what sounds I need.

The rules for good music and sound in Roguelikes are the same as for every
other game: they should reflect the mood of the game, they should have a
common theme, they should be at appropriate volumes (dragon breath should be
louder than a squeaking mouse, but neither should be so much louder than the
music as to force someone to turn their volume down too low).  There should
be lots of sounds -- better 150 sounds at low-quality than 50 high-quality
ones (you won't notice quality in a mouse squeak anyway).  And especially,
there should be no annoying or out-of-place sounds.  One dead dragon
squaking like a mouse, or worse still a "Silent Warrior" giving a big death
scream and you feel very silly.  If you are storing your monster and item
information in text configuration files (a very good idea), save what sounds
they make there as well.  The important thing is that one bad sound ruins
all the good sounds, so if you are in doubt, leave the sound out (that
wasn't meant to rhyme).

The best way, of course, to appreciate sound is to find a good example.  If
you want good sound from a game, go for Star Wars -- note the wonderful way
they change background music to match scenes.  You can do that in your
game -- switch to a darker sound in lower levels or an excited song at low
hit points.  Be VERY CAREFUL to provide a minimum song length -- a song
should play at least 30 seconds before shifting to another one.  Otherwise,
imagine a combat where you keep getting hurt and quaffing Healing potions --
what would that do to the sound?  Or going up and down between two levels?

But the best example of sound in a roguelike by far is Mission Thunderbolt.
Good luck getting it: AFAIK it's for Macintosh only, and not for free, but
if you are lucky enough to get a copy you'll find a good, science fiction
roguelike (I like the potions -> pills transformation myself).  But the
beautiful sound!  Crunches, mumbles, a wicked "hee-hee" when your stuff gets
stolen, weird electric noises, etc.  Useless for a fantasy game, but fits a
sci-fi game perfectly.

We like to think in Roguelikes that the game mechanics alone create an
atmosphere.  The stereotypical "D" that looks in our imagination more like a
dragon than the best of computer art is wonderful, but where is the
replacement for the music?  I'm sure plenty of people who play roguelikes in
text mode still put on some adventurous music in the background, and giving
your own atmostphere to a game can only be a plus.  In the end, the best
advice is exactly that for graphics in a roguelike: it can be a big plus if
it is good, atmospheric, and doesn't distract you too much from gameplay;
but if it fails to be any of these things (if it is low quality,
inappropriate to the atmosphere, *or* takes programmer time or CPU/memory
availability away from gameplay) then leave it out.


James Burton [burton@guide.cz]

Category:Sound