Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: DFSound 1.0.0 - A game log event parser/sound system  (Read 2487 times)

NieXS

  • Bay Watcher
    • View Profile
    • NieXS' Domain
DFSound 1.0.0 - A game log event parser/sound system
« on: July 11, 2010, 06:50:31 pm »


 ____  _____ ____                         _
|  _ \|  ___/ ___|   ___  _   _ _ __   __| |
| | | | |_  \___ \  / _ \| | | | '_ \ / _` |
| |_| |  _|  ___)| | (_) | |_| | | | | (_| |
|____/|_|   |____/  \___/ \__,_|_| |_|\__,_|

By NieXS                       Version 1.0.0


What is DFSound?
DFSound is a game log parser for Dwarf Fortress. It parses the log for events, currently supporting playing music and sound effects. It uses an XML file for event input and a GTK+ GUI for user interaction. DFSound is tested under Linux, but the code is not Linux-dependent and should compile under OS X and Windows.

DFSound comes with a default sound pack. Creating your own packs is easy: you only need to know basic XML syntax and basic Regexes. DFSound can also use SoundSense's sound packs.

Installing/Compiling
DFSound depends on GTK+ 2.0, SDL, SDL-Mixer and libxml2. On Debian-derived distributions, you can install them like this:

Code: [Select]
# apt-get install libgtk-2.0-dev libsdl1.2-dev libsdl-mixer1.2-dev libxml2-dev build-essential
DFSound uses waf for compiling, and thus requires python to be installed during compilation. Using waf is simple:

Code: [Select]
$ ./waf configure --prefix=/home/you
$ ./waf build
$ ./waf install

The executable will then be installed in your ~/bin/ folder. You can also uninstall DFSound easily running ./waf uninstall.

Using DFSound
  • Launch the dfsound file.
  • Pick your gamelog.txt file by clicking on the button under "Log file:".
  • Pick your events file by clicking on the button under "Events:".
  • Click the "Active" button.
  • Wait for events.
  • Have fun!

Creating sound packs
DFSound uses XML files for its events file. Here's a sample file:
Code: [Select]
<?xml version="1.0"?>
<events>
<event pattern="Loading Fortress" default="default">
<music>song_game.ogg</music>
</event>
<event pattern="has given birth to a (boy|girl)">
<sfx>child_birth.ogg</sfx>
</event>
<event pattern="^A vile force of darkness">
<music>siege.mp3</music>
</event>
</events>

The pattern is a Perl-compatible regular expression. These are simple when used for simple things, like this one. You can find plenty of regex information on the internet, for example, in the website http://www.regular-expressions.info.

The "default" attribute is used to make an event the default one, for things like background music.

"music" and "sfx" indicate which songs/sound effects to play. If more than one of them are provided, one is picked at random. Music and SFX must be placed in file_path/music and file_path/sfx, respectively. The supported formats are all that SDL_mixer can play, such as MP3, Ogg Vorbis, WAV files, etc.

Known issues
  • Some random segfaults on corner use cases.
  • Leaks memory after switching event files, so don't switch files like a madman!

Wanted stuff
  • An OS X build.
  • Linux builds, both 32- and 64-bit, for lazy people.
  • More sound effects/less emo music.

Screenshots
Spoiler (click to show/hide)

Download - Version 1.0.0
Default sound pack: http://www.sendspace.com/file/q7nybn

GitHub repo: http://github.com/NieXS/DFSound
Linux 1.0.0 tarball: http://www.sendspace.com/file/cgea2n
Windows 1.0.0 binaries: http://www.sendspace.com/file/dldd3s (requires the GTK+ runtime; if you have X-Chat or Pidgin installed you already have it, otherwise, download it from here.)
« Last Edit: July 12, 2010, 01:18:39 am by NieXS »
Logged

Passive Fist

  • Bay Watcher
  • Builds everything out of cobaltite.
    • View Profile
Re: DFSound 1.0.0 - A game log event parser/sound system
« Reply #1 on: July 11, 2010, 08:17:22 pm »

Do you have a hilights video or anything so we can see how it works during gameplay? I'm not sure I want to learn how to get all the prerequisites set up, although it seems like an awesome tool.
Logged

NieXS

  • Bay Watcher
    • View Profile
    • NieXS' Domain
Re: DFSound 1.0.0 - A game log event parser/sound system
« Reply #2 on: July 11, 2010, 08:32:50 pm »

Do you have a hilights video or anything so we can see how it works during gameplay? I'm not sure I want to learn how to get all the prerequisites set up, although it seems like an awesome tool.
I don't know of any desktop recording tools for Linux; if you could find one, I'd totally record one.

EDIT: Windows version: http://www.sendspace.com/file/tawcdl
It might or not work, I have no experience with cross-compiling.
« Last Edit: July 11, 2010, 10:00:44 pm by NieXS »
Logged

rampaging-poet

  • Bay Watcher
    • View Profile
Re: DFSound 1.0.0 - A game log event parser/sound system
« Reply #3 on: July 11, 2010, 10:37:30 pm »


EDIT: Windows version: http://www.sendspace.com/file/tawcdl
It might or not work, I have no experience with cross-compiling.

As a Windows user who just downloaded it, I can say it doesn't. I tried running it and it immediately exited with the following error message:

Quote from: Error Message
  The procedure entry points png_create_info_struct could not be located in the dynamic link library libpng14-14.dll.

This utility looks awesome, but I just can't get it to run.  I struggled to get it compiled for about an hour before I noticed your edit with a Windows binary. When I finally got waf to do something, it said I didn't have pkg-config, so I downloaded pkg-config and couldn't figure out what to do next. Help please?
Logged
Lame excuse? 'Having a drink instead' is the dwarfiest reason to not get something done, short of accidentally flooding your home with magma. Or intentionally flooding your home with magma.

NieXS

  • Bay Watcher
    • View Profile
    • NieXS' Domain
Re: DFSound 1.0.0 - A game log event parser/sound system
« Reply #4 on: July 11, 2010, 11:17:23 pm »


EDIT: Windows version: http://www.sendspace.com/file/tawcdl
It might or not work, I have no experience with cross-compiling.

As a Windows user who just downloaded it, I can say it doesn't. I tried running it and it immediately exited with the following error message:

Quote from: Error Message
  The procedure entry points png_create_info_struct could not be located in the dynamic link library libpng14-14.dll.

This utility looks awesome, but I just can't get it to run.  I struggled to get it compiled for about an hour before I noticed your edit with a Windows binary. When I finally got waf to do something, it said I didn't have pkg-config, so I downloaded pkg-config and couldn't figure out what to do next. Help please?
Get the latest code from GitHub, I changed the wscript a bit so that it'd cross-compile better. As for the pkg-config issue, its executable must be in the PATH. You'll also need MinGW, GTK+ development libs, SDL and SDL_mixer's, and libxml2's.

I have access to a Windows compy now, so I'll try to build it there.
Logged

rampaging-poet

  • Bay Watcher
    • View Profile
Re: DFSound 1.0.0 - A game log event parser/sound system
« Reply #5 on: July 11, 2010, 11:19:05 pm »

Thanks, I`ll try that.
Logged
Lame excuse? 'Having a drink instead' is the dwarfiest reason to not get something done, short of accidentally flooding your home with magma. Or intentionally flooding your home with magma.

NieXS

  • Bay Watcher
    • View Profile
    • NieXS' Domain
Re: DFSound 1.0.0 - A game log event parser/sound system
« Reply #6 on: July 12, 2010, 12:25:22 am »

UPDATE: Turns out I was packing too litle GTK+ in the zip archive, and forgot to pack the needed codecs. Whoops. Just get the GTK+ runtime from here, installing with the default options, and get the updated windows archive (no GTK+ DLLs included, 6 MB lighter) here. If this does not work for some reason or another, do post here.

EDIT: Whelp, went to all this trouble of adding debug stuff to figure out why there was no sound, then I realized that I was providing the wrong DLL. I've fixed the link. Alternatively, go to http://www.libsdl.org/projects/SDL_mixer/ and get the first win32 zip, and extract it where you put DFSound.
« Last Edit: July 12, 2010, 12:47:31 am by NieXS »
Logged

RavingManiac

  • Bay Watcher
    • View Profile
Re: DFSound 1.0.0 - A game log event parser/sound system
« Reply #7 on: July 12, 2010, 03:56:48 am »

You might want to give credit to SoundSense for inspiration.
Logged
Thief:"Quiet kitty, Qui-"
Cat:"THIEF! Protect the hoard from the skulking filth!"
The resulting party killed 20 dwarves, crippled 2 more and the remaining 9 managed to get along and have a nice party.

rampaging-poet

  • Bay Watcher
    • View Profile
Re: DFSound 1.0.0 - A game log event parser/sound system
« Reply #8 on: July 13, 2010, 12:18:35 am »

Ouch. The latest binary seems to run even worse than the first one. Instead of gracefully terminating with an error message, it immediately bluescreens my computer. The BSOD claims that a system critical process or thread was unexpectedly terminated.
I tried installing gtk+ with the default options and I tried installing the compatibility dlls as well, but my computer crashes every time I run it.
Logged
Lame excuse? 'Having a drink instead' is the dwarfiest reason to not get something done, short of accidentally flooding your home with magma. Or intentionally flooding your home with magma.

NieXS

  • Bay Watcher
    • View Profile
    • NieXS' Domain
Re: DFSound 1.0.0 - A game log event parser/sound system
« Reply #9 on: July 13, 2010, 03:07:48 am »

Ouch. The latest binary seems to run even worse than the first one. Instead of gracefully terminating with an error message, it immediately bluescreens my computer. The BSOD claims that a system critical process or thread was unexpectedly terminated.
I tried installing gtk+ with the default options and I tried installing the compatibility dlls as well, but my computer crashes every time I run it.
That's... strange. It runs perfectly on my windows-running computer.
Logged