Jump to content

Javascript Canvas / Smart Phones


Ron2015
 Share

Recommended Posts

Hi I have messed around with 2d game programming in the past and have been thinking about getting back into it.  I have been wondering... since I hear people saying HTML5 is compatible with smartphones.. Can javascript/canvas games be sold in app stores? Or do they need to be played on a web browser on those devices? Thanks for any information.  This forum is awesome btw, I will be sticking around.

Link to comment
Share on other sites

What you can do is wrap the html5/javascript into a native app. See the list of tools below. I've only worked with Cordova/Phonegap (find the difference game etc) and CocoonJS (submarine game) btw.

 

Cordova (aka PhoneGap) the most well known html5/javascript wrapper.

CocoonJS based on Cordova but optimized for canvas speed

Crosswalk I'm not sure what Crosswalk does exactly, but it looks like a set of tools to work and debug Cordova apps

Ejecta (part of Impact js toolset) a wrapper but only available for iOS

GameMaker not a wrapper but an integrated development tool that can also export to html5/js.

gles.js (w.i.p.?) a lightweight WebGL renderer for Android, looked very promising but unfortunately there haven't been any updates after september 2014.

 

So yes, it's possible but wrapping html5/js as a native app is not ideal in my opinion. It requires a lot of work and even then it won't match performance and integration when compared to real native apps (meaning apps created specifically for Android or iPhone using Eclipse, Android Studio or XCode).

Link to comment
Share on other sites

Great list.  Another to add is:

 

Intel XDK a helper / SDK for wrapping various options, including Cordova and Crosswalk. Can be used very simply to wrap HTML5 game in a few mins.

 

To pick up on BdR's point, Crosswalk Project is a way to ensure that the webview (in an App) has modern features and runs in a consistent way.  Pretty much like the opposite of HTML5 development for mobile browser ;)  It's Android only at this time iirc - make sure to use this option if using XDK.

Link to comment
Share on other sites

Thank you so much both of you for the rich responses.  

 

Please let me know if I understood correctly:    HTML5 / Canvas games can basically be embedded into an 'app', but the performance would not match that of a game programmed directly into the app. Is this accurate?

 

I apologize for such basic questions, I am trying to figure out the best avenue for myself.  I am already familiar with JavaScript and have made a couple small games for fun.  

 

When I found this website and saw HTML5 game dev I assumed everyone on here is probably developing games that run on phones and tablets, Is this forum mainly for games that run on browsers? Mobile browsers?  I am a bit confused still as you can see...

 

Edit:

 

@BdR I just noticed in your signature that you have a few HTML5 games listed.  When I click on it, I find myself at the Google App store, the screenshots seem like they are being played on a mobile device.  Am I right in assuming "HTML5" games are created using Javascript / Canvas?  I'm asking because you mentioned that your opinion was "html5/js as a native app is not ideal".

 

Edit2:

 

Sliding snakes is awesome!

Link to comment
Share on other sites

Running canvas/html5 games on Android will probably never provide as good as a performance as compared to proper native apps imo. Though support for html5 games on Android has gotten ALOT better in the past few years.

Though their still playable, and there is various examples of this. :) 3D games don't work too well at all though...

 

If you don't really want to go through the effort of using something like PhoneGap, Cordova or just the basic Webview but still want to use Javascript for game programming and want good performance you could look into the game engine Unity. 

Link to comment
Share on other sites

When I found this website and saw HTML5 game dev I assumed everyone on here is probably developing games that run on phones and tablets, Is this forum mainly for games that run on browsers? Mobile browsers?  I am a bit confused still as you can see...

This is a good question, I wonder too how many users actually play html5 games in their browser (on desktop or phone) and how an avarage user would find the games. I myself was only interested in wrapping a game as native app, so I could add a banner and put the app in the app store. Another option for making some money off a game is to licence your game to a gaming website. I don't know anything about licencing html5 games, but I can only guess it's similar to licencing a Flash game to a Flash games websites.

 

@BdR I just noticed in your signature that you have a few HTML5 games listed.  When I click on it, I find myself at the Google App store, the screenshots seem like they are being played on a mobile device.  Am I right in assuming "HTML5" games are created using Javascript / Canvas?  I'm asking because you mentioned that your opinion was "html5/js as a native app is not ideal".

 

Yes that's correct Tap-Tap Submarine is a html5javascript game which is wrapped using CocoonJS. Arrow Slider, Find The Difference, Break The Code are also html5 games but wrapped natively using Phonegap/Cordova. Almost all of the animation etc in these last 3 games is DOM manipulation using jQuery, so moving and resizing and hiding DIVs and manipulating CSS etc, and drawing to the canvas is kept to a minimum. Snake Slider and Triple Dutch are not html5 games, they are created using GLBasic, which is OpenGL based and compiles to native code.

 

Sliding snakes is awesome!

 

Thanks always nice to hear  :) 

Link to comment
Share on other sites

Please let me know if I understood correctly:    HTML5 / Canvas games can basically be embedded into an 'app', but the performance would not match that of a game programmed directly into the app. Is this accurate?

 

 

Yes HTML5 content can be easily embedded into a native app, making a "hybrid" app.

 

Performance really depends on the device and which WebView is used to render the HTML.  Relying on the default WebView is typically fine for Android > 4.2 iirc, whereas for anything prior to that performance (and capabilities) are roulette.  Often better to embed CrossWalk into the app, it replaces the default WebView (to the equivalent of latest Chromium) and provides improved performance and richer capabilities.  Is that going to match true native?  It really depends on the game, and how well the native game being compared to was optimized.

 

Running canvas/html5 games on Android will probably never provide as good as a performance as compared to proper native apps imo. Though support for html5 games on Android has gotten ALOT better in the past few years.

Though their still playable, and there is various examples of this. :) 3D games don't work too well at all though...

 

Technically there's no big problem with hybrid and 3D (on modern devices).  I think the question shifts to whether it makes sense to build an elaborate 3D game without an elaborate 3D GDK (like Unity)?  And, if not, whether that game would benefit from being played in browser (desktop and / or mobile) to warrant the extra hassle?

 

e.g. Facebook games using HTML5 for desktop and wrapped as hybrid for mobile.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...