Jump to content
  • Advertisement
Sign in to follow this  
francoisdiy

JavaScript Games on Android Phones

This topic is 2165 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Recently I've been workin on a project called C-Lesh which is an interpreter written in JavaScript to develop games on mobile devices. (as of now) I have tested it on Android 2.2 (Froyo) and up and things seem to run at top speed. I bring this up because I am wondering if anyone has attempted games in JavaScript and put them on Android phones. From my own experience mobile phones can run JavaScript very fast, like C# or Python because of the native code compilation. Now here's my other question: If I were to convert the bytecode of my language, C-Lesh, to javascript and place it in an eval() statement would this also compile to native code? I'm thinking about generating JavaScript from bytecode for a speed boost. For anyone who wants to see how C-Lesh work please check out my site. But seriously, answering the latter of the two questions would be of great help to me.

Share this post


Link to post
Share on other sites
Advertisement
I did a quick evaluation of using JavaScript + WebGL on Android and iOS, with the prospect of writing cross-platform games for desktop, web, iOS and Android using the same JavaScript codebase. The brief report can be read here. The summary is that I found JavaScript+WebGL to be too slow on Android phones, and WebGL virtually unsupported by mobile browsers, both Android and iOS. I do not know how much of the slowness was caused by WebGL portion specifically, and how JavaScript without WebGL would work on Android.

After that, I switched the strategy to developing a cross-platform C++ codebase, which works with native performance on all of the platforms I am interested in. To bring the C++ codebase over to web, I use the emscripten compiler. It is not perfect, but results so far have been positive. Some tests: QuadTree.html: click anywhere with a mouse, Geometry.html, aabb_obb_sphere.html, SceneView.html: use WSAD and arrows to move around.

Most JS engines nowadays have some form of JIT support. Even then, I am most certain that JavaScript on web browsers is not JITted to native code that would have the same performance as when the code had been written natively to start with. The above samples all run at 60fps on my Android Tegra3 device (when compiled to native Android applications), but if I try to run them in a web browser on that Tegra3, I get performance ranging at 2-10fps (try yourself if you have an Android phone, I'm interested in hearing how other devices fare). The mobile Opera web browser was the only one I could find with WebGL support.

I tried to find more information in the web site you pasted, but the links seemed to be locked behind a password.

Share this post


Link to post
Share on other sites

I did a quick evaluation of using JavaScript + WebGL


Tell me, how's everything with WebGL? last I checked only a couple of browsers supported it, and IE refused to support it.

I was very interested some time ago on that particular technology, but forgot about it.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!