views:

337

answers:

3

So, I understand that it's possible to set up in-app purchases for iPhone apps to purchase non-consumables like game levels. I understand the logic behind the purchase part, but what I don't understand is, how can I deliver the new game level.

For example: I build an app that contains the first level and they purchase additional levels. Is it better to build all the other levels into the app and whenever they purchase the app, it unlocks it with a plist entry or something? That doesn't seem very update-able to me. Every time I come up with a new level, I'd have to update the app.

So, what I don't understand then, is what is how do I package up a level and download it as a separate entity that can accessed by the game? Would the level just be some XML with images in a ZIP folder or something? How does the level get added to the game? What are best practices for this type of thing?

I Googled and have found NOTHING about this. I'm a little bit confused by the concept and any help would be appreciated. I'm not looking for someone to write the game for me, I just need pointed in the right direction so I can develop it on my own.

A: 

I would read over the In-App Purchase Programming Guide. It has all the info you need.

In summary: a user will perform the in-app purchase and get a digital receipt from Apple. Your iPhone application should then contact your server to download the new levels, using the receipt as a verification of purchase.

If you don't have a server available to distribute your levels, you might want to consider a third-party service such as UrbanAirship.

Ben S
That's not really the aspect I was confused about. I read the Programming Guide before I posted here. I get the logic behind the actual purchasing, etc. What I don't get is what the game levels actually consist of. My brain just has a disconnect and I'm trying to reconcile that.
lewiguez
If you don't even have what the game levels consist of yet, you don't have a game yet. In which case you have the cart wayyyyy before the horse here. Get something working and these questions will answer themselves.
Nick Veys
A: 

Your game level is whatever you want it to be; you are the designer, after all.

You should look at NSBundle documentation, which can include property lists, image resources (etc) as well as additional code. Package your bundle (zip is convenient), download asynchronously using NSURLConnection, and install be checking the NSDocuments directory for bundles and load with NSBundle.

Or for a simple game level using existing resources, just download a plist that describes it.

You don't need to have your own server; you can download from me.com if you have a MobileMe account, or any similar service.

Paul Lynch
Thanks! I read through the docs and this is pretty helpful. Although, it doesn't answer ALL my questions. I'll just have to play around a bit in XCode, I think, so I can get the hang of it.One thing to note though: according to the iPhone OS Reference, NSBundles cannot contain executable code. Only data (images, videos, sound, text, etc.) resources.
lewiguez
Yes, I think you're right - MacOSX bundles can, though, and the docs are almost the same.
Paul Lynch
A: 

Hi,kind of an old post ,but still have some confusion on the subject. In the case where my additional game levels have logic ,so each level comes as a module with its code and all ,there isnt any way to download them and integrate dynamically after an in app purchase?Would it have to be an update on the app and then just unlock the levels which you already have locally after a in app purchase? Thanks

tasos