Mailing List

Archive for the 'Sound' Category


Dapple Update (pun intended)
Friday, March 27th, 2009

I haven’t really been posting much this week because I’ve been working on Dapple. I thought I’d provide a little update on what I’ve been doing. I’m working on a Dapple Update. Yes, the word update is confusing in this first paragraph. Let me try that again: I’m working on version 1.1 of Dapple and Dapple Lite.

There were a couple of key things I wanted to address with Dapple’s first update:

1) Reduce app footprint to under 10MB

When an app is over 10MB, users with a cell phone connection aren’t able to download the app directly. Apps that are over 10MB require a Wi-Fi connection to download. I think this is potentially costing me quite a few downloads, mostly of the Lite version. I want the Lite version to be something that people can download on a whim. If they have to wait until they have Wi-Fi access, they might never download it.

Dapple and Dapple Lite were both about 13.1MB, so I needed to reduce them by nearly a 1/3. When I looked at the sizes of my various directories, it became clear that the music and SFX files were the ones causing the problem. Dapple has about 13-14 minutes of music that plays in the game. That amounts to significant file sizes. There are also 14 SFX files.

I’m going to get a little bit technical here, so if you don’t care for this stuff, just skip ahead a bit. The iPhone does have a hardware audio decoder. You can use it to hardware accelerate your MP3, AAC, etc decoding. However, it can only operate on one file at a time. This means if you’re ever going to play more than one sound at once, you have to use two forms of audio decoding. For Dapple, I use AAC compression for the background music, but all the SFX files need to be in a non-encoded format: Linear PCM. This means that the SFX files are huge, because they’re basically 16-bit uncompressed audio data.

For v1.0 of Dapple, all the music was encoded as AAC, 128kbps, constant bit rate, so that it sounded really good. I decided I would try to reduce the bit rate as much as possible without sacrificing the audio quality too much. By switching to a variable bit rate, I was able to compress the files much more without too much of a quality reduction. By doing this, I was able to reduce the music file sizes from 8.7MB to 6MB! Almost there already!

That was the easy part, now I needed to deal with my SFX. The iPhone documentation infers that if you’re not using a hardware decoded format you should be using Linear PCM or IMA 4:1. IMA4 (which I’ll refer to is as from now on) is a compression format for audio that results in a nearly 4:1 compression (it’s actually closer to 3.75:1). I converted all of my SFX files to IMA4 and was surprised to discover that none of them played. This is because there’s no native support for IMA4 on the iPhone. You can use it, but you have to write your own decompression code. I ended up scouring the net looking for information on the IMA4 data format, how the compression works, and how to decompress it. I found several partial resources, none of which were complete enough to just let me implement it. It took me two solid days of some pretty hardcore coding (it was really fun, actually), but I finally got IMA4 working in Dapple. The nice thing about IMA4 is that the file gets decompressed when it’s loaded into memory, and is then played as Linear PCM. This means there’s no performance hit, except on file load. (I’ll link to some of the IMA4 resources I found at the bottom of the post)

IMA4 was a huge win. My SFX files totaled about 2.2MB on disk before compression. After compression, they’re just over 600KB, with almost no loss in sound quality.

So, after rebuilding and zipping, both Dapple and Dapple Lite sit at about 9.5MB! Hooray! What’s next?

2) Fix an audio bug

This is the only bug that’s come up more than once since the game launched. If a user is playing their own iPod music while playing Dapple, then locks their device, their iPod music stops playing. This was a problem in how I was managing audio sessions in the game. This has now been fixed.

3) Add a Feedback Button

I want to make it easier for people to provide me with feedback on the game. I changed the Main Menu around so that the “Credits” button now says “Extras”. This opens a new menu which has “Feedback” and “Credits” in it. The feedback button, when clicked, launches the Mail program and lets the user send me an email. Hopefully people will use it to request features, complain about things they don’t like, etc.

4) Add a computer-controlled opponent for 2 Player Mode

This is a request I’ve had from a lot of different players, so I decided to try to put it into the first update. As of last night, I can actually play a game against a computer opponent. It’s pretty cool. However, the computer opponent is really stupid right now.

