Archive for February, 2009


Now We Wait

There was a bit of a hitch that came up Friday night after I had submitted to Apple. I went out with my wife and one of her friends for a drink after dinner. I was showing Dapple to my wife’s friend, and after 5 minutes of playing the 2 Player mode, he found a bug that no one had found before! Zounds!

Saturday morning I dug into the code (I know, I said I wasn’t going to work on the weekend, but that was assuming I didn’t find a bug like this). The bug looked minor: the mixing guide wasn’t rotating for player 2 (so it was rendering upside down from their point of view). However, as I dug into the bug I realised there was a bigger issue: player 2′s mixing guide was rendering for player 1′s current colour. This meant if player 2 started the 2 Player game and hit the mixing guide, a bunch of empty textures would render because player 1 didn’t have a colour yet. Yuck. The fix was pretty simple and localized (i.e. it was all inside one function in the code), so it was pretty low risk.

I ended up pulling my submission Saturday morning and re-uploading the build to Apple. I don’t think they review on the weekends, so I think it probably cost me a half-day off my submission. I haven’t found any more issues since, so the build should stand as it is now.

People keep asking me how long it will take before the game shows up in the App Store. The short answer is: I don’t know. The longer answer is: I don’t know, because there’s no set turn-around time. I’ve heard of some developers having apps approved in under 48 hours, but others who take over a week. Then, if the app gets rejected, I’ve heard it can take even longer to hear back. Apple will email me when the game is either accepted or rejected, so at least I don’t have to keep clicking ‘reload’ on the app store submission page.

This morning I sent out some emails to various iPhone review/news sites letting them know the game had been submitted, and telling them where to find the latest gameplay video I did last week. I figure it’s not likely any of them will write about it, but at least they’ll know they can expect another press release from me when the game launches…hopefully soon.

Speaking of the press release, I’m about to start working on that so that it’s ready to go out as soon as the game goes live. I also have to start working on my presentation for 360|iDev. I’ve got a rough idea of how I want to structure the talk, but now I need to start writing stuff down.

Owen


Who Needs a Drink?

I just submitted Dapple to Apple for review! 6 months in development from the first prototype to submission. Who needs a drink?!

The submission process was not smooth for me. For some reason I kept getting disconnected from the Apple servers in the middle of trying to upload the game. It happened 4 times in a row. Each time it disconnected me I had to restart the entire process. Finally, I unplugged my router and reset it. Next time through it worked, so it was probably something stupid on my end.

I also ran into a bit of a snag around SKU numbers. It was unclear in the form whether the number had to be unique to my apps, or unique to the entire app store. Here’s hoping something so silly doesn’t get me booted from the review process.

That nagging doubt about the SKU is keeping this from otherwise being a time of pure joy and excitement. I’m still very excited, but that will bug me until I either get rejected or approved. Oh well, it’s out of my hands now! Need to take a deep breath and relax.

I will be sure to let everyone know as soon as the app is live in the App Store!

It’s time to enjoy the weekend! I haven’t taken a whole weekend off work in a while. This should be nice…

Owen


New Walk-Through Video, etc

I spent all day yesterday creating a new gameplay walk-through video for Dapple. It was a fun process, but also frustrating. I really enjoy movie making, especially editing. The frustration came from learning the limitations and foibles of iMovie. I’m used to editing software that offers a lot more control over things, so iMovie takes some getting used to.

However, by the end of the day, I had my movie ready to release. I dropped it on YouTube this morning. You can see it on the Dapple page (www.dapplegame.com) or right here:

It was fun to actually shoot the video with my video camera and get to use my shotgun mic. My previous Dapple video was a screen-grab of the simulator running the game, but I really wanted to show the game running on the device this time.

I was Tweeting about the process while I was working on it and I got a few requests from people to share my experiences. I wrote up a quick tutorial on the steps I took, which you can find via the Tutorials page located in the left side-nav.

In Beta news, Dapple is getting very close to submission. I made one change to the game yesterday (just updating the copyright notices). If no new bugs have been logged by my testers (or by myself) by noon tomorrow, I’m going to submit. Wish me luck!

Owen


Yowza, What a Day!

I spent yesterday tracking the nastiest bug I’ve had on the project. Two of my testers reported a random crash in the game that only happened once in hours of playing. I had them send me their crash logs so that I could look at the callstacks. Both of them had had the game die trying to play a sound effect. Nothing else looked out of the ordinary about the callstacks.

