WARNING: this post contains references to highly addictive, potentially absorbing, time-wasting, but very cool games. You’ve been warned!

Thanks for your interest in my patch to add sound and music to Crack Attack!

Long, long time ago… in a town far, far away…
(it feels like a long time ago to me, and 3,000 Km. is not precisely nearby)

Seven years ago, I made a few changes to Crack Attack! –a fast-paced puzzle game inspired by the classic Super NES title Tetris Attack!– to add sound effects and background music. Today, some people still land at this site looking for the code. I’m sorry, but those patch files are gone, see below for details.

Crack Attack! was created by Daniel Nelson, who maintained it until v1.1.8 or so. Later, the project was adopted by these folks who maintain Crack Attack! at Savannah, currently at v1.1.14. Their last update was already four years ago, when v1.1.15 Alpha was announced for testing. Looks like it’s no longer active.

If you want to know more about the current state of Crack Attack! I suggest you ping Andrew Sayman, Kevin Webb or Daniel Nelson. Good luck with that ;-)

So, what now?

I’ll just explain what there is available today, starting with how to use it.

Does your copy of Crack Attack! have audio support?

I wrote the patch for Crack Attack! v1.1.8 so any version older than that probably won’t have audio support. Such versions should be rare though.

Crack Attack! v1.1.14 at Savannah has audio support. I haven’t tried it yet but I’d expect its Windows build to have audio support as well. If you are running Crack Attack! on Mac, I’m afraid you’re out of luck, latest release I can find is v1.1.3 which is way too old. Well, you could install Ubuntu on your Mac ;-)

I just tried Crack Attack! v1.1.14 on two workstations, with Ubuntu 8.04 and 10.04 respectively and it works fine.

If you don’t know what version you have or whether it has audio support (and/or don’t want to look at the code), just start Crack Attack! on a shell. If it has audio support and you haven’t set up your own sound files, it should complain like this:

$ crack-attack -1
Crack Attack! v1.1.14

WARNING *** Unable to open countdown.wav
WARNING *** Unable to open block_fallen.wav
WARNING *** Unable to open block_awaking.wav
WARNING *** Unable to open block_dying.wav
WARNING *** Unable to open garbage_fallen.wav
WARNING *** Unable to open garbage_shattering.wav

Since Crack Attack! doesn’t ship with audio files, you’ll need to add your own.

Add sound effects.

Unfortunately, I never came up with a nice set of sound and music files that could be freely distritued along with the code. Once you get Crack Attack! compiled with sound support, you need to install files manually.

There is no option to enable/disable audio when you start Crack Attack! and many people don’t want sounds while they play. Therefore, you need to install audio files in your home directory, unless you want all users to have the same sound and music (be aware that may annoy some people!). Otherwise, there’ll be no sounds, which is a safe (non-annoying) default behavior.

To add sound effects to Crack Attack! you need to add the following wave files to be played at specific events:

  • countdown.wav, for the 3-2-1 countdown when the game starts
  • block_awaking.wav, when each new block is revealed out of a shattered garbage block
  • block_dying.wav, when blocks are destroyed
  • block_fallen.wav, when a block falls after you swapped it into the void, i.e. a position with no block immediately underneath
  • garbage_fallen.wav, when you receive new garbage blocks
  • garbage_shattering.wav, when you shatter (destroy) garbage blocks

Add them in /usr/[local/]share/crack-attack/sounds/ for all users in the system or ~/.crack-attack/sounds/ for yourself only.

You can put there any sound effects you like, just make sure to choose short ones. My choice of sound effects at the time of writing the patch was a mixture of borrows from two great games: GL-117 and LBreakout2.

As far as I can tell, both GL-117 and Lbreakout2 are released under the GNU GPL license. I hope that license covers the sound files as well.

If you want to give this a try, the following commands would (on a Debian-based system, like Ubuntu) install those games and create symbolic links to (my personal selection of) some of their sound files, so that Crack Attack! will find and use them:

sudo apt-get -y install lbreakout2 gl-117
mkdir -p ~/.crack-attack/sounds
cd ~/.crack-attack/sounds/
ln -s /usr/share/games/lbreakout2/sounds/joker.wav block_awaking.wav
ln -s /usr/share/games/gl-117/sounds/explode1.wav block_dying.wav
ln -s /usr/share/games/lbreakout2/sounds/exp.wav block_fallen.wav
ln -s /usr/share/games/lbreakout2/sounds/speeddown.wav countdown.wav
ln -s /usr/share/games/lbreakout2/sounds/exp.wav garbage_fallen.wav
ln -s /usr/share/games/gl-117/sounds/explode1.wav garbage_shattering.wav

Start Crack Attack! on a shell, you shouldn’t see the warnings above and you should hear the countdown after pressing the space bar to start the game. Enjoy! :)

Add background music.

This is even easier: just drop some music files in ~/.crack-attack/music

Crack Attack! will play files in ~/.crack-attack/music in a loop until game ends. Any audio format that is supported by LibSDL should be fine, so you can drop there any Ogg Vorbis or MP3 files you may already have. Just choose some that feel good for you to accompany the game, it’s totally up to you.

You can also rename some of those files to use one or more of the following filenames to play them at specific events:

  • prelude, when the game has not yet started
  • game, when the game is going on (*)
  • youwin, when you win
  • gameover, when you lose

Note #1: if (and only if) there is a filed called game, that will be the only file to be played during the game.

Note #2: originally (as I wrote the patch back in 2003) those file names above were expected to have .ogg extension, but they don’t in release v1.1.14 from Savannah. That seems more reasonable, so just make sure to name them like that, with no file extension.

Naturally, you can just not add any music. Sound effects will work regardless of music files not being present.

Want the opposite?

Not sure that’s possible, it seems the whole audio support bails out if the wave files (*.wav) above are not present when starting Crack Attack!

If you want to have background music but no sound effects, just find (or record) a short silence and add it as your sound effect for all events ;-)

But, where are the patch files? Show me the code!

Poof! It’s Gone! Really. Sad, but true.

While doing a bit of housekeeping (following recent changes) I discovered that all my patch files were gone. Somehow, they became empty, zero-sized. I just removed them and their URLs now redirect here, to this post. I hope that redirect helps both people and search engines.

Fortunately, the patch was available for long enough to be backed up by others and merged into the upstream project, Crack Attack! at Savannah. If you just want my code, these are the files I added, cleaned so that it may actually work cross-platform:

src/Music.cxx
src/Music.h
src/Sound.cxx
src/Sound.h

These classes implement support for playing background music and sounds effects respectively, but more changes were needed around to make calls to these classes. If you really want to have just my changes to merge them into an older release or whatever else, you can check the code out from the CVS repository at Savannah:

cvs -d:pserver:anonymous@cvs.sv.gnu.org:/sources/crack-attack co .
cd crack-attack
cvs rdiff -u -r 1.2 -r 1.1 crack-attack > crack-attack-audio-support-by-miguev.txt

In case you don’t want to use CVS, here is that patch.

That will contain some more changes from the Crack Attack! project at Savannah that I’m not familiar with. I’m no longer familiar with my own code after seven years anyway :-D

I have to confess (and warn you) that patch was the first C++ code I ever wrote, before learning C++ at all. That comes to tell how easy this was, thanks to LibSDL :-)

Thank you very much (Andrew and Kevin) for taking care of my patch to add audio support to Crack Attack! and merge it into the main project.

I want more!

If you have any question, any question about Crack Attack!, that I haven’t already answered here, please don’t ask me. Because, most likely, I won’t know. Instead, check the following related links (most of which I found recently) to contact the right people. I hope that, if anyone, some of them will be the ones who will know ;-)

If you would like to link to this post, please use this link: miguev.net/crack-attack-audio which redirects to this post but does not depend on this site’s structure. I will strive to keep that link working for as long as I keep miguev.net active.