The way Dapple already works is that when a player starts their turn, the game searches the board and picks a random spot that will make a match. This is stored for when the hint arrow needs to be displayed. I figured I could make use of that code and just make a computer opponent execute a move there on its turn, instead of displaying a hint arrow.

This lead me to an interesting discovery: it works, the computer can play, but the computer opponent sucks at the game. In 10 games I played against the computer last night, I won every single game. What I found interesting about this is that this proves that making random moves in Dapple isn’t nearly as effective as thinking your plays through. I’ve had a small number of negative reviews (either on the web, or on the App Store), and the complaint is usually that they feel like playing randomly yields the same results as thinking their moves through. With a random computer opponent pitted against a player who thinks their moves through, the human player will almost always win. To me, this is proof that the game can be learned, that you can get better at it, and that strategy will win over randomness. Up until now, that’s what I believed, but I couldn’t prove it…

So today my goal is to try to encode some of the choices I make when looking for the best play to build a heuristic that the AI opponent can use. Then I’ll need to tune how much it uses that heuristic for various difficulty levels. Should be fun!

With any luck, I should be able to submit Dapple and Dapple Lite v1.1 by Monday.

Owen

IMA4 Resources:

  • www.wooji-juice.com – A good starting point, as this article walks through the high-level steps required to get IMA4 decompression working. However, this article leaves out a lot of steps that are necessary to get things working. It is also not very clear on the differences between mono and stereo audio streams and how that affects the packets.
  • wiki.multimedia.cx – Contains useful optimizations that allow you to avoid doing byte->float conversions to do floating-point math.
  • wiki.multimedia.cx – Has some useful information on byte/nibble structure of the packets
  • www.koders.com – Actual C code for doing the decoding. This is for quicktime IMA4, so some of the logistics of how you extract chunks of data won’t work, but the actual math for decoding each nibble into a 16-bit frame should be the same for you.
Breaking my Own Rules
Monday, January 19th, 2009

Back at the end of November I posted about some new rules I had made for my work-life. Basically, I had said that I wasn’t going to do work, or read work emails after 7:00 PM each night. I had also decided that I wasn’t going to work on weekends. All of that went out the window last week.

As I get closer to submission I’m working more and more. Last week I did several nights of working late and I worked a half day on Saturday, and a few hours on Sunday. I’m already paying for it. I haven’t been sleeping well again. The problem is that when I work late, I can’t stop thinking about work, even when I’m supposed to be sleeping. I end up lying awake at night going over things in my head instead of falling asleep. So I’m not really sure what to do. On the one hand, I need to be putting in this extra time right now, but on the other hand, I do like to get some sleep.

The good news is that by working a bit on the weekend I was able to wrap up the Timed Mode for the game. I managed to put in a bunch of new animations including: a countdown animation when you start a timed game, some beeping sounds when your time’s running out (that get more frantic as you get closer to “time’s up”), and a new Game Over animation that differentiates between losing because there were no more moves and because you ran out of time.

I’m quite pleased with how the Timed Mode turned out and I’m also pleased with how long it took to implement it. It took about 3.5 full days of coding to get it all in and working, with all the new animations, UI, etc.

Yesterday I started planning out the 2-Player mode that I want to add this week. The biggest problem I’m running into is the screen layout. The screen is pretty tight in single-player modes for displaying critical information, but now I need to display info for 2 players. So yesterday I spent a few hours mucking around in image editing software playing with the layout. I think I’ve got something that should work. Now I’ve just got to build it and see.

I’ve given myself until the end of the week (i.e. Sunday) to implement this new mode. That’s about as long as I can afford to take and not risk delaying the project significantly. It feels like I should be able to do it. Here’s hoping I’m right.

Owen

Productive Day
Thursday, January 8th, 2009

