Tutorial – Porting my webOS game to iPhone with Phonegap PART 11

Get Bubble Puzzle

We can now manage scenes so that we can create a game menu system.

The other things we need to do is offer persistent storage so that we can save high scores, user progression, etc.

I used Mojo cookies. I no longer have this available to me.

So what to do – webkit’s local storage….

Read more »

Advertisements

Tutorial – Porting my webOS game to iPhone with Phonegap PART 10

Get Bubble Puzzle

Was busy with the job last week. Work travel sucks.

But at least I got a few quiet hours on the plane to knock together a scene manager.

It’s rough but here we go.

Palm has Mojo. Here’s my very rough effort – Mofo….
Read more »

Tutorial – Porting my webOS game to iPhone with Phonegap PART 9

Get Bubble Puzzle

This will be a short one hopefully. Just want to stop and catch my breath.

So let’s sum up my findings so far regarding iPhone performance with phoneGap for my game, Bubble Puzzle. Anyone, whether they are porting from webOS or not, should bare the following points in mind:

1. Use native js event listeners. Event listening via prototype was poor. I saw a phonegap post the other day that someone was complaining about performance for another framework. So it’s probably safest to stick with native js, but test yourself. It would be good to hear.

2. Webkit transitions perform poorly on iphone when operating on a number of objects. Avoid it.

3. Ironically script.aculo.us performs better than webkit. This is ironic because script.aculo.us requires that prototype is included as a library in your app.

4. Avoid too many setTimeouts. Too many will kill performance. I have about 2-3 setTimeouts going in my event management but I stopped using them for fx.

5. Overall I think you are better to use the game loop for transition fx and any other fx you may have. You are looping anyway and can check the game state to set fx in motion as required. Only problem is that this is an ugly way to program, and also means you must write your own fx.

6. Use the phoneGap js handles to leverage the awesome audio capabilities of the iPhoneOS. When you tie in great audio and graphic fx together you get something special. To be honest there is a little lag when the fx run in my game but because they are very appealing you don’t notice the lag so much.

In terms of specific potholes to look out for when porting from webOS to phoneGap on iPhone then consider the following:

1. The Mojo framework probably needs to be removed (certainly for Palm device specific interfaces). So if you’ve used alot of Mojo calls for event management, scene management, sounds, lists, etc then you’re probably going to have a bit of a rewrite. But maybe it will work. And you still have a problem because I believe it is proprietary.

2. When I wrote my game initially I tried to use prototypejs where possible because the Mojo docs were not good and because prototype is open source. I still used Mojo for scene management and sound. Its scene management features are great.

3. But as mentioned above I stopped using prototype for event management. | am really only planning now to try and use it for scene presentation as long as it performs.

4. So my own real problem to complete the port is replacing Mojo scene management with an alternative.

And this leaves me off nicely to what my next several blogs will be about: developing my own scene manager in prototype or GMP.

Get Bubble Puzzle

Weekly News Roundup

Google beats Microsoft in smartphones -Gartner

Google unveils Android 2.2, Froyo, in escalating war against Apple

Smartphone Demand Spurs Handset Sales

Operators need ‘aggressive’ deals with developers to succeed in apps

Tutorial – Porting my webOS game to iPhone with Phonegap PART 8

Get Bubble Puzzle

SO! Let me explain how to get kick ass fx on your phonegap game for iphone.

You need to use the game loop and try to avoid further expensive loop calls that are going to loop the DOM listening for stuff.

Use what you have to do the listening for you.

The only problem is that the code (at least the way I do it) is ugly and breaks alot of best practices. If there’s any elegant js coders out there please give me some ideas.
Read more »

Tutorial – Porting my webOS game to iPhone with Phonegap PART 7

Get Bubble Puzzle

Despite the talk that the iPhone is hardware accelerated for webkit transition effects, I find they suck for my game

Script.aculo.us, as I see it, is a better performer.

And better still…..

Well we have a game loop anyway so let’s leverage that and stop wasting valuable resource…

Yes folks – this is the best way to get decent performance for your phonegap game on the iPhone and it looks better too.

Read more »

Weekly News Roundup

RIM stays top dog in OS battle, Android tops Apple for No. 2

Palm Pre set for May 16 launch at AT&T Mobility

Android 2.2 Could Up Speed for Mobile Devices, Add Adobe Flash

Tutorial – Porting my webOS game to iPhone with Phonegap PART 6

Get Bubble Puzzle

So still trying some tricks to get game performance up on the iphone with phonegap.

MY main problem is that webkit transition opacity effects are too expensive, and unreliable.

Script.aculo.us is more reliable but still slow (not too bad though).

So I wanted to try the sprite sheet technique. Currently all my game images are separate files but you can also put all your images into one file – a sprite sheet. Why? Well in the old 8 bit days sprite sheets were apparently used to save space and minimize requests. On the limited resources of a mobile phone it makes sense to apply these techniques.
Read more »

Tutorial – Porting my webOS game to iPhone with Phonegap PART 5

Get Bubble Puzzle

In this post, I bring you the results of my performance test. The results are quite unexpected.

I had led myself to believe that minimization was the answer to sluggish performance in the iphone port of webOS game – Bubble Puzzle.

This, in fact, did  not prove to be the case.

Read on to find out the real cause ……..

Read more »

Tutorial – Porting my webOS game to iPhone with Phonegap PART 4

Get Bubble Puzzle

So I had promised to come back with some performance results. The problem is I need to think about how to benchmark. And indeed the best way to test may be just to kick back for a few days and play the game under varying conditions to see if my “optimized” version is really superior.

Whilst I do that I thought I’d just update you quickly on how to use google closure compiler to minimize your javascript files. I am minimizing to try and optimize game performance but it’s also good to minimize to protect your code (remember anyone can see your js code in a browser) and/or to optimize download performance in a web site (particularly useful for mobile phone browsing).

Read more »