HTML5 to phone
- hallsofvallhalla
- Site Admin
- Posts: 12023
- Joined: Wed Apr 22, 2009 11:29 pm
HTML5 to phone
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.
Re: HTML5 to phone
I've heard of tons of good thnigs about PhoneGap
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: HTML5 to phone
Phone Gap is actually rather slow for games. I believe the best option out there now is CocoonJS.
The indelible lord of tl;dr
Re: HTML5 to phone
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.
Re: HTML5 to phone
How does Phonegap work? Does it cross compile, or use an HTML5 wrapper?
Re: HTML5 to phone
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.Cayle wrote:How does Phonegap work? Does it cross compile, or use an HTML5 wrapper?
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/
Re: HTML5 to phone
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.
- hallsofvallhalla
- Site Admin
- Posts: 12023
- Joined: Wed Apr 22, 2009 11:29 pm
Re: HTML5 to phone
Cocoonjs looks perfect thanks!
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: HTML5 to phone
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.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.
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.
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.hallsofvallhalla wrote:Cocoonjs looks perfect thanks!
The indelible lord of tl;dr