Since I fixed my audio problems I’ve been quite productive. I’ve tackled a lot of small problems over the last day and a half. Here’s what I’ve done since yesterday at lunch:

  • Dropped the final music and sound fx into the game – the sfx have been balanced against the music levels now.
  • Created a new interface for playing sound fx so that I can play them from anywhere in the game.
  • Added sound fx to all the front-end menus and widgets.
  • Implemented a tips system for first-time players that brings up information as events trigger in the game.
  • Added an option to the Options menu that allows users to reset the tips.
  • Went through all of the textures in the game and ensured that their widths and heights were all an even number of pixels – I had noticed some blurriness in a bunch of textures, which turned out to be because of the way the UV mapping is done on textures with odd widths/heights.
  • Updated the multiplier animation to use the nice font and tuned the animation to be more smooth.
  • Removed a bunch of dead code that wasn’t being used anymore.
  • Fixed a bug in the board initialization code when launching the game at harder difficulties.

It feels good to get lots of little things done. It’s all these little things that make a real difference to the feel of the game.

Owen

Audio Woes Become Audio Woos!
Wednesday, January 7th, 2009

Sweet merciful crap, I’ve finally got my audio working properly! It took me 3 days of trying things before finally figuring it out. Even after I simplified things (as Bemmu had suggested in the comments to an earlier post), I still ran into a bunch of problems that would have prevented me from shipping the game. I’ve finally fixed it all, and in its simplified form I think things work much more intuitively, so that’s a bonus.

Now the audio for the game works like this:

  • If the user is playing iPod music when the game launches, it plays the game’s sound fx, but uses the iPod music.
  • If the user is not playing iPod music when the game launches, it plays the custom game music along with the game’s sound fx.
  • If the user brings up the iPod music controls mid-game and starts playing their own music, the game will stop playing its music and let them play theirs instead.
  • If the user brings up the iPod music controls mid-game and stops playing their own music, the game will start playing the custom game music again.

If you have an iPhone developer account and want to see the details (including code snippets) of what happened and how I fixed it, you can see the thread on the forums here: Audio Session Problems (devforums.apple.com – Note: You must have an iPhone developer login to access this page).

I’m very pleased with how well this works. I think it makes the game feel much more polished, as it puts control into the users’ hands and lets them play how they want to play.

Next up this afternoon: adding sfx to the front-end menus.

Owen

How Much Hair Pulled Out is too Much?
Tuesday, January 6th, 2009

My audio issues are becoming increasing frustrating. This morning I decided I would try to simplify things. I had seen other apps handle the music thing like this: if the user is playing their own music when the game starts, let their music keep playing; if the user isn’t playing music when the game starts, play the game’s music. I figured this would be easier to implement (and it should be).

I got curious about how other games handle things like this: start the game with no music playing, then attempt to start music via the quick music pop-up (double-tap the home button to bring it up anywhere on your iPhone/iPod touch) once the game is running (this causes my game to hang right now). I started going through other games on my iPod touch and tried combinations of starting with and without music. I ended up with all sorts of problems: games freezing, music refusing to play, the iPod’s music player jumping around between albums even though it’s not set on random, games playing music the first time I boot them, but then refusing to play music and refusing to accept touch events the next time I boot them.

For example, I booted Rolando while my own music was playing. The game kept playing my music and allowed me to play fine. I quit the game and stopped my music. When I reentered Rolando, no music played (including game music) and touch events had a 5-10 second delay on them rendering the game unplayable. It seems unlikely that this is a problem with the game as I experienced similar behaviour with other games. This is what I like to call “Good Times”.

In short: I’m not sure my iPod touch is stable anymore. I’m wondering if some of the bugs I was seeing are problems with the iPod? Or perhaps my bugs caused problems with the iPod? I’m tempted to do a hardware restore and see if things become more stable. Rebooting the device doesn’t seem to be helping much.

In non-audio related news, Gamasutra has a feature article up today about iPhone game development in 2009:

Now if you’ll excuse me, I’ve got an iPod touch to wipe out.

Owen

Home | News | Games | Store | Press | Blog | About | Contact
©2008 Streaming Colour Studios

Powered by WordPress with Streaming Colour Studios theme designed by Chris Picheca.
Entries and comments feeds.