WebAssembly has reached the Browser Preview milestone.
This mean that all main browsers already support it and WebAssembly already available in regular builds as separate includes options.
What WebAssembly already can - DEMO? http://webassembly.org/demo/
Don’t forget to turn on:
Chrome: “chrome://flags#enable-webassembly”
Firefox: “about:config javascript.options.wasm”
Also
The project is developing rapidly - in one year was achieved status MVP and Browser Preview.
Supported by leading manufacturers of browsers under the auspices of the W3C
So
I ask cocos2d-x team - plz. add support of WebAssembly
I ask community to support this request - to show how important this for us - just add comment with your thoughts.
Just imagine - with WebAssembly game porting for web will be no harder than for current planforms.
I agree. It’s likely a v4.x feature, and if it’s not a rewrite, but just incremental changes replacing the core renderer over time then Wasm could be supported at any point in the future. BGFX is one possibility (and the new swift engine Fiber based on cocos2d is an example of this).
The core team currently seems to have a path to move developers to write games in Javascript instead where it can then use either the WebGL engine or the native runtime wrapper.
@Boby Emscripten is a compiler (LLVM-based). WebAssembly (Wasm) can be thought of as a standardized version of asm.js. So the process would likely be fixing issues with cocos2d-x so that it (engine + 3rd party libs) can be built with Emscripten into asm.js now and in the future Wasm.
@stevetranby Thx. for links - really interesting articles.
@Boby - In a simplified form the difference is:
Emscripten generates JavaScript that use Asm.js
WebAssembly generates bytecode that “directly” runs in browsers.
one codebase that supports mobile, desktop, and web
the speed that comes from compiled code
access to c/c++ libraries
I think that if/when cocos2d-x starts adding more 3d support (and shouldnt we change the name to just cocos-X then?) that WA will start making more and more sense.
This would have to come from the community. There’s very little chance Chukong will work on this feature.
It’s probably smarter to replace the renderer with SDL or BGFX instead of trying to get the engine to compile.
If someone is already working on this with the latest 3.15 code revision that’d be great. It’s possible to get it compiling, but it may or may not take quite a bit of tedious work??
I keep looking into it, and simple OpenGL examples are easily ported to emscripten, but the cocos2d code base has a lot of extra libraries/frameworks that must support it.
Would love to hear of any progress, but I am not holding my breath. Prob smarter to move to Urho3D or other engine if it’s a feature you need. Or just port to cocos-js/creator
Yep, i used PerformanceSpriteTest, WASM is about 50% quicker then cocos2d-html5, and takes less memory. But there is a problem that, all codes in a wasm file, and all resources in a data file which makes loading much slower than cocos2d-html5.
I also want to upvote this feature request. My C++ App is available on all platforms except the web and too large already to be easily rewritten in Javascript. WebAssembly would be a major benefit for my App.