Wasn’t in my plans, but…

So I haven’t been working too much on PhotoFile, like wanted to, but I haven’t really been unproductive, either. Giving in to my friend’s incessant nagging to play (and thus, set up) UFO2000 on my computer, I updated the Ubuntu set-up guide I wrote on the forums after doing it again with the latest version on both my laptop (Gutsy beta) and my desktop (Feisty). I’ve played a couple games, so far, and they’ve been fun. But it still doesn’t work flawlessly. On my laptop, with default Gutsy settings, ALSA is used to access the audio. UFO2K uses the Allegro game programming library, and it accurately detects and plays sound on my laptop. However, there is a huge memory leak somewhere when running on my laptop (known issue, I think). Luckily, the game is saved on the server, so if you crash, you can log back in and you have the option of resuming the game. Cool.

On the Desktop side of things, there’s no memory leak, but it doesn’t work with the PulseAudio sound server. This irritated me last time I was looking at UFO2K and put me off of it, but this time, I was determined to figure out what the problem was, exactly. First of all, the problem can be resolved by killing the pulseaudio (pulseaudio -k) daemon before launching the game. But that may mess with your existing applications a little and it’s annoying. Good news: I think I found what the problem was. Bad news: I’m not sure when or if it will be fixed, but the developers are at least aware of it and started talking about it.

I don’t normally do much low-level stuff, so I actually learned quite a bit from the debugging. Unfortunately, I don’t have massive amounts of code to show for my efforts, but I’ve learned a lot and a potentially important bug has been well-documented. So it was well worth it. These are some of the things I did when debugging this problem:

  • Communicated with both PulseAudio and Allegro developers on bug trackers, mailing lists, and IRC.
  • Built the Allegro source and used my own custom (debug-enabled) version without disrupting the installed stable version.
  • Attempted to debug using ‘gdb’ mode in emacs, but I was never able to jump into the ALSA specific functions. I think the debugger wasn’t able to trace the threads as they were mapped with pre-processor statements according to the sound driver. I was able to switch to the thread, but the debugger couldn’t find the associated source, which made stepping rather pointless.
  • Eventually giving up on the fancy way, (but content I had learned something) I resorted to good ‘ol printf statements, and was eventually able to find the values (I think) are causing the problems. (Allegro uses unsigned sample formats, and PulseAudio doesn’t support those.)

I must say, using gdb in emacs is much easier than on the command line (but then, maybe ddd or another graphical debugger is nicer still, depending on how often you debug things). Okay, directing my attention back over to PhotoFile…. Or maybe upgrading WordPress…. or maybe…. 🙂

Information about this entry:

2 Comments on “Wasn’t in my plans, but…”

  1. popeko Says:

    or learning how to play ufo2k effectively enough to be a challenge…


  2. Steve Says:

    In due time… In due time. 🙂

Leave a Comment

Allowed code: <a href="" title="">, <abbr title="">, <acronym title="">, <b>, <blockquote cite="">, <cite>, <code>, <del datetime="">, <em>, <i>, <q cite="">, <s>, <strike>, <strong>