Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm developing small game using c++ and OpenGL. I would like to post it also in Chrome Web Store.

I've seen that a lot of apps are just redirection to specific url. I can use Java Applet and JNI to launch it in chrome, but that would be only waste of memory.

share|improve this question
    
Yes it is possible. –  Lo Sauer Nov 6 '13 at 19:21

3 Answers 3

up vote 3 down vote accepted

For best results, you'll want to create a port of your application. A quick (and probably dirty) way to do that might be using Google native client (allows running natively compiled code in the browser).

Otherwise you'll have to take the long road of porting your code from C++ to Javascript Dart or pure HTML5.

share|improve this answer
    
+1 for native client, almost a -1 For even suggesting that porting to JS/HTML5 is a sane thing to do. JS is horrible for games; check out Dart at the very least if you want to go the "pure HTML5" route. –  Sean Middleditch Aug 3 '12 at 21:58
    
@seanmiddleditch Good points, I haven't used Javascript for much. Good to know it's something to stay away from. Modified the answer to reflect that. –  Byte56 Aug 4 '12 at 0:55

Emscripten is the best way to do this as of today. It can compile pure C++ code into a subset of JavaScript called asm.js which is very efficient and can be even further optimized. As of today only Firefox has explicit optimizations for asm.js, but the compiled code will run (quite well) on every major up-to-date browser (even IE!) and can be used in the Chrome Web Store.

It requires that you use OpenGL ES 2.0 for graphics (since it uses WebGL in the translation, which is roughly equivalent to GLES2). It is easy to use SDL for windowing and input as Emscripten natively supports bindings for that, though some other common toolkits are also supported; for any other libraries you'd need to do the binding yourself. I/O, audio, networking, and so on are supported. Threading is not yet supported but work is underway to handle it.

There are a few small things you need to do for a basic port (especially regarding the main loop, as JavaScript has its own internal main loop you must use) and more advanced applications may need some additional special porting work, but in general it's not too bad.

Note that even big game engines like Unreal have been ported to the Web via Emscripten, so it's very much a viable and production-ready toolset.

There are some other C++-to-JS transpilers out there, but Emscripten is the most well-known and developed right now.

share|improve this answer
1  
Interesting as emscripten it is, Firefox-only makes it a poor choice for the Chrome store, no? –  Seth Battin Nov 6 '13 at 21:54
    
@SethBattin: It's not Firefox only. –  Sean Middleditch Nov 6 '13 at 22:51
    
Edit noted :) I recalled that was previously a limitation of the Unreal demo. –  Seth Battin Nov 6 '13 at 23:47
    
Yeah, that was as I recall a bug in the version of Chrome out when the demo dropped, not a fundamental incompatibility or missing feature. –  Sean Middleditch Nov 7 '13 at 0:08

Of course, Google's Webstore policy allows it.

There are many offerings which require an additional native executable to be installed by the user in order to aid the browser extension with information.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.