Alon Zakai, creator of Emscripten, writes about compiling C and C++ to JavaScript and WebAssembly.
HN links it for WebAssembly performance numbers, such as WasmBoxC sandboxing overhead, and for demos like BananaBread showing 3D games on the web.
> First, let’s discard the HTML5 Fullscreen API, it sounds great at first since it provides a fullscreen canvas without any browser window chrome. In reality it is quite useless however, since fullscreen mode must be activated from an input handler, and even then a warning is printed which has a different look and feel on each browser. The kicker is though that the Fullscreen API isn’t supported on iOS Safari (last I checked).
In my own WebGL applications, I support the HTML Fullscreen API, with a shim on iOS that cheats the data that indicates the call succeeded. Since the majority of people are not-iOS (i.e. desktop-of-any-OS or Android), there's no reason for them to receive a shitty experience just because Apple can't be arsed to implement web standards.
> Emscripten’s soft fullscreen ... only has one downside: when activated, it hides all other HTML elements on the page, so it can’t be used together with an HTML UI which should hover on top of the WebGL canvas.
For this among a few reasons, I'm also trying to get rid of all of my HTML UI elements. I have a few buttons left for triggering fullscreen mode, but they will soon be gone. The initial setup is harder--it's so easy to just drop in a new HTML element--but maintaining a consistent look and feel across platforms is easier if you are using only one graphics toolkit. It also makes spinning up new projects a little easier, as again, only one UI toolkit with which to bother.
> emscripten_get_element_css_size()
The…
Most web-based games will probably remain to be in 2D (for multiple reasons, including development cost and accessibility), but 3D games on the web are certainly performant enough.
To give one example, bananabread is a tech demo showing off what can be done with asm.js and WebGL (performance is likely to get even better with WASM):
http://kripken.github.io/misc-js-benchmarks/banana/index.html
As for whether a VM has an overhead compared to native, of course it does, but you're not going to convince anyone of your viewpoint by stating something that's already obvious to us all. The performance of web-based games doesn't have to be the best, it just has to 'good enough'. I personally don't think we'll fast adoption of WebVR, but I'm glad it exists as it helps to have it as a goal to improve 3D performance, almost certainly leading to reducing the performance overhead of browsers (as low latency is a key component of a good VR experience).
Anybody had any experience with code translator programs that say they can take a program in one language and translate it into another. This would greatly reduce the time and cost of rewriting my app from .Net to web-based, but sounds too good to be true.
Such as ( I have no relation/interest): "Emscripten is an LLVM-based project that compiles C and C++ into highly-optimizable JavaScript in asm.js format. This lets you run C and C++ on the web at near-native speed, without plugins. http://kripken.github.io/emscripten-site/index.html
Emscripten can be used to compile almost any portable C++/C code to JavaScript. http://kripken.github.io/emscripten-site/docs/porting/guidelines/portability_guidelines.html#code-portability-guidelines "
Any thoughts would be helpful. As I said, these sound too good to be true, but worth asking the experts about!
"Well since then, Chrome and Firefox have been going back and forth on which is the fastest. At this moment Firefox is a good margin faster than Chrome since their Electrolysis update."
In benchmarks, yes.
But in the real world, with many different tabs open, where one badly designed website could screw up your whole surfing experience, not so much.
Even thoug it is possible that they fied that behavior by now. I don't know, because since that repeatedly happened, I switched to chrome.
edit: oh and about specific performance I know and care about at the moment, because I work with those technologies is that:
http://kripken.github.io/box2d.js/webgl_demo/box2d.html?500
On my system (Archlinux) chromium runs much faster than firefox.
I'm developing a game with React Native [1], and I have a single codebase that works on iOS, Android, Windows, and web (via react-native-web, although it needs a lot of work.)
I've had to write a few 'native modules' for various platforms, but it has to be platform-specific code anyway (e.g. ad networks, in-app purchases, game services)
I've been looking for a way to write some native code that I can compile to JS, and have decided to use C (or C++) with emscripten [2]. Rust or Kotlin might be fun, but I'm comfortable with C and it's easy to compile for iOS, Android (NDK), and Windows.
[1] https://sudoblock.com
[2] http://kripken.github.io/emscripten-site/
It's very laggy on my phone too. (Several seconds input delay.) That's fairly normal for a game made in React though (at least the ones I've tried). Is the paid version also made in React?
For some context, my phone is old (2016) but I do find it amusing that it can run this page with a physics engine and 3D rendering without any lag http://kripken.github.io/box2d.js/demo/webgl/box2d.html
Your game looks great though, and the website matches it perfectly! Nice work
(As an aside, I'd urge you to take the from-scratch ethos just one step further and make you next game without any libraries, or with sensible exceptions like Howler and Pixi.)