A few months ago RIM decided to add native C++ support to the Playbook. Our ears perked up a little. Then they gave out a ton of Playbooks to developers at GDC and we managed to snag a couple. We're always working on a dozen things at once so we didn't do anything with them. Then we ran into some RIM folks at MassDiGI, who pointed out that there aren't any 3d snowboarding games out! Time to port!!!
The Playbook SDK is a custom install of Eclipse, which we're pretty familiar with from Android development. It really didn't take long to get a sample Hello World app up and running. One point of confusion I ran into is there are template C apps, but the only option for C++ is an empty app. I tried modifying one of the C apps to use C++ and never got anywhere. I ended up starting over with an empty C++ app and adding a basic empty class to get it to compile. It took me the better portion of a day to figure out how to get it to recognize C++ classes without compile errors, which 5 minutes with someone who knows what he's doing could have prevented.
Next up was getting all our platform-independent code to compile. This consists of right clicking the navigator window, import files from file system, and clicking the "create links in workspace" checkbox under advanced. This imports the files as symbolic links, so no need to duplicate! Eclipse likes to have everything live under the project directory so I was a little worried about that part.
Then I had to set the include directories. It took me a long time to find the right place, though it sounds fairly obvious. Right click the project and go to properties. Then under "C++ Build" click "Settings", "QCC Compiler", and "Preprocessor". If I added directories from the workspace it didn't follow the symbolic links, so instead I had to add from file system. When I did this, Katie couldn't compile because we were including files in "/users/Yrgol/...". The fix for this is to include relative to the "${PWD}" directory. After that, we had our engine compiling! Time to add the platform layer.
The platform layer was actually the simplest one that I've seen. Our entire Blackberry-specific codebase is 1500 lines long. We had to add libjpeg and libpng texture loaders, and alut sound loaders. We used sample code to initialize our OpenGL context. The main loop is very simple and reminds me of old Windows programming, where we spin in a for loop and ask for system events every frame. This is way easier than plugging into the event model that iOS and Android use.
It seems like the Playbook NDK is a little more sensitive compared to other platforms, which is good and bad. Porting exposed several null pointer accesses that somehow weren't causing crashes elsewhere. It also exposed a leak in how we managed textures! I won't be neglecting to call glDeleteTextures anymore.
Assets are added to the project by creating a directory under your project directory on the file system, and dropping your files in. There's an extra step of letting the packager know which files you want to include by editing the "bar-descriptor.xml" file. Big Mountain Snowboarding has about 400 data files, and I entered them by hand before finding the correct way to do this. Double click the bar-descriptor.xml file, then click the assets tab. When I do this nothing shows up, but if I resize the window magic appears. You then have a GUI with an easy way to add all your data files.
Lots of debugging later and it's time to submit, but not so fast! First you have to get your publishing account approved, which seems to be a manual process. If I had known this I would have applied at the start of the port instead of the end. First you have to submit a request, wait 48 hours, then submit some documentation, and wait another 48 hours. I don't think their account approval team works weekends.
The submission process itself is fairly pain-free. The only real annoyance was I had to create a PayPal account in order to sell apps. I'm a bit wary due to various stories of PayPal deciding to just seize other developers money in the past, but no choice. I'll try not to leave too much in the PayPal account at any time if we actually make any sales.
You have to create a large promo graphic, and upload up to 50(!) screenshots at no larger than 640x640. I'm not sure why the 640 limit exists considering the playbook is 1024x600, but it shouldn't be that big a deal. It would be nice if they also included an option to include a video like Google Market. I can't say anything about being on the app store yet or if anyone actually buys the apps considering only one of our apps has been out for less than a day.
No comments:
Post a Comment