Sunday, March 22, 2009

Digging around in iPhone IPA

After syncing your iPhone / iPod Touch with iTunes, take a look in the ~/Music/iTunes/MobileApplications folder. Here are all the applications you have purchased and downloaded. Perhaps not so obvious is that an IPA is a ZIP file in disguise. Make a copy of the IPA and throw it onto your desktop. Rename it so that it has a .zip extension. Double click it to uncompress the ZIP. Now you'll have a folder with some content. The iTunesArtwork is a 512x512 JPG. It's the icon that the iTunes store and iTunes Application browser use. Rename it with a .jpg extension and double click it to open it and check it out in all its glory.

The Payload folder contains the actual program and more interestingly its resources. To look at it you'll have to right click and ask to Show Package Contents. You should copy all the contents and put them into a new folder on your desktop so that you can easily sort and work with them.

At this point you'll be able to see all the goodies inside the IPA. In this case I'm looking at Pocket God v10. What can I see? Well, it has about 2MB in graphics. The graphics are contained within two very large atlas files. Most developers do not go to the effort of creating atlas files, not even KP funded ngmoco.

There are 26MB of audio in 75 files. Five of those files contain 22.2MB in music. This is an interesting discovery since playing the game I don't think all of the music is used. They aren't compressing the audio either these are just plain little-endian CAF files. These two things give us part of the story about why the version 10 Pocket God is about 25MB compressed in the store. At that size, the download is over the 10MB mobile download limit and is probably loosing impulse buyers to the CBS NCAA application. (And March Madness?)

The PNG images you see in any IPA are not in the usual format. There are in a proprietary format that is optimized for the graphics hardware on the device. A conversion tool such as iPhonePNG will have to be used to convert them into something you can use with a normal PNG viewer. As of this writing the PNG conversion tools are not compatible with the large PNG files found in applications like Pocket God.

Finally, the last interesting tidbit looking into this IPA is the use of XML to script the animations and sounds. This is the first application I've seen taking this approach. It emphasizes BoltCreative's background in scripted languages and suggests the potential for the BoltCreative game engine to quickly and easily support products beyond Pocket God.

Labels:

Monday, March 2, 2009

Info.plist tricks

Often developers miss out on a couple of tricks that can clean up the way the application looks while launching. Admittedly thse adjustments can be made programatically within an early function such as applicationDidFinishLaunching; however, it's visually appealing to make changes prior to the splash or loading screen. There is only one way to do that and it's the Info.plist file.

Orientation

Usually iPhone / iPod Touch applications launch in a portrait mode. Games and web browsers may instead want to launch into a landscape mode. Most developers use landscape right mode. But it's worth noting that the external speaker is often very easily covered by the right palm when the device is in landscape right mode. It's worth considering landscape left orientation as well.

Edit the Info.plist file. Add a key called UIInterfaceOrientation. Set the value to UIInterfaceOrientationLandscapeRight. Other possible values are UIInterfaceOrientationPortrait, UIInterfaceOrientationPortraitUpsideDown, and UIInterfaceOrientationLandscapeLeft.

Status bar

It's always nice to grab more screen real estate and that little bit at the top that's wasted for the status bar for the time and cellular carrier strength is easy pickin's.

Again, edit the Info.plist file. Add a key called UIStatusBarHidden. Set the value to YES.

It might also be the case that it's appealing to retain the status bar for some reason but the application has a dark color pallet. In this case you won't want the default high brightness white status bar. Edit Info.plist again, this time add a key called UIStatusBarStyle with a value of UIStatusBarStyleBlackOpaque or UIStatusBarStyleBlackTranslucent.

Labels:

Monday, February 23, 2009

20 year old game grosses $3/4m in iPhone remake


"iShoot, a top-selling iPhone app that was a best-seller for weeks and has now earned the man more than $700,000 ".
http://tech.yahoo.com/blogs/null/124073

Interesting. It's just a clone of a game that appeared in the mid 80s called Tank Wars. The Scorched Earth PC game from the early 90s is the one I remember playing. The most memorable feature was a special hidden key combination where it would yell out "No Kabitzing!" I suppose the idea was to put down opponents that were ganging up. Wow, it doesn't seem all that long ago when the idea of a "LAN party" was to sit side-by-side at the computer with your brother and battle it out with tanks.

If a game once had replay value and appeal it probably still does. It's a great argument for putting the mind into park and simply bringing clones back from the dead. Classic game play will always be appealing for new generations.

Labels: ,

iPhone app-dumping

Familiarize yourself with File Juicer. This application will dig through a binary finding all the text, images, movies, and sounds in any file. This is particularly revealing with iPhone applications. After syncing your iDevice, point File Juicer at the IPAs appearing in your ~/Music/iTunes/ MobileApplications folder.

The images to the right are from BoltCreative's Pocket God. The game is fun and the developers are great guys.

With File Juicer you'll get some insight into how some developers choose to build their tile sets and fonts. I was looking at the Rolando dump and a couple of things immediately struck me. First there is at least one easter egg in there. Secondly, HandCircus chose to repetitively duplicate screens over and over for localizations. Unclear why they didn't leave the screens void of text and localize at run time by drawing the fonts. This would have greatly reduced the binary image footprint.

Labels: ,

The Clumsy CrashLander

I can see why Apple removed the CrashLanding sources from the iPhone developer's area. People were using it to create game engines and that wasn't really the intention with it. It was just a quick and dirty demo of the Text2D wrapper for OpenGL and the SoundEngine wrapper for OpenAL. It didn't support a tile atlas, object oriented sprites, a proper frame thread, correctly working collision detect, compressed audio, or a properly configured accelerometer. Apple probably got tired of people reporting bugs against it and using it as a core for so many games. Even I have a few open bugs with Apple against it still.


