Live data from Hacker News

Running WASI binaries from your HTML using Web Components

runno.dev

61–70 of 73 posts

Re: Running WASI binaries from your HTML using Web Components

#61
post #2

G’day, if anyone has any questions about this I’m happy to answer them here.

Hi, I already support typescript execution in http://chatcraft.org/ via wasm esbuild.

Runno is really cool as it will also lets me support intepreted languages like Python and maybe even golang(assuming i can have a wasi binary produce another wasi binary).

From docs: Currently @runno/wasi supports running only unstable and snapshot-preview1 WASI binaries. The snapshot-preview1 standard is more recent, and preferred.

Where does one see what's part of snapshot-preview1? My google-foo is failing me.

Re: Running WASI binaries from your HTML using Web Components

#62
post #29

Earlier quoted context omitted.

That expectation is off by nearly a decade. WASM games in terms of performance are closer to 2000 than 2010. Here's an open source indie game from 2003 that I ported to WASM [1]. It struggles to hit 60 FPS on devices that were released a good 15 years after the game itself. Browsers sometimes struggle to animate simple lines at 60 FPS still to this day, because they're just hugely massive platforms with thousands of…

Glancing at the project, one area where things could go terribly wrong is the translation layer from GL 1.x to WebGL. For instance 'tricks' that are common on native GL implementations like buffer orphaning are actually harmful on WebGL and may cause lock stalls which would cause exactly the issues you describe (e.g. struggling to hit a consistent frame rate despite extremely low CPU and GPU load). Even though WebGL…

A couple of years back I also wrote a pure WebGL renderer for Neverball levels [1]. No physics, no translation to WebGL, just the 3D renderer part in direct WebGL. It also has a surprisingly low performance ceiling. I'd say I managed even worse than what the gl4es translation layer does for Neverball. By far the biggest performance boosts were instanced arrays and vertex array objects - basically just reducing the number of calls into WebGL. Seems to me that WebGL has a lot of overhead with or without a translation layer.

[1] https://github.com/parasti/parabola

Re: Running WASI binaries from your HTML using Web Components

#63
post #58
post #29

Earlier quoted context omitted.

That expectation is off by nearly a decade. WASM games in terms of performance are closer to 2000 than 2010. Here's an open source indie game from 2003 that I ported to WASM [1]. It struggles to hit 60 FPS on devices that were released a good 15 years after the game itself. Browsers sometimes struggle to animate simple lines at 60 FPS still to this day, because they're just hugely massive platforms with thousands of…

There's definitely something strange going on here. I'm getting about 3x as much CPU load on the WASM version as compared to native. Still low enough for a solid 144fps on my machine, but there shouldn't be this much overhead.

The number of calls needs to be lower for a WebGL application. You have to use as much instancing as possible. The security layer makes the calls the slowest part of the pipeline. That's why you see amazing things in shadertoy. When the whole shebang is in the shader it runs smooth.

Re: Running WASI binaries from your HTML using Web Components

#64
post #46

Earlier quoted context omitted.

The unreal citadel demo was running in a browser without flash in 2014: https://blog.mozilla.org/en/mozilla/mozilla-and-epic-preview...

3 years to catch up with 2011 tech, and a decade later nothing better to show.

My hypothesis is that monetization on the web is harder so there are not as many resources spent on games in browsers. If anyone is willing to spend a lot of time on the game they are probably willing to install it, people arent conditioned to pay up front for websites, the UX around microtransactions isn't at all smooth.

Re: Running WASI binaries from your HTML using Web Components

#65
post #2

G’day, if anyone has any questions about this I’m happy to answer them here.

Hi, I already support typescript execution in http://chatcraft.org/ via wasm esbuild. Runno is really cool as it will also lets me support intepreted languages like Python and maybe even golang(assuming i can have a wasi binary produce another wasi binary). From docs: Currently @runno/wasi supports running only unstable and snapshot-preview1 WASI binaries. The snapshot-preview1 standard is more recent, and preferred.…

Snapshot Preview 1 is the standard all tools are building to right now. The specification is available here: https://github.com/WebAssembly/WASI/blob/main/legacy/preview...

It's pretty unreadable though!

