This blog is going into mothballs. Follow my new dev blogging exploits at bunnyhero dev 2013 series personal compublog.
Flixel is a free, open source 2D game engine built in ActionScript 3, from Adam Atomic, creator of Canabalt and other games. I became especially curious about Flixel ever since the iOS version of Canabalt went open source at the end of 2010. Both the Flash and iOS versions of Canabalt use Flixel. I understand that the iOS port of Flixel is still early, and from what I can tell, documentation for the iOS port is essentially nonexistent as of yet.
Regardless, here is my plan:
…all while blogging about the experience, of course. At least, that’s the idea — no promises that I’ll actually get very far! If I get really ambitious I might even write a tutorial at some point.
Getting started with Flixel was pretty easy, thanks to the “Hello, World” tutorials available on the Flash Game Dojo wiki (which appears to be the main documentation hub for Flixel). After that I wasn’t sure where to go next, since the documentation is a bit scattered and disorganized. I did find some great info on the Github project page and wiki, which oddly is not linked to from the Flixel home page (as I said, a bit scattered). Perhaps Flash Game Dojo is where all the action is supposed to be now? I’m not really sure.
What I’m finding most helpful right now are the very simple example games, complete with source code, provided by Adam Atomic, which are a great help to see how the framework expects things to be set up. The FlxTeroids source code is instructive, as well as EZPlatformer (which has a nice tutorial with it).
Despite the disorganization, there is a lot of good information out there, including the very active forums (which I’ve not yet explored).
One bit of info I couldn’t find was what units the FlxObject class uses for velocity and acceleration. I did a quick experiment, and it turns out that velocity is in pixels per second, and acceleration is in pixels per second per second — all very sensible, but it wasn’t explicitly stated anywhere I could find. Similarly, the angle and angularVelocity members are in degrees (not radians) and degrees per second.
This has been a bit of a rambling blog post (I, too, am a bit scattered!). Next I decide on what kind of game to make (something very simple) and start making it! Along the way I will share what I’ve learned.
It’s a black art… if you can even get it to work.
Back in the iPhone OS 3.x days, I would stare longingly at the Settings bundles in Apple’s built-in iPhone apps:
If an app wanted explanatory text in the Settings app, you pretty much had to make do with Titles and Group titles. Ugly.
It turns out that in iOS 4.0 and higher, Apple allowed for third-party apps to have descriptive text too. And I only found out about this last week (I noticed its use in the Ladidude app).
The longer descriptive text is called “Footer text” in Apple’s nomenclature, and can be attached to any Group. To add your own, do the following:
If your app is compatible with iPhone OS 3.x as well, not to worry: the extra FooterText key is simply ignored on pre-iOS4 devices.
iOS 4.0 came with the ability to distribute your ad hoc apps over the air, which is very convenient for testers. More details are available on Apple’s website. Unfortunately, doing this manually can be a bit of a hassle, partly because the everything in the XML manifest requires absolute URLs.
I’ve created a PHP script that makes this task somewhat easier.
A web server that runs PHP 5 with the following extensions:
.IPAfile of your app, built using Xcode’s “Build & Archive” command (no spaces in the filename)
.mobileprovisionfile (again, no spaces in the filename)
The directory structure should look like this:
That’s it. I admit the code is a bit of a mess, as it was hacked together relatively quickly. I haven’t been able to get it working when there are spaces in the names of the files or directories. Perhaps someone else can fix that :)
This code uses the very useful CFPropertyList PHP library by Rodney Rehm to parse the Info.plist file that’s in the IPA, to extract all the info required by the XML manifest. That’s how the magic happens.
So here I was, testing push notifications on various devices. I plugged in the old iPod touch (which had been out of juice for a few weeks) and ran the app on it in the Xcode debugger.
But something odd was happening. After my appDelegate called
registerForRemoteNotificationTypes:, I was not getting any response callback at all; neither
application: didRegisterForRemoteNotificationsWithDeviceToken: nor
application: didFailToRegisterForRemoteNotificationsWithError: was being called. That’s right, not even an error callback.
Meanwhile, the code was working fine on my iPhone. A few quick Google searches didn’t turn up anything very useful, except for one suggestion to try installing another app from the app store that used push notifications. I figured that would at least be good for a test.
I launched the App Store app, and tried to download Boxcar. I immediately got this alert:
Aha! Of course. Because the iPod touch’s battery had died, its clock had been reset to 1969, and thus could not make an SSL connection to Apple’s servers. Setting the iPod’s clock to the correct data and time fixed the issue: push notifications were now working correctly.
I just thought I’d document this in the off chance that it might help someone else :)
Thank you again Stack Overflow, for telling me why the Apple Push Notification service SSL Certificate Assistant (on the iOS Provisioning Portal) kept rejecting my certificate signing request.
It turns out that for whatever reason, if you try uploading your certificate signing request using Chrome, it will fail with an error (Chrome bug? site bug?). So: use Safari (or Firefox, apparently, based on the comments)!
So after almost 3 weeks I’m finally feeling close to normal. Whiskey tango foxtrot! Plague from hell.
That means there’s no way I could get anything approved for the app store before October ends. I suppose, in theory, I could get something ready to at least submit by then, but that means completing a whole game in a week’s time. It’s possible, but to be honest I’m not sure if I’m up to it.
I’m off to a terrible start, unfortunately :( This month started off very busy, with little time for me to work on the challenge, and now I’ve been struck down with some kind of plague that makes it very difficult to concentrate on anything for any length of time.
All I’ve got so far are two rectangles on the screen. In theory, this will become a gameplay prototype. In practice… it’s two rectangles on the screen.
I sure hope I get better quick. Not going to give up just yet. In the meantime, I think I’ll just go and have a little lie down somewhere.