HTML5 to phone

For discussions about game development that does not fit in any of the other topics.
Post Reply
User avatar
hallsofvallhalla
Site Admin
Posts: 12023
Joined: Wed Apr 22, 2009 11:29 pm

HTML5 to phone

Post by hallsofvallhalla »

Been a while since I have converted HTML5 to phone apps. Was using appmobi before but wanted to see if anyone has any suggestions or using any current solution.
User avatar
Xaos
Posts: 940
Joined: Wed Jan 11, 2012 4:01 am

Re: HTML5 to phone

Post by Xaos »

I've heard of tons of good thnigs about PhoneGap
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: HTML5 to phone

Post by Jackolantern »

Phone Gap is actually rather slow for games. I believe the best option out there now is CocoonJS.
The indelible lord of tl;dr
User avatar
Script47
Posts: 147
Joined: Thu Nov 21, 2013 6:11 pm

Re: HTML5 to phone

Post by Script47 »

I've used PhoneGap and I found it very easy. I didn't actually release the app I was making but I plan to make one soon using PhoneGap. I have also heard of CocoonJS and like Jack I've been advised to use that for more "intensive" games. I've not tried that yet because I've not really made anything that big or planned anything big up till now. As for a negative point for PhoneGap, I personally find it to be a chore to set it up. As it says put different files in different folders when them files aren't there. So each time I had to scour the internet to try and find the files or the code itself to make the files then - sometimes the files are outdated so that sucks too. Other than that, I enjoyed it and found it quite cool.
Cayle
Posts: 272
Joined: Fri Jul 03, 2009 4:45 am

Re: HTML5 to phone

Post by Cayle »

How does Phonegap work? Does it cross compile, or use an HTML5 wrapper?
User avatar
Script47
Posts: 147
Joined: Thu Nov 21, 2013 6:11 pm

Re: HTML5 to phone

Post by Script47 »

Cayle wrote:How does Phonegap work? Does it cross compile, or use an HTML5 wrapper?
I've never really looked in to that but I have always thought they have sort of wrapper. The PhoneGap source code is available to see if you want. I did find these links below. Was a decent read.

http://stackoverflow.com/questions/1080 ... negap-work

http://arnab.ch/blog/2011/12/phonegap-how-does-it-work/

http://phonegap.com/2012/05/02/phonegap ... -visually/
Cayle
Posts: 272
Joined: Fri Jul 03, 2009 4:45 am

Re: HTML5 to phone

Post by Cayle »

So basically your app is a dedicated browser, hosting your javascript content. I know of a couple of cross compiling dev environments; one for c# (forgot the name) and one for Python (kivy). There is likely one for js as well.
User avatar
hallsofvallhalla
Site Admin
Posts: 12023
Joined: Wed Apr 22, 2009 11:29 pm

Re: HTML5 to phone

Post by hallsofvallhalla »

Cocoonjs looks perfect thanks!
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: HTML5 to phone

Post by Jackolantern »

Cayle wrote:So basically your app is a dedicated browser, hosting your javascript content. I know of a couple of cross compiling dev environments; one for c# (forgot the name) and one for Python (kivy). There is likely one for js as well.
Yes, PhoneGap is essentially a browser wrapper. It has a custom built browser engine in it as an installable mobile app. It basically injects your web app into the installable mobile browser and calls that your app. PhoneGap supports a DOM. Loop-based games run terribly with PhoneGap with pretty much unacceptable performance. However, PhoneGap works great with traditional mobile apps, and has a giant mountain of apps that have been made with it.

CocoonJS is a bit different. For most of its life, it did not offer a DOM at all, and projected all Canvas content to an OpenGL wrapper. That is why it is so much faster than PhoneGap for games. Recently CocoonJS did launch a more traditional web app conversion system. The difference is that this new option supports a DOM to power traditional apps. I think they just launched this a couple of months ago. They claim even supporting a DOM that their system still beats PhoneGap hands-down, likely because they are still using OpenGL to power the apps.

Another point that CocoonJS has over PhoneGap, particularly for games, is audio. For anyone who has tried to run a browser-based HTML5 game on a mobile browser knows that sound is screwed-up. That is because the HTML5 Audio tag can only play one sound, and each browser tab only has one audio channel. This is obviously not acceptable for games, where you need at least 2 (one for background music, and one for sound effects), and probably a lot more for sound effects to overlap. The way most games currently solve this issue is by loading up multiple invisible iframes based on how many channels you need and the sound effects you need to play. However, this doesn't work on mobile because of the way apps are handled (in Android, for example, each tab is a separate Linux user on the system core). They can't interact like that. Since CocoonJS is breaking down your browser-based code and essentially rendering and executing it in a different way (using OpenGL), it executes sounds differently as well. The same can't be said about PhoneGap which is still relying on a browser under the hood.
hallsofvallhalla wrote:Cocoonjs looks perfect thanks!
Sounds like a good choice, Halls! CocoonJS really is head-and-shoulders above most other solutions presently. One of their goals was to make you alter your underlying code as little as possible, which, if you ever tried out App Mobi's XDK, you will know can be a terrible burden.
The indelible lord of tl;dr
Post Reply

Return to “General Development”