(Aside: whenever an iPhone/iPod touch app crashes, it generates a full crash log on the device that gets transfered to the user’s computer the next time they sync. As a developer, this is incredibly useful. The callstack won’t have any symbol data, unless you gave them a debug build, but as long as you kept your dSYM file for the build you sent out, you can “symbolicate” the crash. There are full details here: iPhone Crash Logs. There are also ways to get symbol data for crashes, if symbolicatecrash doesn’t work, using GDB: Apple Tech Note: CrashReporter — I might write up a tutorial on this if I get some time)

Back to the bug…the first thing I needed to do was figure out how to reproduce the error. I’ve played Dapple for dozens of hours and I had never seen the crash. This worried me. My first reaction was to panic. Then I calmed down. A friend of mine happened to IM me while I was trying to figure out how to tackle the problem. He’s a really smart guy, so I laid out the problem for him. He suggested building some kind of debugger app that I could distribute with Dapple to my testers. Dapple would write out debug information and if it crashed, my testers would launch my debugger app that would pull the debug information out of Dapple and email it to me. This seemed like an interesting idea, but complicated. I started looking into sharing data between apps and then figured there must be something simpler.

I hit up the developer forums and searched the line my game was crashing on (the function was OALSource::Play(), for those who might be experiencing the same thing). Lo and behold, a few other people had the same problem. This is the problem with using Apple’s example code. Granted, they explicitly stated that the code was given “as is” and they made no assurances that it was bug free. I guess the problems we were all having was the reason they pulled that example code off the site.

Someone on the forums had said they thought it was a threading issue with the sound engine code, so they had converted the sound engine to run single thread and the bug seemed to have gone away. Someone else mentioned they thought it was happening when too many sounds were playing. This seemed like a good hypothesis, so I decided to test it.

I inserted a loop into my main update function that would play 2 sounds, 100 times each, every frame. This meant that about 6000 sounds would try to play every second. Then I let that run. After about 30-120 seconds, the game would crash with virtually the same callstack my testers had sent me! Yay! Reproducible! This also seemed to confirm that a high volume of sound could be the cause of the crash. Or, more likely, that starting and stopping the same sound file multiple times per frame was not a good idea.

I went back into the sound engine code and added in some new functionality that does the following: each sound effect now has a flag that says whether or not it has been played during the current frame. When the sound is played, that gets set to true. If another request for the same sound comes through in the same frame, it gets ignored. This doesn’t affect the sound quality of the game, since playing the sound twice during the same frame would sound the same. At the beginning of the next frame all the sound flags are wiped clean again.

I ran my test again (6000 sounds per second) and I let it run for 30 minutes without incident. So, while that’s not 100% guaranteed fixed, it’s enough to convince me that it is. Well, it’s either fixed, or the bug has become so infrequent as to become a non-issue.

After I had the bug fixed, I decided to do some more mem leak testing and discovered a leak in the sound engine when locking my device. This was because of some code in there during sound engine teardown that was doing something silly (I’m simplifying the code to show the problem):

for (UInt32 i = 0; i < soundEffectMap.Size(); i++)
{
    soundEffectMap.removeIndex(0);
}

See the problem? Yeah, that loop only executes through half the map. Say there are 4 elements in your map, after the first time through the loop, i = 1, but there are now 3 elements left. Next time through the loop i = 2, but there are only 2 elements left, so it exits…with 2 elements still in the map!

So I thought I’d be clever and do this instead:

UInt32 mapSize = soundEffectMap.Size();
for (UInt32 i = mapSize - 1; i >= 0; i--)
{
    soundEffectMap.removeIndex(i);
}

But found that my loop never exited at all! Whoops! Dang UInt32, ruining all my fun. See why? i can never be < 0, so the loop never exits. The next time through the loop after i = 0, i = -1, but it’s a UInt, so i = 2^32 – 1, which is clearly greater than 0…and on and on it goes. Changed that to an int. Bob’s your uncle, Fanny’s your aunt!

Now my game is, once again, memory leak free (as far as I can tell), and crash free (as far as I can tell). I sent out a new build to the testers with the fixes last night, so now I’m waiting to hear back on the results.

Today I’m going to create a new gameplay video for Dapple. It should be nice to do something not related to bug fixing.

Owen


Digg it?

If you’ve got a Digg account, I’d appreciate if you’d help me out and Digg my tutorial:

Thanks!

Owen