
Standalone WebAssembly games using I/O devices - panic
https://medium.com/wasmer/wasmer-io-devices-announcement-6f2a6fe23081
======
xyproto
When people write games for ie. Steam, I assume they either use a 3D engine or
something custom written in C++ for OpenGL, DirectX or Vulkan.

When people write interactive 3D graphics for the web, there's ThreeJS and
WebGL.

Where does WebAssembly games using I/O devices fit in all of this?

~~~
pfisch
You can compile unity to web assembly. There are several other similar engines
out there that compile to wasm.

~~~
xyproto
Yes, and while that is super cool and nifty, I am struggling to find the
perfect use-case for this.

~~~
pfisch
F2P Games that run in browsers.....

~~~
xyproto
Fair enough!

------
I_AM_A_SMURF
I'm a little out of the loop with WASI. Is there a way to play sound with it
too? or is it just video output for now?

~~~
snek
wasi doesn't have sound or video, it appears wasmer exposed a nonstandard api
via wasi file streams.

------
TazeTSchnitzel
Does the WebAssembly community really need to reinvent the wheel and create
yet another set of new platform APIs?

~~~
flohofwoe
There are no cross-platform APIs for something as simple as "blit a bunch of
pixels to the screen" anyway, so WASI is pretty much free to define its own.

I'm sure over time, and if desired, WASI will get a set of higher level
platform-wrapper APIs for rendering, audio, input and networking, but the
requirements are somewhat different from traditional "native" APIs, for
instance, compatibility with web APIs is useful. So we'll probably see the
WebGPU API for 3D rendering, instead of Vulkan, D3D12 or Metal.

~~~
LockAndLol
What about OpenGL?

~~~
flohofwoe
OpenGL is on the way out, and for rendering 2D image data it requires too much
setup code (need to create the GL context, a swap chain, a texture, and
(unless GL 1.x is used) a vertex buffer, shader and setting up tons of render
state).

For 3D rendering, WebGPU would be the better option to support in WASI because
it has standalone native implementations:

[https://dawn.googlesource.com/dawn](https://dawn.googlesource.com/dawn)

[https://github.com/gfx-rs/wgpu](https://github.com/gfx-rs/wgpu)

But for blitting CPU-generated 2D image data to the screen WebGPU is also sort
of overkill (of course it would be possible to create a much simplified
wrapper library in WASM).

~~~
gdxhyrd
No, OpenGL is not "on the way out". Please back up your claims.

~~~
drfuchs
“Apple deprecates OpenGL across all OSes”:
[https://www.anandtech.com/show/12894/apple-deprecates-
opengl...](https://www.anandtech.com/show/12894/apple-deprecates-opengl-
across-all-oses)

~~~
gdxhyrd
Apple is not Khronos.

They haven't supported OpenGL for years anyway, so the fact they deprecate it
now is irrelevant.

~~~
dahfizz
A cross platform library loses its potency if it doesn't work cross platform.

~~~
gdxhyrd
OpenGL does not stop being cross-platform just because it does not work
natively in 1 platform.

In any case, abstraction layers for macOS already exist.

And, going by your definition, if Apple only allows Metal, then no API will be
cross-platform ever anyway.

------
marcinzelent
Why use WebAssembly to create standalone programs, instead of some commonly
used languages for writing desktop apps, like C++ or Java?

