I’m making a mobile game that has some complex game logic. I’d like to code the logic in JavaScript so that I can run it in a browser, and a server on node.js. However, I think I also need the logic to run on the mobile client (iOS / Android). Is there a way to run JS on iOS / Android, so that I don’t have to write and maintain three separate code bases for one game rules?
I looked at PhoneGap.
Does anyone who’s used PhoneGap recommend this, or vice versa?
My goal is to minimize having to maintain two or three codebases whenever the game rules are slightly modified.
One way to approach this is to build your application with JavaScript using a mobile JS framework (Sencha Touch, jQuery Mobile), then wrap it using PhoneGap (as you said) or a similar product, such as Titanium Mobile. This process is mostly painless, and can easily be automated.
As long as your application isn’t complex graphically (such as a game) or require significant client-side computation, I would this is the best approach to writing cross-platform mobile applications.