Thursday, July 24, 2014

Quake is forever

While I was figuring out how to get gdb for the msp430 to build in Copr, I played around with packaging something simpler, Quakespasm.

While I'm not a big gamer, the Quake series (at least up through Quake III) has always been a favorite (see also: Wolfenstein 3D, Return to Castle Wolfenstein). While the more "modern" Darkplaces Quake engine is already packaged for Fedora, Quakespasm feels much truer to the original. Follow along for a quick setup guide for Quakespasm on Fedora 20.




First, enable my Quakespasm copr repo:


# cd /etc/yum.repos.d 
# wget http://copr.fedoraproject.org/coprs/nielsenb/quakespasm/repo/fedora-20/nielsenb-quakespasm-fedora-20.repo

Next, install Quakespasm with 'yum install quakespasm'.

At this point, the engine should be installed. Copy the 'id1' directory from some other Quake install to '~/.quakespasm'. If you don't have another Quake install (what kind of geek are you?), you can copy 'id1' from a Quake CD or you can extract if from the demo (which obviously, only gives you part of the game).

You are now ready to play:


$ quakespasm


At some point I may update the rpm to include a launcher file, but today is not that day.

Extra credit: the soundtrack

The original soundtrack is important to the game 'feeling' right. It only seems to be available on the CD (both full, and demo). If, like, me, you have lost your CD (both Quake I and Quake II are missing, I've found my Quake III discs...) you can't just pop it in the drive and have the music. Really though, even if you have the disc, that's annoying.

Most people (myself included) have a rip of the soundtrack to mp3 (from who knows how long ago, in embarrassingly low bitrate). However, Copr does not allow for mp3, so Quakespasm is built with only PCM and ogg support for the soundtrack.

Furthermore, apparently the soundtrack is 'pre-emphasized', something surely unbeknownst to me when I did the original rip. So that has to be fixed as well.

So, first, copy your mp3 rips to '~/.quakespasm/id1/music', I assume you are using the filenames 'track02.mp3', 'track03.mp3'...'track11.mp3', if you aren't rename them (note, no 'track01.mp3', that's where the data was).

Now, let's convert the mp3s to de-emphasized ogg files using sox:


$ for f in ./*.mp3; do ffmpeg -i "$f" "${f/%mp3/wav}";\
sox "${f/%mp3/wav}" "${f/%.mp3/}-deemph".wav deemph;\
ffmpeg -i "${f/%.mp3/}-deemph".wav -acodec libvorbis -q:a 6 "${f/%mp3/ogg}";\
rm "${f/%.mp3/}-deemph".wav; rm "${f/%mp3/wav}"; done


Cute right? First, we use ffmpeg to go from mp3 to wav (this assumes you have the right codec installed), then we run the result through sox, generating '*-deemph.wav files, which we then convert to ogg files matching the original names. Finally, we clean up the wav files. If you want, you can remove the leftover mp3 files.


No comments:

Post a Comment