1) Created a 2d Canvas the size of the screen resolution of a bookmarked webapp on the iPhone (320×460) and grabbed the context
2) Started a heartbeat timer that would optimally go off every 10 ms with setInterval()
3) Every time the heartbeat fired, change a random RGB value one point either up or down (also randomly)
4) Repaint the screen with the new value to show animation working and display the number of times the heartbeat fired in the past second (Frames Per Second)
In other words, I wanted to measure the FPS I could crank out of the iPhone without doing anything else. If the FPS was in the 10-20 range, the type of animations I’d be able to support in a game would be much more limited than if the FPS was in the 40-60 range. Here’s what I got on my iPhone 3GS:
83 frames per second. Which is about 5FPS slower than my Chrome desktop can put out. And conventional wisdom for PC game development is that anything beyond 60FPS hits the diminishing returns curve pretty hard.
Of course, this is with ABSOLUTELY NOTHING else the app has to handle, so it’s not time to pop any champagne corks yet. But a critical first hurdle has been passed. Hooray!
Yes, Universe, you’re absolutely right. We should consider Android devices as well.
The world works in mysterious ways. Literally as I was in the middle of writing up that last post, my Google+ feed exploded with the news that Google has released a version of Chrome for Android. This is supergreat news for HTML5 development on Android and I’m thrilled. Really. I’m not at all upset that I probably need to go get myself an Android phone now, and neither is my wallet. More to come, this is a pretty major development for HTML5 mobile apps, seriously.
[UPDATE] Mashable is pointing out that only about 1% of Android devices have Android 4.0 on them and thus can support (this release of) Chrome. At least that makes the device testing simpler, doesn’t it?
This may be crazy. The little computer in my pants is possibly the best thing ever invented, but it’s not exactly the speediest processor available. Full games are beginning to show up in HTML5 for modern browsers like Cut the Rope or Fieldrunners, but it’s a long way from a PC desktop browser to the mobile platform. However, if all goes well, for reasons that will be quite clear later, the iPhone is the clear platform for this game.
2) Setting up the App Store as a required gateway for users to download or buy iOS applications. I know Steve Jobs was notorious in his micromanagement, but this is absurd. Let the users decide which apps they do or do not want on their phone. Apple should give their developers access to the OS and get out of the way. Let app developers build for your platform and let your users decide which apps they want without interference. By inserting the App Store as a middleman, Apple sets itself up as censor for all content on the device, which adds a whole new layer of repugnancy to the system. Oh, but that’s right, Apple has…
3) Profit motive. At the time of this writing, Apple had just released an obscenely impressive earnings report, showing that the company is now sitting on a pile of cash which, all by itself, is worth more than all but 52 companies on the planet. Which, you know, great! Good on Apple. They build a good product and should be rewarded for it. But when you’re sitting on all that money and raking more in every quarter, it makes it hard for me to sympathize with the 30% pound of flesh Apple requires of all iOS developers and publishers. As much as we hear it from GOP millionaires running for public office, I really am a small-time indie developer trying to earn a living for my family. Honestly, I’ll consider myself lucky if I can get that far. I literally can’t afford needing to earn 30% more in order to break even. Apple obviously doesn’t need it either, so at the end of the day they’re just being greedy jerks. Screw ‘em.
So! Hostility aside, that’s why we’re here, writing about HTML5 on Apple devices. This is the brave new world of giving iPhone users the choice of which applications they want to run on their iPhones and give iPhone developers a better chance to earn a sustainable living writing for the iPhone ecosystem. The reason I started this blog in the first place was because I wanted to share my discoveries with other developers so that more developers can follow. I want more apps for my phone, too. I want to pay the developers of those apps their fair share for their work. Let’s figure this out together.