Preview 2 looks like it will be a big change, and is just being finalised at the moment. I'd expect that when preview 2 is available there will be an improvement in the quality of documentation. I'm not sure how long it will take after release for tools to start switching to it. I'd expect Preview 1 will still be the main target at least for the rest of this year.

Re: Running WASI binaries from your HTML using Web Components

#67
post #62

Earlier quoted context omitted.

Glancing at the project, one area where things could go terribly wrong is the translation layer from GL 1.x to WebGL. For instance 'tricks' that are common on native GL implementations like buffer orphaning are actually harmful on WebGL and may cause lock stalls which would cause exactly the issues you describe (e.g. struggling to hit a consistent frame rate despite extremely low CPU and GPU load). Even though WebGL…

A couple of years back I also wrote a pure WebGL renderer for Neverball levels [1]. No physics, no translation to WebGL, just the 3D renderer part in direct WebGL. It also has a surprisingly low performance ceiling. I'd say I managed even worse than what the gl4es translation layer does for Neverball. By far the biggest performance boosts were instanced arrays and vertex array objects - basically just reducing the nu…

I did some GL benchmarking for simple draw calls (on desktop) a couple of years ago, and while it's true that WebGL came out lowest, the difference between native drivers were much bigger. I basically checked how many trivial draw calls (16 bytes uniform update + draw call) were needed on Windows before the frame rate drops below 60 fps, and for WebGL in Chrome this was around 5k, Intel native was around 13k, and NVIDIA topped out at arond 150k (not all that surprising, since NVIDIA has traditionally the best GL drivers).

It is definitely true though that you need to employ old-school batching tricks to get any sort of performance out of WebGL, but that's also not surprising, because WebGL is only a GL by name, internally it works entirely different (for instance on Windows, WebGL implementations are backed by D3D).

Re: Running WASI binaries from your HTML using Web Components

#68
post #56

Earlier quoted context omitted.

Flash was destroyed by Apple, which had no interest in improving the web either. The iOS platform turned out to be a pretty good replacement for Flash though.

Apparently people keep forgetting that after that memo, Adobe produced an AOT compiler for Flash, targeting iOS.

Sure, but what's the point if it's not supported by Safari. Adobe Air was at best a porting aid to get your old Flash code wrapped in an iOS app, but the writing was on the wall and nobody in their right mind would start new Flash projects.

Re: Running WASI binaries from your HTML using Web Components

#69
post #59

Earlier quoted context omitted.

These are mostly business issues. If the business problems would be solved, the games would be built, despite any technical limitations of the web platform (which are not much different than limitations on low-end Android mobile devices). Nobody has figured out so far how to make money with high quality games on the "open web" to get the same return on investment like simple ad-driven 2D games running on closed platf…

No they aren't, at least low end Android devices support GL ES 3.2 and have proper debugging tools. After a decade Web 3D keeps having spectorJS as the only alternative. Naturally there are also some masochists that enjoy debugging the browser 3D stack on RenderDoc, while trying to figure out what belongs to their application.

If you use WASM+WebGL, you'd typically debug a native build outside the browser.

According to here GLES3.2 support on Android is currently sitting at 80%, while with GLES3.0 you would reach about 95%, and with GLES2 100%.

https://developer.android.com/about/dashboards#OpenGL

If I would try to ship a native app on Android I would still at least try to only use GLES3.0 features to get that extra 15%.

You enthusiastic charactization of Android debugging tools isn't exactly how I would describe the situation ;)

Re: Running WASI binaries from your HTML using Web Components

#70
post #56

Earlier quoted context omitted.

Apparently people keep forgetting that after that memo, Adobe produced an AOT compiler for Flash, targeting iOS.

Sure, but what's the point if it's not supported by Safari. Adobe Air was at best a porting aid to get your old Flash code wrapped in an iOS app, but the writing was on the wall and nobody in their right mind would start new Flash projects.

And now a decade later, despite PlayCanvas and Babylonjs, there is hardly anything that compares.

Mobile, handhelds and cloud streaming, is where the indie party is going on.

I bet WebGPU is going to be equally the same, ShaderToy and 3D commerce visualisation tools will be updated for it, and that is it.

Specially given that it made the same mistake of WebGL, lagging 10 years behind native APIs.

Post reply on HN