Labels: , ,

Wednesday, February 18, 2009

Apple Store "In Review"


The first time we submitted an application for review with Apple it took nearly a week to be approved and another day to actually propagate into iTunes. It takes another day before those changes are propagated through all the seven iTunes stores worldwide.

After your first application, the second application and updates to applications usually take just a few business days.

We recently submitted Abby Crabby 1.2 to iTMS. A few days into the process we had an additional change we wanted to get in under the wire. There is a process to leave the submission be but reject the binary. We tried it and pushed a new binary.

The question was this... does this delay your release? The application is still standing, it's just that the binary is changing. Certainly Apple hadn't actually gotten to reviewing or running anything yet. Well I believe we have an answer, it seems that you go back to the end of the line. It's been almost a week now since the 1.2 submission and it's still "In Review".

The lesson here is, never reject a binary. Wait for it to appear in the store and submit yet another version.

Labels:

Sunday, February 15, 2009

OpenAL for iPhone does not support HRTF.


HRTF is the head related transform function used in three dimensional audio that models the shape of the head and ears. HRTF basically enables a low pass filter when the sound source is behind you making it sound as if... it were behind you.

In oalTouch (Apple's OpenAL demo source) the sound is the same when the source is either behind or in front of the listener. This seemed strange so I reported it as a bug to Apple (Problem ID: 6576577 in fact). I also noticed that the same problem exists on the Mac OSX Cocca native with the PIGE-OpenAL demo.

Got my answer today... "Engineering has determined this issue behaves as intended based on the following information: Please note that OpenAL doesn't support HRTF rendering."

This is disappointing. It means OpenAL only supports fading left to right and volume. It doesn't really take advantage of all the 3D positioning information. The phone certainly has the horsepower to do the computations for HRTF.

Labels: , , ,

Rolando sources


Through some digging around I found that ngmoco's Rolando "platformer" game uses the Box2D physics engine. Box2D is open source, but doesn't have an iPhone port. Since Hand Circus used this open source and modified it they must release the modifications under the GPL. One of the changes they made was to accept accelerometer input for a general force vector on all objects in the simulated world.

The sources are available here:
http://sourceforge.net/projects/box2d

It's not Rolando, but the demonstrations of the Box2D physics engine are inspiring for new game ideas.

Labels: , , , , ,

Saturday, February 14, 2009

Linking your way to the top!

Here are a few iTunes link strategies that appear to be largely underutilized by the community.


Web links that *always* work


It has always struck me as strange that the big brand name players can't figure out how to make an iTunes Application link from their website that actually works on the phone! The 1.1 software had a kink of sorts that made it especially hard. But there is one trick that always works. Use a link that does a search.

Ignore iTMS Link Maker, which tells you to use: http://itunes.apple.com/WebObjects/MZStore.woa/ wa/viewSoftware?id=000000000

Instead use: http://ax.search.itunes.apple.com/WebObjects/MZSearch.woa/ wa/search? media=software&term=Your%20Application%20Name%20Here

This even works for a 1.0 release where you don't yet have a software ID from Apple.


Brand name synergy


Applications under your brand name have sales synergy. Foster this by putting a button in your application that links to all your applications in your brand. Again use a search.

NSString *link=@" http://ax.search.itunes.apple.com/WebObjects/MZSearch.woa /wa/search?media=software&term=My%20Company";

[[UIApplication sharedApplication] openURL:[NSURL URLWithString: link]];


Live and die by reviews


Getting reviews (even bad ones) is important for your application's ranking. The problem is that people don't often review their applications. Based on my sales, I'd say 1 in 100 actually review. Put a button into your application that sends people directly to the appropriate App Store review screen.

NSString *link=@" http://itunes.apple.com/WebObjects/MZStore.woa /wa/viewContentsUserReviews?type=Purple+Software&id=000000000"

Side note, "Purple" was the internal iPhone code name.


mailTo links

You may be using openURL and mailto to send email from your application. If the content of your email contains an iTMS link it will certainly contain the '&' ampersand symbol. This will not work as iPhone's mailto will truncate the link and your iTMS link won't work.

Instead put a simple URL into the email that redirects to the real iTMS link. You could use TinyURL or host your own redirect. If you host the redirect yourself you can track the click through.

Labels: ,

Sunday, February 1, 2009

Compressing audio

During the initial development of Abby Crabby our binary (application size) swelled to about 10MB. We became concerned knowing that applications over 10MB cannot be purchased over cellular connections and yet we still had a good deal more sound and graphics to put into the game. Impulse buys are lost if buyers are forced to desktop iTunes to make their purchases.

I met the CEO of PlayScreen on LinkedIn a while back. We've had some great conversations about the iPhone market. He passed me some promotional codes for his applications and I looked them over. Pigs A Popn is my favorite of the bunch, but recently Bounce Trap Tilt has been getting some attention as an iTunes featured application.

The secret for being featured? According to William it was just a matter of updating the application to meet user requests. You can read more about it on his blog. One of the things mentioned there is "a new audio driver and shrunk the game from 26MB to 9.3MB". He had also taken my advice on audio compression!

The Apple's OpenAL example sources use uncompressed CAF files (little endian AIFF files) only. We were using these sources. Our size budget was nearly blown after we added our in-game and menu sound tracks. The way around these issues is to switch to a compressed audio IMA4 format. Existing CAF files can be converted with usr/bin/afconvert at the command line on a development machine. From there the OpenAL wrappers in the application must be modified to read and uncompress the audio at application launch. The IMA4 to CAF conversion achieves a compression of about 4:1. The Abby Crabby binary dropped from 10MB to 2.5MB without any perceivable difference in operation to the user. This provided plenty of headroom for more sounds and graphics while still remaining under the 10MB mobile download limit.

Labels: , , , ,